--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="perf"/>
+ <classpathentry kind="src" path="shared"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.ctf.core.tests</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.ctf.core.tests;singleton:=true
+Bundle-Activator: org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.tracecompass.ctf.core,
+ org.eclipse.tracecompass.common.core
+Export-Package: org.eclipse.tracecompass.ctf.core.tests;x-friends:="org.eclipse.tracecompass.alltests",
+ org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;x-internal:=true,
+ org.eclipse.tracecompass.ctf.core.tests.event;x-internal:=true,
+ org.eclipse.tracecompass.ctf.core.tests.io;x-internal:=true,
+ org.eclipse.tracecompass.ctf.core.tests.perf,
+ org.eclipse.tracecompass.ctf.core.tests.perf.trace;x-internal:=true,
+ org.eclipse.tracecompass.ctf.core.tests.scope,
+ org.eclipse.tracecompass.ctf.core.tests.shared,
+ org.eclipse.tracecompass.ctf.core.tests.synthetictraces;x-friends:="org.eclipse.tracecompass.tmf.remote.ui.swtbot.tests",
+ org.eclipse.tracecompass.ctf.core.tests.trace;x-internal:=true,
+ org.eclipse.tracecompass.ctf.core.tests.types;x-internal:=true
+Import-Package: com.google.common.collect,
+ org.antlr.runtime;version="3.2.0",
+ org.eclipse.test.performance
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = shared,\
+ src/,\
+ perf/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ traces/get-traces.xml,\
+ about.html
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.perf;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Run all performance test suites.
+ *
+ * @author Alexandre Montplaisir
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.ctf.core.tests.perf.trace.AllPerfTests.class
+})
+public class AllPerfTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CTFTraceCallsitePerformanceTest.class,
+ TraceReadBenchmark.class,
+ TraceSeekBenchmark.class
+})
+public class AllPerfTests {
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Random;
+import java.util.TreeSet;
+
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the performance of the callsite storage in the CTF trace.
+ *
+ * @author Matthew Khouzam
+ */
+public class CTFTraceCallsitePerformanceTest {
+
+ private static final String TEST_SUITE_NAME = "CTF Callsite Benchmark";
+ private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private static final int NUMBER_OF_SEEKS = 100000;
+
+ private final String[] callsites = { "Alligator", "Bunny", "Cat",
+ "Dolphin", "Echidna", "Gazelle", "Heron", "Ibex", "Jackalope",
+ "Koala", "Lynx", "Meerkat", "Narwhal", "Ocelot", "Pangolin",
+ "Quetzal", "Ringtail", "Sandpiper", "Tiger", "Urchin", "Vulture",
+ "Walrus", "X-Ray Tetra", "Zonkey" };
+
+ private final String[] functions = { "sentence", "together", "children",
+ "mountain", "chipmunk", "crashing", "drinking", "insisted",
+ "insulted", "invented", "squinted", "standing", "swishing",
+ "talented", "whiplash", "complain", "granddad", "sprinkle",
+ "surprise", "umbrella", "anything", "anywhere", "baseball",
+ "birthday", "bluebird", "cheerful", "colorful", "daylight",
+ "doghouse", "driveway", "everyone" };
+
+ private final String[] files = { "Adult.java", "Aeroplane.java",
+ "Air.java", "Airforce.java", "Airport.java", "Album.java",
+ "Alphabet.java", "Apple.java", "Arm.java", "Army.java", "Babby.java" };
+
+ Random rnd = new Random();
+ CTFTrace fTrace = null;
+
+ /**
+ * main, launches the tests.
+ *
+ * @param args
+ * not read
+ */
+ public static void main(String[] args) {
+ new org.junit.runner.JUnitCore().run(CTFTraceCallsitePerformanceTest.class);
+ }
+
+ /**
+ * sets up the test by making a new trace.
+ *
+ * @throws CTFException
+ * an exception from the reader
+ * @throws SecurityException
+ * an exception from accessing files illegally
+ * @throws IllegalArgumentException
+ * an exception for passing bad values
+ */
+ @Before
+ public void setup() throws CTFException, SecurityException,
+ IllegalArgumentException {
+ assumeTrue(testTrace.exists());
+ fTrace = new CTFTrace(testTrace.getPath());
+ }
+
+ private void addCallsites(int numCallsites) {
+ long stepSize = (Long.MAX_VALUE / (numCallsites + 1));
+ int jitter = (int) Math.min(stepSize, Integer.MAX_VALUE);
+ for (int i = 0; i < numCallsites; i++) {
+ final long ip = ((i)) * stepSize + rnd.nextInt(jitter);
+ fTrace.addCallsite(getRandomElement(callsites),
+ getRandomElement(functions), ip, getRandomElement(files),
+ (ip / 1000000) * 100);
+ }
+ }
+
+ private String getRandomElement(String[] array) {
+ return array[rnd.nextInt(array.length)];
+ }
+
+ private void testMain(PerformanceMeter pm) {
+ TreeSet<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
+ CTFCallsite cs = fTrace.getCallsite(1);
+ CTFCallsite cs1 = fTrace.getCallsite(callsites[0]);
+ CTFCallsite cs2 = fTrace.getCallsite(callsites[0], 1);
+ assertNotNull(l);
+ assertNotNull(cs);
+ assertNotNull(cs1);
+ assertNotNull(cs2);
+ /* performance test */
+ pm.start();
+ perfTest();
+ pm.stop();
+ }
+
+ /**
+ * @param callsiteSize
+ */
+ private void test(int callsiteSize) {
+ String testName = "Test" + callsiteSize + " callsites";
+ addCallsites(callsiteSize);
+ Performance perf = Performance.getDefault();
+ PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
+ perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + callsiteSize + " callsites", Dimension.CPU_TIME);
+ testMain(pm);
+ pm.commit();
+ }
+
+ private void perfTest() {
+ for (int i = 0; i < NUMBER_OF_SEEKS; i++) {
+ fTrace.getCallsite((((long) rnd.nextInt()) << 16L));
+ }
+ }
+
+ /**
+ * Test seeks with 1000 callsites
+ */
+ @Test
+ public void test1KCallsites() {
+
+ test(1000);
+ }
+
+ /**
+ * Test seeks with 2000 callsites
+ */
+ @Test
+ public void test2KCallsites() {
+ test(2000);
+ }
+
+ /**
+ * Test seeks with 5000 callsites
+ */
+ @Test
+ public void test5KCallsites() {
+ test(5000);
+ }
+
+ /**
+ * Test seeks with 10000 callsites
+ */
+ @Test
+ public void test10KCallsites() {
+ test(10000);
+ }
+
+ /**
+ * Test seeks with 20000 callsites
+ */
+ @Test
+ public void test20KCallsites() {
+ test(20000);
+ }
+
+ /**
+ * Test seeks with 50000 callsites
+ */
+ @Test
+ public void test50KCallsites() {
+ test(50000);
+ }
+
+ /**
+ * Test seeks with 100000 callsites
+ */
+ @Test
+ public void test100KCallsites() {
+ test(100000);
+ }
+
+ /**
+ * Test seeks with 1000000 callsites
+ */
+ @Test
+ public void test1MCallsites() {
+ test(1000000);
+ }
+
+ /**
+ * Test seeks with 2000000 callsites
+ */
+ @Test
+ public void test2MCallsites() {
+ test(2000000);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Convert to a org.eclipse.test.performance test
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Test;
+
+/**
+ * Benchmark of the CTF parser for reading a trace
+ *
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ */
+public class TraceReadBenchmark {
+
+ private static final String TEST_SUITE_NAME = "CTF Read Benchmark";
+ private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
+ private static final int LOOP_COUNT = 100;
+
+ /**
+ * Benchmark reading the trace "kernel"
+ */
+ @Test
+ public void testKernelTrace() {
+ readTrace(CtfTestTrace.KERNEL, "trace-kernel", true);
+ }
+
+ /**
+ * Benchmark reading the bigger trace "kernel_vm"
+ */
+ @Test
+ public void testKernelVmTrace() {
+ readTrace(CtfTestTrace.KERNEL_VM, "trace-kernel-vm", false);
+ }
+
+ private static void readTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) {
+ assumeTrue(testTrace.exists());
+
+ Performance perf = Performance.getDefault();
+ PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
+ perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
+
+ if (inGlobalSummary) {
+ perf.tagAsGlobalSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
+ }
+
+ for (int loop = 0; loop < LOOP_COUNT; loop++) {
+ pm.start();
+ try {
+ CTFTrace trace = testTrace.getTrace();
+ try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
+
+ while (traceReader.hasMoreEvents()) {
+ EventDefinition ed = traceReader.getCurrentEventDef();
+ /* Do something with the event */
+ ed.getCPU();
+ traceReader.advance();
+ }
+ }
+ } catch (CTFException e) {
+ /* Should not happen if assumeTrue() passed above */
+ fail("Test failed at iteration " + loop + ':' + e.getMessage());
+ }
+ pm.stop();
+ }
+ pm.commit();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Convert to a org.eclipse.test.performance test
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Test;
+
+/**
+ * Tests for performance regressions of the ctf reader. It only tests the ctf
+ * reader, not tmf. <br>
+ * This test runs in 3 passes.
+ * <ul>
+ * <li>first it opens a trace</li>
+ * <li>then it reads the trace completely</li>
+ * <li>then it randomly (seeded) seeks NB_SEEKS locations in the trace and reads
+ * one event at each position.</li>
+ * </ul>
+ *
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ */
+public class TraceSeekBenchmark {
+
+ private static final Random RND = new Random(1000);
+
+ private static final int LOOP_COUNT = 25;
+ private static final int NB_SEEKS = 500;
+ private static final String TEST_SUITE_NAME = "CTF Read & Seek Benchmark (" + NB_SEEKS + " seeks)";
+ private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
+
+ /**
+ * Run the benchmark scenario for the trace "kernel"
+ *
+ * @throws CTFException
+ * Should not happen
+ */
+ @Test
+ public void testKernelTrace() throws CTFException {
+ readAndSeekTrace(CtfTestTrace.KERNEL, "trace-kernel", true);
+ }
+
+ private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) throws CTFException {
+ assumeTrue(testTrace.exists());
+
+ Performance perf = Performance.getDefault();
+ PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
+ perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
+
+ if (inGlobalSummary) {
+ perf.tagAsGlobalSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
+ }
+
+ for (int loop = 0; loop < LOOP_COUNT; loop++) {
+ CTFTrace trace = testTrace.getTrace();
+ try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
+
+ /* Read the whole trace to find out the start and end times */
+ EventDefinition firstEvent = traceReader.getCurrentEventDef();
+ final long startTime = firstEvent.getTimestamp();
+ long endTime = startTime;
+ while (traceReader.hasMoreEvents()) {
+ EventDefinition ev = traceReader.getCurrentEventDef();
+ endTime = ev.getTimestamp();
+ traceReader.advance();
+ }
+
+ /* Generate the timestamps we will seek to */
+ List<Long> seekTimestamps = new LinkedList<>();
+ final long range = endTime - startTime;
+ for (int i = 0; i < NB_SEEKS; i++) {
+ long delta = (RND.nextLong() % range);
+ if (delta < 0) {
+ delta += range;
+ }
+ seekTimestamps.add(startTime + delta);
+ }
+
+ /* Benchmark seeking to the generated timestamps */
+ pm.start();
+ for (Long ts : seekTimestamps) {
+ traceReader.seek(ts);
+ traceReader.advance();
+ }
+ pm.stop();
+
+ } catch (CTFException e) {
+ /* Should not happen if assumeTrue() passed above */
+ fail("Test failed at iteration " + loop + ':' + e.getMessage());
+ }
+ }
+ pm.commit();
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+#Properties file for org.eclipse.tracecompass.ctf.core.tests
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = Trace Compass CTF Core Tests Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2014 Ericsson
+
+ 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
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Trace Compass CTF Core Tests Plug-in</name>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <artifactId>org.eclipse.tracecompass.ctf.core.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <properties>
+ <ctfTestSuiteCommit>0f8beba86ae551f42adeb81d1bfddd5645f31013</ctfTestSuiteCommit>
+ </properties>
+
+ <!-- Do not download the test traces if "maven.test.skip" is set -->
+ <profiles>
+ <profile>
+ <id>download-traces</id>
+ <activation>
+ <property>
+ <name>!maven.test.skip</name>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>prepare</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <target>
+ <property name="ctf-test-suite-commit" value="${ctfTestSuiteCommit}"/>
+ <ant antfile="get-traces.xml" dir="traces" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>**/AllCtfCoreTests.*</include>
+ </includes>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <product>org.eclipse.platform.ide</product>
+ </configuration>
+ </plugin>
+
+ <!-- We don't use the ant file to clean because of http://jira.codehaus.org/browse/MANTRUN-78 -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.6.1</version>
+ <executions>
+ <execution>
+ <id>clean-traces</id>
+ <phase>clean</phase>
+ <configuration>
+ <filesets>
+ <fileset><directory>traces/ctf-testsuite</directory></fileset>
+ <fileset><directory>traces/cyg-profile</directory></fileset>
+ <fileset><directory>traces/django-benchmark</directory></fileset>
+ <fileset><directory>traces/funky_trace</directory></fileset>
+ <fileset><directory>traces/hello-lost</directory></fileset>
+ <fileset><directory>traces/kernel</directory></fileset>
+ <fileset><directory>traces/kernel_vm</directory></fileset>
+ <fileset><directory>traces/synctraces</directory></fileset>
+ <fileset><directory>traces/synthetic-trace</directory></fileset>
+ <fileset><directory>traces/trace2</directory></fileset>
+ <fileset><directory>traces/exp</directory></fileset>
+ <fileset><directory>traces/flipping-endianness</directory></fileset>
+ </filesets>
+ </configuration>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.shared;
+
+import java.io.File;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.tests.synthetictraces.LttngKernelTraceGenerator;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+
+/**
+ * Here is the list of the available test traces for the CTF parser.
+ *
+ * Make sure you run the traces/get-traces.xml Ant script to download them
+ * first!
+ *
+ * @author Alexandre Montplaisir
+ */
+public enum CtfTestTrace {
+ /**
+ * Example kernel trace
+ *
+ * <pre>
+ * Trace Size: 13 MB
+ * Tracer: lttng-modules 2.0.0
+ * Event count: 695 319
+ * Kernel version: 3.0.0-16-generic-pae
+ * Trace length: 10s
+ * </pre>
+ */
+ KERNEL("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel", 695319, 10),
+
+ /**
+ * Another kernel trace
+ *
+ * <pre>
+ * Trace Size: 14 MB
+ * Tracer: lttng-modules 2.0.0
+ * Event count: 595 641
+ * Kernel version: 3.2.0-18-generic
+ * Trace length: 11s
+ * </pre>
+ */
+ TRACE2("../org.eclipse.tracecompass.ctf.core.tests/traces/trace2", 595641, 11),
+
+ /**
+ * Kernel trace with event contexts: pid, ppid, tid, procname,
+ * perf_page_fault, perf_major_faults, perf_minor_faults
+ *
+ * <pre>
+ * Trace Size: 56 MB
+ * Tracer: lttng-modules 2.1.0
+ * Event count: 714 484
+ * Kernel version: 3.8.1
+ * Trace length: 29s
+ * </pre>
+ */
+ KERNEL_VM("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel_vm", 714484, 29),
+
+ /**
+ * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
+ * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
+ * events. Can be used along with {@link CtfTestTrace#SYNC_DEST} for trace
+ * synchronization.
+ *
+ * <pre>
+ * Trace Size: 2.4 MB
+ * Tracer: lttng-modules 2.1.0
+ * Event count: 110 771
+ * Kernel version: 3.6.11-1-ARCH
+ * Trace length: 23s
+ * </pre>
+ */
+ SYNC_SRC("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_src", 110771, 23),
+
+ /**
+ * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
+ * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
+ * events. Can be used along with {@link CtfTestTrace#SYNC_SRC} for trace
+ * synchronization.
+ *
+ * <pre>
+ * Trace Size: 1.9 MB
+ * Tracer: lttng-modules 2.1.0
+ * Event count: 85 729
+ * Kernel version: 3.6.11-1-ARCH
+ * Trace length: 17s
+ * </pre>
+ */
+ SYNC_DEST("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_dest", 85729, 17),
+
+ /**
+ * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
+ * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
+ * be used along with {@link CtfTestTrace#DJANGO_DB} and
+ * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
+ *
+ * <pre>
+ * Trace Size: 33 MB
+ * Tracer: lttng-modules 2.4.0
+ * Event count: 754 787
+ * Kernel version: 3.13.0-24-generic
+ * Trace length: 15s
+ * </pre>
+ */
+ DJANGO_CLIENT("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-client", 754787, 15),
+
+ /**
+ * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
+ * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
+ * be used along with {@link CtfTestTrace#DJANGO_CLIENT} and
+ * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
+ *
+ * <pre>
+ * Trace Size: 28 MB
+ * Tracer: lttng-modules 2.4.0
+ * Event count: 692 098
+ * Kernel version: 3.13.0-24-generic
+ * Trace length: 14s
+ * </pre>
+ */
+ DJANGO_DB("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-db", 692098, 14),
+
+ /**
+ * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
+ * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
+ * be used along with {@link CtfTestTrace#DJANGO_DB} and
+ * {@link CtfTestTrace#DJANGO_CLIENT} for trace synchronization.
+ *
+ * <pre>
+ * Trace Size: 31 MB
+ * Tracer: lttng-modules 2.4.0
+ * Event count: 779 096
+ * Kernel version:3.13.0-24-generic
+ * Trace length: 13s
+ * </pre>
+ */
+ DJANGO_HTTPD("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-httpd", 779096, 13),
+
+ /**
+ * UST trace with lots of lost events
+ *
+ * <pre>
+ * Trace Size: 3.4 MB
+ * Tracer: lttng-ust 2.3
+ * Event count: 1 000 000, with 967 700 lost events
+ * Trace length: 279ms
+ * </pre>
+ */
+ HELLO_LOST("../org.eclipse.tracecompass.ctf.core.tests/traces/hello-lost", 1000000, 0),
+
+ /**
+ * UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions)
+ *
+ * <pre>
+ * Trace Size: 236 KB
+ * Tracer: lttng-ust 2.3
+ * Event count: 4 977
+ * Trace length: 10s
+ * </pre>
+ */
+ CYG_PROFILE("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile", 4977, 10),
+
+ /**
+ * UST trace with lttng-ust-cyg-profile-fast events (no address in
+ * func_exit)
+ *
+ * <pre>
+ * Trace Size: 184 KB
+ * Tracer: lttng-ust 2.3
+ * Event count: 5 161
+ * Trace length: 11s
+ * </pre>
+ */
+ CYG_PROFILE_FAST("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast", 5161, 11),
+
+ /** Autogenerated Syntetic trace */
+ SYNTHETIC_TRACE(LttngKernelTraceGenerator.getPath(), -1, -1),
+
+ /** Trace with non-standard field sizes */
+ FUNKY_TRACE("../org.eclipse.tracecompass.ctf.core.tests/traces/funky_trace", 100002, 0),
+
+ /**
+ * Kernel Trace with 64 bit aligned headers
+ *
+ * <pre>
+ * Trace Size: 1.1 MB
+ * Tracer: lttng-kernel 2.5
+ * Event count: 31 556
+ * Trace length: 6 s
+ * </pre>
+ */
+ ARM_64_BIT_HEADER("../org.eclipse.tracecompass.ctf.core.tests/traces/bug446190", 31556, 6),
+
+ /**
+ * Kernel Trace with flipping endianness
+ *
+ * <pre>
+ * Trace Size: 327 KB
+ * Tracer: lttng-kernel 2.5
+ * Event count: 14 310
+ * Trace length: 41 s
+ * </pre>
+ */
+ FLIPPING_ENDIANNESS("../org.eclipse.tracecompass.ctf.core.tests/traces/flipping-endianness", 14310, 41),
+
+ /** Set of many traces, do not call getTrace */
+ TRACE_EXPERIMENT("../org.eclipse.tracecompass.ctf.core.tests/traces/exp", -1, -1);
+
+ private final String fPath;
+ private CTFTrace fTrace = null;
+ private CTFTrace fTraceFromFile = null;
+ private final int fNbEvent;
+ private int fDuration;
+
+ private CtfTestTrace(String path, int nbEvent, int time) {
+ fPath = path;
+ fNbEvent = nbEvent;
+ fDuration = time;
+ }
+
+ /** @return The path to the test trace */
+ public String getPath() {
+ return fPath;
+ }
+
+ /**
+ * Get the number of events for a trace
+ *
+ * @return the number of events, -1 if irrelevant
+ */
+ public int getNbEvents() {
+ return fNbEvent;
+ }
+
+ /**
+ * Get the duration in seconds of a trace
+ *
+ * @return the duration in seconds of a trace, -1 if irrelevant
+ */
+ public int getDuration() {
+ return fDuration;
+ }
+
+ /**
+ * Get a CTFTrace instance of a test trace. Make sure {@link #exists()}
+ * before calling this!
+ *
+ * @return The CTFTrace object
+ * @throws CTFException
+ * If the trace cannot be found.
+ */
+ public CTFTrace getTrace() throws CTFException {
+ if (fTrace == null) {
+ fTrace = new CTFTrace(fPath);
+ }
+ return fTrace;
+ }
+
+ /**
+ * Get a CTFTrace instance created from a File. Make sure {@link #exists()}
+ * before calling this!
+ *
+ * @return The CTFTrace object
+ * @throws CTFException
+ * If the trace cannot be found.
+ */
+ public CTFTrace getTraceFromFile() throws CTFException {
+ if (fTraceFromFile == null) {
+ fTraceFromFile = new CTFTrace(new File(fPath));
+ }
+ return fTraceFromFile;
+ }
+
+ /**
+ * Check if this test trace actually exists on disk.
+ *
+ * @return If the trace exists
+ */
+ public boolean exists() {
+ try {
+ getTrace();
+ } catch (CTFException e) {
+ return false;
+ }
+ return true;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfCorePluginTest.class,
+ org.eclipse.tracecompass.ctf.core.tests.ctftestsuite.TestAll.class,
+ org.eclipse.tracecompass.ctf.core.tests.event.TestAll.class,
+ org.eclipse.tracecompass.ctf.core.tests.io.TestAll.class,
+ org.eclipse.tracecompass.ctf.core.tests.scope.TestAll.class,
+ org.eclipse.tracecompass.ctf.core.tests.trace.TestAll.class,
+ org.eclipse.tracecompass.ctf.core.tests.types.TestAll.class
+})
+public class AllCtfCoreTests {
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 Ericsson
+ *
+ * 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:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
+import org.junit.Test;
+
+/**
+ * <b><u>CtfCorePluginTest</u></b>
+ * <p>
+ * Test the CTF core plug-in activator
+ */
+@SuppressWarnings("javadoc")
+public class CtfCorePluginTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ // Plug-in instantiation
+ private final static Activator fPlugin = Activator.getDefault();
+
+
+ // ------------------------------------------------------------------------
+ // Test cases
+ // ------------------------------------------------------------------------
+
+ @Test
+ public void testCtfCorePluginId() {
+ assertEquals(
+ "Plugin ID", "org.eclipse.tracecompass.ctf.core", Activator.PLUGIN_ID);
+ }
+
+ @Test
+ public void testGetDefault() {
+ Activator plugin = Activator.getDefault();
+ assertEquals("getDefault()", plugin, fPlugin);
+ }
+
+ @Test
+ public void testLog() {
+ try {
+ Activator.log("Some message");
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests;
+
+import java.io.File;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CtfCoreTestPlugin extends Plugin {
+
+ private static final String TEMP_DIR_NAME = ".temp"; //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.tracecompass.ctf.core.tests";
+
+ // The shared instance
+ private static CtfCoreTestPlugin fPlugin;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The constructor
+ */
+ public CtfCoreTestPlugin() {
+ setDefault(this);
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the shared instance
+ */
+ public static CtfCoreTestPlugin getDefault() {
+ return fPlugin;
+ }
+
+ /**
+ * @param plugin
+ * the shared instance
+ */
+ private static void setDefault(CtfCoreTestPlugin plugin) {
+ fPlugin = plugin;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ setDefault(this);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ setDefault(null);
+ super.stop(context);
+ }
+
+ /**
+ * Get the temporary directory path. If there is an instance of Eclipse
+ * running, the temporary directory will reside under the workspace.
+ *
+ * @return the temporary directory path suitable to be passed to the
+ * java.io.File constructor without a trailing separator
+ */
+ public static String getTemporaryDirPath() {
+ String property = System.getProperty("osgi.instance.area"); //$NON-NLS-1$
+ if (property != null) {
+ try {
+ File dir = URIUtil.toFile(URIUtil.fromString(property));
+ dir = new File(dir.getAbsolutePath() + File.separator + TEMP_DIR_NAME);
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ return dir.getAbsolutePath();
+ } catch (URISyntaxException e) {
+ Activator.logError(e.getLocalizedMessage(), e);
+ }
+ }
+ return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Parameterized test class running the CTF Test Suite
+ *
+ * (from https://github.com/efficios/ctf-testsuite).
+ *
+ * @author Alexandre Montplaisir
+ */
+@RunWith(Parameterized.class)
+public class CtfTestSuiteTests {
+
+ /** Time-out tests after 10 seconds. */
+ @Rule
+ public TestRule globalTimeout = new Timeout(10000);
+
+ private static final Path BASE_PATH = Paths.get("traces", "ctf-testsuite", "tests", "1.8");
+
+ /**
+ * Test we know are currently failing. Ignore them so we can at least run
+ * the others.
+ *
+ * TODO Actually fix them!
+ */
+ private static final Path[] IGNORED_TESTS = {
+ BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "sequence-typedef-length")),
+ BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "array-of-struct")),
+ BASE_PATH.resolve(Paths.get("regression", "stream", "pass", "integer-large-size")),
+ BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "metadata-packetized-endianness-mismatch"))
+ };
+
+ private final String fTracePath;
+ private final boolean fExpectSuccess;
+
+ // ------------------------------------------------------------------------
+ // Methods for the Parametrized runner
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the existing trace paths in the CTF-Testsuite git tree.
+ *
+ * @return The list of CTF traces (directories) to test
+ */
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> getTracePaths() {
+ final List<Object[]> dirs = new LinkedList<>();
+
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "metadata", "fail")), false);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "metadata", "pass")), true);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "stream", "fail")), false);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "stream", "pass")), true);
+
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "metadata", "fail")), false);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "metadata", "pass")), true);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "stream", "fail")), false);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "stream", "pass")), true);
+
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "fail")), false);
+ addDirsOneLevelDeepFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "pass")), true);
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "fail")), false);
+ addDirsOneLevelDeepFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "pass")), true);
+
+ return dirs;
+ }
+
+ private static void addDirsFrom(List<Object[]> dirs, Path path, boolean expectSuccess) {
+ if (!Files.exists(path)) {
+ /* Some planned directories may not exist yet in the test suite */
+ return;
+ }
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, DIR_FILTER);) {
+ for (Path p : ds) {
+ /* Add this test case to the list of tests to run */
+ Object array[] = new Object[] { p.toString(), expectSuccess };
+ dirs.add(array);
+ }
+ } catch (IOException e) {
+ /* Something is wrong with the layout of the test suite? */
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Some test traces are not in pass/trace1, pass/trace2, etc. but rather
+ * pass/test1/trace1, pass/test1/trace2, etc.
+ *
+ * This methods adds the directories one level "down" instead of the very
+ * next level.
+ */
+ private static void addDirsOneLevelDeepFrom(List<Object[]> dirs, Path path,
+ boolean expectSuccess) {
+ if (!Files.exists(path)) {
+ return;
+ }
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, DIR_FILTER);) {
+ for (Path p : ds) {
+ addDirsFrom(dirs, p, expectSuccess);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static final DirectoryStream.Filter<Path> DIR_FILTER =
+ new DirectoryStream.Filter<Path>() {
+ @Override
+ public boolean accept(Path entry) {
+ /* Only accept directories and non-blacklisted tests */
+ if (!Files.isDirectory(entry)) {
+ return false;
+ }
+ for (Path ignoredTestPath : IGNORED_TESTS) {
+ if (entry.equals(ignoredTestPath)) {
+ System.err.println("Skipping test " + entry.toString() + " as requested.");
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+
+ // ------------------------------------------------------------------------
+ // Test constructor
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor for the parametrized tests
+ *
+ * @param tracePath
+ * The complete path to the trace to test
+ * @param expectSuccess
+ * Should this trace parse successfully, or not.
+ */
+ public CtfTestSuiteTests(String tracePath, boolean expectSuccess) {
+ fTracePath = tracePath;
+ fExpectSuccess = expectSuccess;
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test opening and reading the trace
+ */
+ @Test
+ public void testTrace() {
+ try {
+ /* Instantiate the trace (which implies parsing the metadata) */
+ CTFTrace trace = new CTFTrace(fTracePath);
+ /* Read the trace until the end */
+ try (CTFTraceReader reader = new CTFTraceReader(trace);) {
+
+ reader.getCurrentEventDef();
+ while (reader.advance()) {
+ assertNotNull(reader.getCurrentEventDef());
+ }
+
+ checkIfWeShoudlSucceed();
+ }
+ } catch (CTFException e) {
+ checkIfWeShouldFail(e);
+ } catch (OutOfMemoryError e) {
+ checkIfWeShouldFail(e);
+ }
+ }
+
+ private void checkIfWeShoudlSucceed() {
+ if (!fExpectSuccess) {
+ fail("Trace was expected to fail parsing: " + fTracePath);
+ }
+ }
+
+ private void checkIfWeShouldFail(Throwable e) {
+ if (fExpectSuccess) {
+ fail("Trace was expected to succeed, but failed parsing: " +
+ fTracePath + " (" + e.getMessage() + ")");
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfTestSuiteTests.class
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+import org.junit.Test;
+
+/**
+ * The class <code>CTFCallsiteTest</code> contains tests for the class
+ * <code>{@link CTFCallsite}</code>.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+
+public class CTFCallsiteTest {
+
+ private static CTFCallsite GenerateCS(long ip){
+ return new CTFCallsite("event name", "func name", ip, "file.java", 1);
+ }
+
+ /**
+ * Test the constructor
+ */
+ @Test
+ public void constructorTest(){
+ CTFCallsite cs = GenerateCS(0x01);
+ assertNotNull(cs);
+ }
+
+ /**
+ * Test the getters
+ */
+ @Test
+ public void getterTest(){
+ CTFCallsite cs = GenerateCS(0x01);
+ assertEquals("ip", 1, cs.getIp());
+ assertEquals("ip", "event name", cs.getEventName());
+ assertEquals("ip", "file.java", cs.getFileName());
+ assertEquals("ip", "func name", cs.getFunctionName());
+ }
+
+ /**
+ * Test the hash code
+ */
+ @Test
+ public void hashCodeTest(){
+ CTFCallsite cs = GenerateCS(0x01);
+ Map<CTFCallsite, Object> test = new HashMap<>();
+ test.put(cs, new Object());
+ assertTrue(test.containsKey(cs));
+ assertTrue(test.containsKey(GenerateCS(0x01)));
+ assertFalse(test.containsKey(GenerateCS(0x02)));
+ assertFalse(test.containsKey(new CTFCallsite("event nam", "func name", 1, "file.java", 1)));
+ assertFalse(test.containsKey(new CTFCallsite("event name", "func nam", 1, "file.java", 1)));
+ assertFalse(test.containsKey(new CTFCallsite("event name", "func name", 1, "file.jav", 1)));
+ assertFalse(test.containsKey(new CTFCallsite("event name", "func name", 1, "file.java", 2)));
+ }
+
+ /**
+ * Test the comparator (it should sort using the IP)
+ */
+ @Test
+ public void comparatorTest(){
+ CTFCallsite cs[] = new CTFCallsite[5];
+ long vals[] = {1L, 0L, -2L, 2L, -1L};
+ for(int i = 0 ; i < 5 ; i++ ){
+ cs[i] = GenerateCS(vals[i]);
+ }
+
+ assertEquals(1, cs[0].compareTo(cs[1]));
+ assertEquals(-1, cs[1].compareTo(cs[0]));
+ assertEquals(0, cs[0].compareTo(cs[0]));
+ assertEquals(-1, cs[0].compareTo(cs[2]));
+ assertEquals(1, cs[2].compareTo(cs[0]));
+
+ Arrays.sort(cs);
+
+ assertEquals( 0L, cs[0].getIp());
+ assertEquals( 1L, cs[1].getIp());
+ assertEquals( 2L, cs[2].getIp());
+ assertEquals( -2L , cs[3].getIp());
+ assertEquals( -1L, cs[4].getIp());
+ }
+
+ /**
+ * Tests the output of a callsite toString function
+ */
+ @Test
+ public void toStringTest(){
+ CTFCallsite cs = GenerateCS(0x01);
+ assertEquals("file.java/func name:1", cs.toString());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test the event definition
+ *
+ * @author Matthew Khouzam
+ *
+ */
+public class CTFEventDefinitionTest {
+ List<EventDefinition> fixture;
+
+ /**
+ * Making a power set of configurations to test the event definition
+ */
+ @Before
+ public void init() {
+ fixture = new ArrayList<>();
+ IntegerDeclaration pidDec = IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 8);
+ IntegerDeclaration ctxDec = IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 8);
+ IntegerDefinition pid = new IntegerDefinition(pidDec, null, "pid", 3);
+ IntegerDefinition pod = new IntegerDefinition(pidDec, null, "pod", 3);
+ IntegerDefinition ctx = new IntegerDefinition(pidDec, null, "ctx", 3);
+
+ StructDeclaration streamContextDec = new StructDeclaration(8);
+ streamContextDec.addField("pid", pidDec);
+ streamContextDec.addField("ctx", ctxDec);
+ StructDeclaration eventContextDec = new StructDeclaration(8);
+ eventContextDec.addField("pod", pidDec);
+ eventContextDec.addField("ctx", pidDec);
+ StructDeclaration fDec = new StructDeclaration(8);
+ EventDeclaration eventDeclaration = new EventDeclaration();
+
+ fDec.addField("pid", pidDec);
+ fDec.addField("ctx", ctxDec);
+ fDec.addField("pod", pidDec);
+
+ Definition[] sDefs = { pid, ctx };
+ Definition[] eDefs = { pod, ctx };
+ Definition[] fDefs = { pid, ctx, pod };
+
+ StructDeclaration pContextDec = new StructDeclaration(8);
+
+ StructDefinition sContext = new StructDefinition(streamContextDec, null, ILexicalScope.STREAM_PACKET_CONTEXT.getPath(), sDefs);
+ StructDefinition eContext = new StructDefinition(eventContextDec, null, ILexicalScope.STREAM_EVENT_CONTEXT.getPath(), eDefs);
+ StructDefinition pContext = new StructDefinition(pContextDec, null, ILexicalScope.FIELDS.getPath(), new Definition[0]);
+ StructDefinition fields = new StructDefinition(fDec, null, ILexicalScope.FIELDS.getPath(), fDefs);
+
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, null, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, null, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, pContext, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, pContext, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, null, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, null, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, pContext, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, pContext, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, null, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, null, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, pContext, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, pContext, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, null, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, null, fields));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, pContext, null));
+ fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, pContext, fields));
+ }
+
+ /**
+ * Test all the events
+ */
+ @Test
+ public void testEvents() {
+ int i = 0;
+ for (EventDefinition ed : fixture) {
+ test(i, ed);
+ i++;
+ }
+ }
+
+ private static void test(int rank, EventDefinition ed) {
+ String title = "event #" + rank;
+ assertEquals(title, 100L, ed.getTimestamp());
+ ICompositeDefinition context = ed.getContext();
+ if (rank >= 4) {
+ assertNotNull(title, context);
+ if (rank >= 12) {
+ assertEquals(title, 3, context.getFieldNames().size());
+ } else {
+ assertEquals(title, 2, context.getFieldNames().size());
+ }
+
+ } else {
+ assertNull(title, context);
+ }
+ if (((rank / 4) % 2) == 1) {
+ assertNotNull(title, ed.getEventContext());
+ }else{
+ assertNull(title, ed.getEventContext());
+ }
+ if (rank % 2 == 1) {
+ assertNotNull(title, ed.getFields());
+ assertEquals(title, 3, ed.getFields().getFieldNames().size());
+ } else {
+ assertNull(title, ed.getFields());
+ }
+ assertTrue(title, ed.toString().startsWith("Event type: null" + System.getProperty("line.separator") + "Timestamp: 100"));
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.junit.Test;
+
+/**
+ * The class <code>CTFEventFieldTest</code> contains tests for the class
+ * <code>{@link CTFEventField}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFEventFieldTest {
+
+ @NonNull
+ private static final String fieldName = "id";
+
+ /**
+ * Run the CTFEventField parseField(Definition,String) method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testParseField_complex() throws CTFException {
+ int len = 32;
+ IntegerDeclaration id = IntegerDeclaration.createDeclaration(
+ len,
+ false,
+ len,
+ ByteOrder.LITTLE_ENDIAN,
+ Encoding.ASCII,
+ "",
+ len);
+ String lengthName = "LengthName";
+ StructDeclaration structDec = new StructDeclaration(0);
+ structDec.addField(lengthName, id);
+ StructDefinition structDef = new StructDefinition(
+ structDec,
+ null,
+ lengthName,
+ new Definition[] {
+ new IntegerDefinition(
+ id,
+ null,
+ lengthName,
+ 32)
+ });
+
+ SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
+ ByteBuffer byb = testMemory(ByteBuffer.allocate(1024));
+ for (int i = 0; i < 1024; i++) {
+ byb.put((byte) i);
+ }
+ BitBuffer bb = new BitBuffer(byb);
+ IDefinition fieldDef = sd.createDefinition(structDef, "fff-fffield", bb);
+
+ assertNotNull(fieldDef);
+ }
+
+ @NonNull
+ private static ByteBuffer testMemory(ByteBuffer buffer) {
+ if (buffer == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ return buffer;
+ }
+
+ /**
+ * Run the CTFEventField parseField(Definition,String) method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testParseField_simple() throws CTFException {
+ final StringDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ byte[] bytes = { 'T', 'e', 's', 't', '\0' };
+ ByteBuffer bb = testMemory(ByteBuffer.wrap(bytes));
+ IDefinition fieldDef = elemType.createDefinition(null, fieldName, new BitBuffer(bb));
+
+ assertNotNull(fieldDef);
+ }
+
+ /**
+ * Run the CTFEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_simple2() {
+ IntegerDefinition fieldDef = new IntegerDefinition(
+ IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
+ Encoding.ASCII, "", 8), null, fieldName, 1L);
+
+ assertNotNull(fieldDef);
+ }
+
+ /**
+ *
+ */
+ @Test
+ public void testParseField_simple3() {
+ StringDefinition fieldDef = new StringDefinition(
+ StringDeclaration.getStringDeclaration(Encoding.UTF8), null, fieldName, "Hello World");
+
+ String other = "\"Hello World\"";
+ assertNotNull(fieldDef);
+ assertEquals(fieldDef.toString(), other);
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.event;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CTFCallsiteTest.class,
+ CTFEventDefinitionTest.class,
+ CTFEventFieldTest.class
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Alexandre Montplaisir - Extracted from BitBufferTest, cleanup
+ * Matthew Khouzam - Additional tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Part of the {@link BitBuffer} tests which test the methods to read/write
+ * integers. These are separated from the main file because the fixture is
+ * different.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class BitBufferIntTest {
+
+ private BitBuffer fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * Out of bounds, won't happen
+ */
+ @Before
+ public void setUp() throws CTFException {
+ ByteBuffer allocateDirect = ByteBuffer.allocateDirect(128);
+ if (allocateDirect == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ fixture = new BitBuffer(allocateDirect);
+ fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
+ fixture = createBuffer();
+ }
+
+ private static BitBuffer createBuffer() throws CTFException {
+ return createBuffer(16);
+ }
+
+ private static BitBuffer createBuffer(int j) throws CTFException {
+ final byte[] bytes = new byte[j];
+ for (int i = 0; i < j; i++) {
+ bytes[i] = (byte) (i % 0xff);
+ }
+ ByteBuffer wrap = ByteBuffer.wrap(bytes);
+ if (wrap == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer fixture = new BitBuffer(wrap);
+ fixture.position(1);
+ return fixture;
+ }
+
+ /**
+ * Test {@link BitBuffer#getInt} with a basic value
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_base() throws CTFException {
+ int result = fixture.getInt();
+ assertEquals(0x020406, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getInt} with explicit seek at pos 0.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_pos0() throws CTFException {
+ fixture.position(0);
+ int result = fixture.getInt();
+ assertEquals(0x010203, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with seek at pos 1.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_pos1() throws CTFException {
+ fixture.position(1);
+
+ long result = fixture.get(1, true);
+ assertEquals(0, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with seek at pos 2.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_pos2() throws CTFException {
+ fixture.position(2);
+
+ long result = fixture.get(0, true);
+ assertEquals(0, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with explicit little-endian reading.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_le2() throws CTFException {
+ BitBuffer leFixture = createBuffer(128);
+ leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ leFixture.position(0);
+ long result = leFixture.get(24, false);
+ assertEquals(0x020100, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with explicit little-endian reading, with an
+ * offset.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testGetInt_le1() throws CTFException {
+ BitBuffer leFixture = createBuffer(128);
+ leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ leFixture.position(1);
+ long result = leFixture.get(24, false);
+ assertEquals(0x810080, result); /* 0x020100 down-shifted */
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with a 32-bit out-of-bounds read. Should throw
+ * an exception.
+ *
+ * @throws CTFException
+ * Expected
+ */
+ @Test(expected = CTFException.class)
+ public void testGetInt_invalid() throws CTFException {
+ BitBuffer smallFixture = createBuffer(2);
+ smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN);
+
+ smallFixture.position(10);
+
+ /* This will attempt to read past the buffer's end. */
+ smallFixture.get(32, true);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} with a 64-bit out-of-bounds read. Should throw
+ * an exception.
+ *
+ * @throws CTFException
+ * Expected
+ */
+ @Test(expected = CTFException.class)
+ public void testGetInt_invalid2() throws CTFException {
+ BitBuffer smallFixture = createBuffer(2);
+ smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN);
+
+ smallFixture.position(1);
+
+ /* This will attempt to read past the buffer's end. */
+ smallFixture.get(64, true);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong}.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos0() throws CTFException {
+ fixture.position(0);
+ long result = fixture.getLong();
+ assertEquals(0x01020304050607L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong} with an offset of 7.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos7() throws CTFException {
+ fixture.position(7);
+ long result = fixture.getLong();
+ assertEquals(0x81018202830384L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong} with an offset of 8.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos8() throws CTFException {
+ fixture.position(8);
+ long result = fixture.getLong();
+ assertEquals(0x0102030405060708L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong} with a little-endian buffer.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos0LE() throws CTFException {
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.getLong();
+ assertEquals(0x0706050403020100L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 7.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos7LE() throws CTFException {
+ fixture.position(7);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.getLong();
+ assertEquals(0x100e0c0a08060402L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 8.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong_pos8LE() throws CTFException {
+ fixture.position(8);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.getLong();
+ assertEquals(0x0807060504030201L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGet35_pos0BE() throws CTFException {
+ fixture.position(0);
+ long result = fixture.get(35, false);
+ assertEquals(0x081018L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length at an offset position.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGet35_pos8BE() throws CTFException {
+ fixture.position(8);
+ long result = fixture.get(35, false);
+ assertEquals(0x08101820L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length in little-endian.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGet35_pos0LE() throws CTFException {
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, false);
+ assertEquals(0x0403020100L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at
+ * position 7.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong35_pos7LE() throws CTFException {
+ fixture.position(7);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, false);
+ assertEquals(0x0208060402L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at
+ * position 8.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong35_pos8LE() throws CTFException {
+ fixture.position(8);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, false);
+ assertEquals(0x0504030201L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
+ * a signed value.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong35s_pos0LE() throws CTFException {
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, true);
+ assertEquals(0xfffffffc03020100L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
+ * a signed value, at position 7.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong35s_pos7LE() throws CTFException {
+ fixture.position(7);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, true);
+ assertEquals(0x0208060402L, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
+ * a signed value, at position 8.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetLong35s_pos8LE() throws CTFException {
+ fixture.position(8);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ long result = fixture.get(35, true);
+ assertEquals(0xfffffffd04030201L, result);
+ }
+
+ /**
+ * Test reading negative values as signed values.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetSigned() throws CTFException {
+ fixture.position(0);
+ fixture.putInt(-1);
+ fixture.putInt(-1);
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+
+ long result = fixture.get(32, true);
+ assertEquals(-1L, result);
+ }
+
+ /**
+ * Test reading negative values as unsigned values.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetUnsigned() throws CTFException {
+ fixture.position(0);
+ fixture.putInt(-1);
+ fixture.putInt(-1);
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+
+ long result = fixture.get(32, false);
+ assertEquals(0xFFFFFFFFL, result);
+ }
+
+ /**
+ * Test reading 24 bits of a 32-bit negative value as a signed value.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGet24Signed() throws CTFException {
+ fixture.position(0);
+ fixture.putInt(-1);
+ fixture.putInt(-1);
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+
+ long result = fixture.get(24, true);
+ assertEquals(-1L, result);
+ }
+
+ /**
+ * Test reading 24 bits of a 32-bit negative value as an unsigned value.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGet24Unsigned() throws CTFException {
+ fixture.position(0);
+ fixture.putInt(-1);
+ fixture.putInt(-1);
+ fixture.position(0);
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+
+ long result = fixture.get(24, false);
+ assertEquals(0xFFFFFFL, result);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int)}
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutInt() throws CTFException {
+ fixture.position(1);
+ fixture.putInt(1);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int, int)}
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutInt_length1() throws CTFException {
+ fixture.position(1);
+ fixture.putInt(1, 1);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int, int)} with length = 0.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutInt_length0() throws CTFException {
+ fixture.position(1);
+ fixture.putInt(0, 1);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int)} Little endian
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutIntLe() throws CTFException {
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ fixture.position(1);
+ fixture.putInt(1);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int, int)} Little endian
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutIntLe_length1() throws CTFException {
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ fixture.position(1);
+ fixture.putInt(1, 1);
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt(int, int)} with length = 0. Little endian
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutIntLe_length0() throws CTFException {
+ fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+ fixture.position(1);
+ fixture.putInt(0, 1);
+ }
+
+ /**
+ * Test writing and reading a value defined in hex format.
+ *
+ * @throws CTFException
+ * Not expected
+ */
+ @Test
+ public void testPutInt_hex() throws CTFException {
+ final int value = 0x010203;
+
+ for (int i = 0; i <= 32; i++) {
+ fixture.position(i);
+ fixture.putInt(value);
+
+ fixture.position(i);
+ int read = fixture.getInt();
+
+ assertEquals(value, read);
+ }
+ }
+
+ /**
+ * Test {@link BitBuffer#putInt} with an out-of-bounds length. An exception
+ * should be thrown.
+ *
+ * @throws CTFException
+ * Expected
+ */
+ @Test(expected = CTFException.class)
+ public void testPutInt_invalid() throws CTFException {
+ BitBuffer fixture2;
+ fixture2 = createBuffer(4);
+ fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
+ fixture2.position(1);
+
+ /* This will try writing past the buffer's end */
+ fixture2.putInt(32, 1);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.io;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>BitBufferTest</code> contains tests for the class
+ * <code>{@link BitBuffer}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class BitBufferTest {
+
+ private BitBuffer fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * An error that cannot happen (position is under 128)
+ */
+ @Before
+ public void setUp() throws CTFException {
+ fixture = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(1)));
+ fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
+ fixture.position(1);
+ }
+
+ /**
+ * Run the BitBuffer() constructor test.
+ */
+ @Test
+ public void testBitBuffer() {
+ BitBuffer result = new BitBuffer();
+
+ assertNotNull(result);
+ assertEquals(0, result.position());
+ assertNotNull(result.getByteBuffer());
+ }
+
+ /**
+ * Run the BitBuffer(ByteBuffer) constructor test.
+ */
+ @Test
+ public void testBitBuffer_fromByteBuffer() {
+ BitBuffer result = new BitBuffer(Util.testMemory(ByteBuffer.allocate(0)));
+ assertNotNull(result);
+ assertEquals(0, result.position());
+ }
+
+ /**
+ * Run the boolean canRead(int) method test.
+ */
+ @Test
+ public void testCanRead_1param() {
+ int length = 1;
+ boolean result = fixture.canRead(length);
+
+ assertEquals(true, result);
+ }
+
+ /**
+ * Run the void clear() method test.
+ */
+ @Test
+ public void testClear() {
+ fixture.clear();
+ }
+
+ /**
+ * Run the ByteBuffer getByteBuffer() method test.
+ */
+ @Test
+ public void testGetByteBuffer() {
+ ByteBuffer result = fixture.getByteBuffer();
+
+ assertNotNull(result);
+ assertEquals("java.nio.DirectByteBuffer[pos=0 lim=1 cap=1]", result.toString());
+ assertEquals(true, result.isDirect());
+ assertEquals(false, result.hasArray());
+ assertEquals(1, result.limit());
+ assertEquals(1, result.remaining());
+ assertEquals(0, result.position());
+ assertEquals(1, result.capacity());
+ assertEquals(true, result.hasRemaining());
+ assertEquals(false, result.isReadOnly());
+ }
+
+ /**
+ * Run the ByteOrder getByteOrder() method test.
+ */
+ @Test
+ public void testGetByteOrder() {
+ ByteOrder result = fixture.getByteOrder();
+
+ assertNotNull(result);
+ assertEquals("BIG_ENDIAN", result.toString());
+ }
+
+ /**
+ * Run the ByteOrder order() method test.
+ */
+ @Test
+ public void testGetOrder() {
+ ByteOrder result = fixture.getByteOrder();
+
+ assertNotNull(result);
+ assertEquals("BIG_ENDIAN", result.toString());
+ }
+
+ /**
+ * Run the void order(ByteOrder) method test.
+ */
+ @Test
+ public void testSetOrder() {
+ ByteOrder order = ByteOrder.BIG_ENDIAN;
+
+ fixture.setByteOrder(order);
+ }
+
+ /**
+ * Run the int position() method test.
+ */
+ @Test
+ public void testGetPosition() {
+ long result = fixture.position();
+
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the void position(int) method test.
+ *
+ * @throws CTFException
+ * out of bounds? won't happen
+ */
+ @Test
+ public void testSetPosition() throws CTFException {
+ int newPosition = 1;
+ fixture.position(newPosition);
+ }
+
+ /**
+ * Run the void setByteOrder(ByteOrder) method test.
+ */
+ @Test
+ public void testSetByteOrder() {
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+ fixture.setByteOrder(byteOrder);
+ }
+
+ /**
+ * Test the get function
+ */
+ @Test
+ public void testGetBytes() {
+ @NonNull
+ byte[] data = new byte[2];
+ ByteBuffer bb = ByteBuffer.allocate(10);
+ bb.put((byte) 0);
+ bb.put((byte) 1);
+ bb.put((byte) 1);
+ bb.put((byte) 0);
+ fixture = new BitBuffer(bb);
+ fixture.get(data);
+ assertEquals(0, data[0]);
+ assertEquals(1, data[1]);
+ fixture.get(data);
+ assertEquals(1, data[0]);
+ assertEquals(0, data[1]);
+ }
+
+ /**
+ * Test the get function
+ *
+ * @throws CTFException
+ * won't happen but we seek in a buffer
+ */
+ @Test
+ public void testGetBytesMiddle() throws CTFException {
+ @NonNull
+ byte[] data = new byte[5];
+ // this string has been carefully selected and tested... don't change
+ // the string and expect the result to be the same.
+ fixture = new BitBuffer(Util.testMemory(ByteBuffer.wrap(new String("hello world").getBytes())));
+ fixture.position(6 * 8);
+ fixture.get(data);
+ String actual = new String(data);
+ assertEquals("world", actual);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.io;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ BitBufferIntTest.class,
+ BitBufferTest.class
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.io;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * Helpers for the tests
+ *
+ * @author Matthew Khouzam
+ */
+public final class Util {
+
+ private Util() {
+ }
+
+ /**
+ * Wrapper to make sure the bytebuffer is not null
+ *
+ * @param buffer
+ * a potentially null byte buffer
+ * @return a non-null byte buffer or an illegal state exception
+ */
+ @NonNull
+ public static ByteBuffer testMemory(ByteBuffer buffer) {
+ if (buffer == null) {
+ throw new IllegalStateException("Failed to alloc");
+ }
+ return buffer;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.scope;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.junit.Test;
+
+/**
+ * Lexical test
+ *
+ * @author Matthew Khouzam
+ */
+public class LexicalScopeTest {
+
+ /**
+ * Root test
+ */
+ @Test
+ public void testRoot() {
+ ILexicalScope scope = ILexicalScope.ROOT;
+ assertNotNull(scope);
+ }
+
+ /**
+ * Test a more complex node
+ */
+ @Test
+ public void testComplexNode() {
+ ILexicalScope scope = ILexicalScope.STREAM_EVENT_CONTEXT;
+ assertEquals("context", scope.getName());
+ assertEquals("stream.event.context", scope.getPath());
+ }
+
+ /**
+ * Test that getChild returns the same items for event headers
+ */
+ @Test
+ public void testEventHeaders() {
+ ILexicalScope child = ILexicalScope.ROOT.getChild("event");
+ assertNotNull(child);
+ ILexicalScope scope2 = child.getChild("header");
+ ILexicalScope scope3 = ILexicalScope.ROOT.getChild("event.header");
+ assertEquals(ILexicalScope.EVENT_HEADER, scope2);
+ assertEquals(ILexicalScope.EVENT_HEADER, scope3);
+ // they should be the same
+ assert (ILexicalScope.EVENT_HEADER == scope2);
+
+ assertNotNull(scope2);
+ ILexicalScope id = scope2.getChild("id");
+ assertNotNull(id);
+ assert (ILexicalScope.EVENT_HEADER_ID == id);
+ ILexicalScope ts = scope2.getChild("v.timestamp");
+ ILexicalScope v = scope2.getChild("v");
+ assert (ILexicalScope.EVENT_HEADER_V_TIMESTAMP == ts);
+ assert (ILexicalScope.EVENT_HEADER_V == v);
+ assertNotNull(v);
+ ILexicalScope ts2 = v.getChild("timestamp");
+ assert (ILexicalScope.EVENT_HEADER_V_TIMESTAMP == ts2);
+ assertNotNull(v);
+ id = v.getChild("id");
+ assert (ILexicalScope.EVENT_HEADER_V_ID == id);
+ assertNotNull(v);
+ ILexicalScope other = v.getChild("other");
+ assertNull(other);
+ }
+
+ /**
+ * Test that getChild returns the same items for event headers
+ */
+ @Test
+ public void testFields() {
+ ILexicalScope child = ILexicalScope.ROOT.getChild("fields");
+ assertNotNull(child);
+ ILexicalScope scope2 = child.getChild("_ret");
+ ILexicalScope scope3 = child.getChild("_tid");
+ ILexicalScope empty = child.getChild("other");
+
+ assertEquals(ILexicalScope.FIELDS_RET, scope2);
+ // they should be the same
+ assert (ILexicalScope.FIELDS_RET == scope2);
+
+ assertEquals(ILexicalScope.FIELDS_TID, scope3);
+ // they should be the same
+ assert (ILexicalScope.FIELDS_TID == scope2);
+
+ assertNull(empty);
+ }
+
+ /**
+ * Check contexts are not equals
+ */
+ @Test
+ public void testNotEquals() {
+ assertNotEquals(ILexicalScope.CONTEXT, ILexicalScope.EVENT);
+ LexicalScope context = new LexicalScope(ILexicalScope.CONTEXT, "context");
+ LexicalScope otherContext = new LexicalScope(ILexicalScope.CONTEXT, "context2");
+ assertNotEquals(context, otherContext);
+ assertNotEquals(context, null);
+ }
+
+ /**
+ * Test to strings
+ */
+ @Test
+ public void testGetPath() {
+ ILexicalScope child = ILexicalScope.ROOT.getChild("fields");
+ assertNotNull(child);
+ ILexicalScope scope2 = child.getChild("_ret");
+ assertNotNull(scope2);
+ assertEquals("fields._ret", scope2.getPath());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.scope;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ LexicalScopeTest.class
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle - Move generation to traces folder
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.synthetictraces;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin;
+
+/**
+ * Generate a kernel trace
+ *
+ * @author Matthew Khouzam
+ */
+public class LttngKernelTraceGenerator {
+
+ private static final String metadata = "/* CTF 1.8 */ \n" +
+ "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n" +
+ "typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n" +
+ "typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n" +
+ "typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n" +
+ "typealias integer { size = 32; align = 8; signed = false; } := unsigned long;\n" +
+ "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n" +
+ "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n" +
+ "\n" +
+ "trace {\n" +
+ " major = 1;\n" +
+ " minor = 8;\n" +
+ " uuid = \"11111111-1111-1111-1111-111111111111\";\n" +
+ " byte_order = le;\n" +
+ " packet.header := struct {\n" +
+ " uint32_t magic;\n" +
+ " uint8_t uuid[16];\n" +
+ " uint32_t stream_id;\n" +
+ " };\n" +
+ "};\n" +
+ "\n" +
+ "env {\n" +
+ " hostname = \"synthetic-host\";\n" +
+ " domain = \"kernel\";\n" +
+ " sysname = \"FakeLinux\";\n" +
+ " kernel_release = \"1.0\";\n" +
+ " kernel_version = \"Fake Os Synthetic Trace\";\n" +
+ " tracer_name = \"lttng-modules\";\n" +
+ " tracer_major = 2;\n" +
+ " tracer_minor = 1;\n" +
+ " tracer_patchlevel = 0;\n" +
+ "};\n" +
+ "\n" +
+ "clock {\n" +
+ " name = monotonic;\n" +
+ " uuid = \"bbff68f0-c633-4ea1-92cd-bd11024ec4de\";\n" +
+ " description = \"Monotonic Clock\";\n" +
+ " freq = 1000000000; /* Frequency, in Hz */\n" +
+ " /* clock value offset from Epoch is: offset * (1/freq) */\n" +
+ " offset = 1368000272650993664;\n" +
+ "};\n" +
+ "\n" +
+ "typealias integer {\n" +
+ " size = 27; align = 1; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ "} := uint27_clock_monotonic_t;\n" +
+ "\n" +
+ "typealias integer {\n" +
+ " size = 32; align = 8; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ "} := uint32_clock_monotonic_t;\n" +
+ "\n" +
+ "typealias integer {\n" +
+ " size = 64; align = 8; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ "} := uint64_clock_monotonic_t;\n" +
+ "\n" +
+ "struct packet_context {\n" +
+ " uint64_clock_monotonic_t timestamp_begin;\n" +
+ " uint64_clock_monotonic_t timestamp_end;\n" +
+ " uint64_t content_size;\n" +
+ " uint64_t packet_size;\n" +
+ " unsigned long events_discarded;\n" +
+ " uint32_t cpu_id;\n" +
+ "};\n" +
+ "\n" +
+ "struct event_header_compact {\n" +
+ " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n" +
+ " variant <id> {\n" +
+ " struct {\n" +
+ " uint27_clock_monotonic_t timestamp;\n" +
+ " } compact;\n" +
+ " struct {\n" +
+ " uint32_t id;\n" +
+ " uint64_clock_monotonic_t timestamp;\n" +
+ " } extended;\n" +
+ " } v;\n" +
+ "} align(8);\n" +
+ "\n" +
+ "struct event_header_large {\n" +
+ " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n" +
+ " variant <id> {\n" +
+ " struct {\n" +
+ " uint32_clock_monotonic_t timestamp;\n" +
+ " } compact;\n" +
+ " struct {\n" +
+ " uint32_t id;\n" +
+ " uint64_clock_monotonic_t timestamp;\n" +
+ " } extended;\n" +
+ " } v;\n" +
+ "} align(8);\n" +
+ "\n" +
+ "stream {\n" +
+ " id = 0;\n" +
+ " event.header := struct event_header_compact;\n" +
+ " packet.context := struct packet_context;\n" +
+ "};\n" +
+ "\n" +
+ "event {\n" +
+ " name = sched_switch;\n" +
+ " id = 0;\n" +
+ " stream_id = 0;\n" +
+ " fields := struct {\n" +
+ " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _prev_comm[16];\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid;\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio;\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_state;\n" +
+ " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _next_comm[16];\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid;\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio;\n" +
+ " };\n" +
+ "};\n" +
+ "\n";
+
+ private final List<String> fProcesses;
+ private final long fDuration;
+ private final long fNbEvents;
+ private final int fNbChans;
+
+ private static final String[] sfProcesses = {
+ "IDLE",
+ "gnuplot",
+ "starcraft 2:pt3",
+ "bash",
+ "smash",
+ "thrash",
+ "fireball",
+ "Half-life 3",
+ "ST: The game"
+ };
+
+
+ private static final String TRACES_DIRECTORY = "traces";
+ private static final String TRACE_NAME = "synthetic-trace";
+
+ /**
+ * Main, not always needed
+ *
+ * @param args
+ * args
+ */
+ public static void main(String[] args) {
+ // not using createTempFile as this is a directory
+ String path = CtfCoreTestPlugin.getTemporaryDirPath() + File.separator + TRACE_NAME;
+ generateLttngKernelTrace(new File(path));
+ }
+
+ /**
+ * Gets the name of the trace (top directory name)
+ *
+ * @return the name of the trace
+ */
+ public static String getName() {
+ return TRACE_NAME;
+ }
+
+ /**
+ * Get the path
+ *
+ * @return the path
+ */
+ public static String getPath() {
+ CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault();
+ if (plugin == null) {
+ return null;
+ }
+ URL location = FileLocator.find(plugin.getBundle(), new Path(TRACES_DIRECTORY), null);
+ File file = null;
+ try {
+ IPath path = new Path(FileLocator.toFileURL(location).getPath()).append(TRACE_NAME);
+ file = path.toFile();
+ } catch (IOException e) {
+ // Shouldn't happen but at least throw something to get the test to fail early
+ throw new IllegalStateException();
+ }
+
+ if (!file.exists()) {
+ generateLttngKernelTrace(file);
+ }
+ return file.getAbsolutePath();
+ }
+
+ /**
+ * Generate a trace
+ *
+ * @param file
+ * the file to write the trace to
+ */
+ public static void generateLttngKernelTrace(File file) {
+ final int cpus = 25;
+ LttngKernelTraceGenerator gt = new LttngKernelTraceGenerator(2l * Integer.MAX_VALUE - 100, 500000, cpus);
+ gt.writeTrace(file);
+ }
+
+ /**
+ * Make a kernel trace
+ *
+ * @param duration
+ * the duration of the trace
+ * @param events
+ * the number of events in a trace
+ * @param nbChannels
+ * the number of channels in the trace
+ */
+ public LttngKernelTraceGenerator(long duration, long events, int nbChannels) {
+ fProcesses = Arrays.asList(sfProcesses);
+ fDuration = duration;
+ fNbEvents = events;
+ fNbChans = nbChannels;
+ }
+
+ /**
+ * Write the trace to a file
+ *
+ * @param file
+ * the file to write the trace to
+ */
+ public void writeTrace(File file) {
+
+ if (!file.exists()) {
+ file.mkdir();
+ } else {
+ if (file.isFile()) {
+ file.delete();
+ file.mkdir();
+ } else {
+ // the ctf parser doesn't recurse, so we don't need to.
+ final File[] listFiles = file.listFiles();
+ for (File child : listFiles) {
+ child.delete();
+ }
+ }
+ }
+
+ File metadataFile = new File(file.getPath() + File.separator + "metadata");
+ File[] streams = new File[fNbChans];
+ FileChannel[] channels = new FileChannel[fNbChans];
+
+ try {
+ for (int i = 0; i < fNbChans; i++) {
+ streams[i] = new File(file.getPath() + File.separator + "channel" + i);
+ channels[i] = new FileOutputStream(streams[i]).getChannel();
+ }
+ } catch (FileNotFoundException e) {
+ }
+ // determine the number of events per channel
+ long evPerChan = fNbEvents / fNbChans;
+ long delta = (int) (fDuration / evPerChan);
+ long offsetTime = 0;
+ for (int chan = 0; chan < fNbChans; chan++) {
+ int currentSpace = 0;
+ ByteBuffer bb = ByteBuffer.allocate(65536);
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ Random rnd = new Random(1337);
+ int rnd0 = rnd.nextInt(fProcesses.size());
+ String prevComm = fProcesses.get(rnd0);
+ int prevPID = rnd0 + chan * fProcesses.size();
+ if (rnd0 == 0) {
+ prevPID = 0;
+ }
+ int prevPrio = 0;
+ int prevPos = -1;
+ for (int eventNb = 0; eventNb < evPerChan; eventNb++) {
+ long ts = eventNb * delta + delta / (fNbChans + 1) * chan;
+
+ int pos = rnd.nextInt((int) (fProcesses.size() * 1.5));
+ if (pos >= fProcesses.size()) {
+ pos = 0;
+ }
+ while (pos == prevPos) {
+ pos = rnd.nextInt((int) (fProcesses.size() * 1.5));
+ if (pos >= fProcesses.size()) {
+ pos = 0;
+ }
+ }
+ String nextComm = fProcesses.get(pos);
+ int nextPID = pos + fProcesses.size() * chan;
+ if (pos == 0) {
+ nextPID = 0;
+ }
+ int nextPrio = 0;
+ if (EventWriter.SIZE > currentSpace) {
+ // pad to end
+ for (int i = 0; i < currentSpace; i++) {
+ bb.put((byte) 0x00);
+ }
+ // write new packet
+ PacketWriter pw = new PacketWriter(bb);
+ long tsBegin = ts;
+ offsetTime = ts;
+ long tsEnd = (eventNb + (PacketWriter.SIZE / EventWriter.SIZE)) * delta + 1;
+ pw.writeNewHeader(tsBegin, tsEnd, chan);
+ currentSpace = PacketWriter.CONTENT_SIZE;
+ }
+ EventWriter ew = new EventWriter(bb);
+ int prev_state = rnd.nextInt(100);
+ if (prev_state != 0) {
+ prev_state = 1;
+ }
+ final long shrunkenTimestamp = ts - offsetTime;
+ final int tsMask = (1 << 27) - 1;
+ if (shrunkenTimestamp > ((1 << 27) + tsMask)) {
+ /* allow only one compact timestamp overflow per packet */
+ throw new IllegalStateException("Invalid timestamp overflow:" + shrunkenTimestamp);
+ }
+ final int clampedTs = (int) (ts & tsMask);
+ int evSize = ew.writeEvent(clampedTs, prevComm, prevPID, prevPrio, prev_state, nextComm, nextPID, nextPrio);
+ currentSpace -= evSize;
+ prevComm = nextComm;
+ prevPID = nextPID;
+ prevPrio = nextPrio;
+ if (bb.position() > 63000) {
+ writeToDisk(channels, chan, bb);
+ }
+ }
+ for (int i = 0; i < currentSpace; i++) {
+ bb.put((byte) 0x00);
+ }
+ writeToDisk(channels, chan, bb);
+ try {
+ channels[chan].close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try (FileOutputStream fos = new FileOutputStream(metadataFile);) {
+ fos.write(metadata.getBytes());
+ } catch (IOException e) {
+ }
+ }
+
+ private static void writeToDisk(FileChannel[] channels, int chan, ByteBuffer bb) {
+ try {
+ bb.flip();
+ channels[chan].write(bb);
+ bb.clear();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private class EventWriter {
+ public static final int SIZE =
+ 4 + // timestamp
+ 16 + // prev_comm
+ 4 + // prev_tid
+ 4 + // prev_prio
+ 4 + // prev_state
+ 16 + // current_comm
+ 4 + // next_tid
+ 4; // next_prio
+ private final ByteBuffer data;
+
+ public EventWriter(ByteBuffer bb) {
+ data = bb;
+ }
+
+ public int writeEvent(int ts, String prev_comm, int prev_tid, int prev_prio, int prev_state, String next_comm, int next_tid, int next_prio) {
+ byte[] bOut = new byte[16];
+ byte[] bIn = new byte[16];
+ byte[] temp = prev_comm.getBytes();
+ for (int i = 0; i < Math.min(temp.length, 16); i++) {
+ bOut[i] = temp[i];
+ }
+ temp = next_comm.getBytes();
+ for (int i = 0; i < Math.min(temp.length, 16); i++) {
+ bIn[i] = temp[i];
+ }
+
+ int timestamp = ts << 5;
+
+ data.putInt(timestamp);
+ data.put(bOut);
+ data.putInt(prev_tid);
+ data.putInt(prev_prio);
+ data.putInt(prev_state);
+ data.put(bIn);
+ data.putInt(next_tid);
+ data.putInt(next_prio);
+ return SIZE;
+ }
+
+ }
+
+ private class PacketWriter {
+ private static final int SIZE = 4096;
+ private static final int HEADER_SIZE = 64;
+ private static final int CONTENT_SIZE = SIZE - HEADER_SIZE;
+
+ private final ByteBuffer data;
+
+ public PacketWriter(ByteBuffer bb) {
+ data = bb;
+ }
+
+ public void writeNewHeader(long tsBegin, long tsEnd, int cpu) {
+ final int magicLE = 0xC1FC1FC1;
+ byte uuid[] = {
+ 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11,
+ 0x11, 0x11, 0x11, 0x11 };
+ // packet header
+
+ // magic number 4
+ data.putInt(magicLE);
+ // uuid 16
+ data.put(uuid);
+ // stream ID 4
+ data.putInt(0);
+
+ // packet context
+ // timestamp_begin 8
+ data.putLong(tsBegin);
+
+ // timestamp_end 8
+ data.putLong(tsEnd);
+
+ // content_size 8
+ data.putLong((CONTENT_SIZE / EventWriter.SIZE * EventWriter.SIZE + HEADER_SIZE) * 8);
+
+ // packet_size 8
+ data.putLong((SIZE) * 8);
+
+ // events_discarded 4
+ data.putInt(0);
+
+ // cpu_id 4
+ data.putInt(cpu);
+
+ }
+
+ }
+
+
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamInputPacketIndexEntryTest</code> contains tests for the
+ * class <code>{@link StreamInputPacketIndexEntry}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class CTFStreamInputPacketIndexEntryTest {
+
+ private ICTFPacketDescriptor fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new StreamInputPacketIndexEntry(1L, 1L);
+ }
+
+ /**
+ * Run the StreamInputPacketIndexEntry(long) constructor test.
+ */
+ @Test
+ public void testStreamInputPacketIndexEntry_1() {
+ String expectedResult = "StreamInputPacketIndexEntry [offsetBits=1, " +
+ "timestampBegin=" + Long.MIN_VALUE +
+ ", timestampEnd=" + Long.MAX_VALUE +
+ "]";
+
+ assertNotNull(fixture);
+ assertEquals(expectedResult, fixture.toString());
+ assertEquals(1, fixture.getOffsetBits());
+ assertEquals(0, fixture.getOffsetBytes());
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor1() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("load_factor", new FloatDeclaration(24, 8, ByteOrder.nativeOrder(), 8));
+ sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
+ sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(100);
+ bb.getByteBuffer().putInt(200);
+ bb.getByteBuffer().putFloat((float) .75);
+ bb.getByteBuffer().put(("Test").getBytes());
+ bb.getByteBuffer().put((byte) 0);
+ bb.getByteBuffer().put((byte) 0);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
+ assertNull(sipie.getTarget());
+ assertEquals(100, sipie.getTimestampBegin());
+ assertEquals(200, sipie.getTimestampEnd());
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor2() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
+ sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(100);
+ bb.getByteBuffer().putInt(200);
+ bb.getByteBuffer().putInt(128);
+ bb.getByteBuffer().put(("Test").getBytes());
+ bb.getByteBuffer().put((byte) 0);
+ bb.getByteBuffer().put((byte) 0);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
+ assertNull(sipie.getTarget());
+ assertEquals(100, sipie.getTimestampBegin());
+ assertEquals(200, sipie.getTimestampEnd());
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor3() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("packet_size", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
+ sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ sd.addField("intruder", new StructDeclaration(8));
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(100);
+ bb.getByteBuffer().putInt(200);
+ bb.getByteBuffer().putInt(128);
+ bb.getByteBuffer().put(("Test").getBytes());
+ bb.getByteBuffer().put((byte) 0);
+ bb.getByteBuffer().put((byte) 0);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
+ assertNull(sipie.getTarget());
+ assertEquals(100, sipie.getTimestampBegin());
+ assertEquals(200, sipie.getTimestampEnd());
+ assertTrue(sipie.includes(150));
+ assertFalse(sipie.includes(10));
+ assertFalse(sipie.includes(250));
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor4() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
+ sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(0);
+ bb.getByteBuffer().put(("Test").getBytes());
+ bb.getByteBuffer().put((byte) 0);
+ bb.getByteBuffer().put((byte) 0);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
+ assertNull(sipie.getTarget());
+ assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor5() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("device", StringDeclaration.getStringDeclaration(Encoding.ASCII));
+ sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(-1);
+ bb.getByteBuffer().putInt(0);
+ bb.getByteBuffer().put(("Test66").getBytes());
+ bb.getByteBuffer().put((byte) 0);
+ bb.getByteBuffer().put((byte) 0);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
+ assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
+ assertEquals("Test66", sipie.getTarget());
+ assertEquals(66, sipie.getTargetId());
+ }
+
+ /**
+ * Test the constructor
+ *
+ * @throws CTFException
+ * exception
+ */
+ @Test
+ public void testStreamInputPacketIndexEntryConstructor6() throws CTFException {
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("cpu_id", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("events_discarded", IntegerDeclaration.INT_32B_DECL);
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+ bb.getByteBuffer().putInt(-1);
+ bb.getByteBuffer().putInt(0);
+ bb.getByteBuffer().putInt(66);
+ bb.getByteBuffer().putInt(300);
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 100);
+ assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
+ assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
+ assertEquals("CPU66", sipie.getTarget());
+ assertEquals(66, sipie.getTargetId());
+ assertEquals(200, sipie.getLostEvents());
+ assertEquals(0, sipie.getOffsetBits());
+ assertEquals(1024, sipie.getPacketSizeBits());
+ }
+
+ /**
+ * Run the String toString() method test.
+ *
+ * @throws CTFException
+ * won't happen
+ */
+ @Test
+ public void testToString() throws CTFException {
+
+ String expectedResult = "StreamInputPacketIndexEntry [offsetBits=0, timestampBegin=0, timestampEnd=0]";
+ StructDeclaration sd = new StructDeclaration(8);
+ sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
+ sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
+ @SuppressWarnings("null")
+ BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
+
+ StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
+ assertEquals(expectedResult, new StreamInputPacketIndexEntry(0, sdef, 10000, 0).toString());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamInputPacketIndexTest</code> contains tests for the
+ * class <code>{@link StreamInputPacketIndex}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFStreamInputPacketIndexTest {
+
+ private StreamInputPacketIndex fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ fixture = new StreamInputPacketIndex();
+ fixture.append(new StreamInputPacketIndexEntry(1L,0L));
+ }
+
+ /**
+ * Run the StreamInputPacketIndex() constructor test.
+ */
+ @Test
+ public void testStreamInputPacketIndex() {
+ assertNotNull(fixture);
+ assertNotNull(fixture.getElement(0));
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFResponse;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamInputReaderTest</code> contains tests for the class
+ * <code>{@link CTFStreamInputReader}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFStreamInputReaderTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private CTFStreamInputReader fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ fixture = getStreamInputReader();
+ fixture.setName(1);
+ fixture.setCurrentEvent(new EventDefinition(new EventDeclaration(),
+ getStreamInputReader(), 0, null, null,
+ new StructDefinition(
+ new StructDeclaration(0),
+ null,
+ "packet",
+ new Definition[] { new StringDefinition(StringDeclaration.getStringDeclaration(Encoding.UTF8), null, "field", "test") }),
+ null)
+ );
+ }
+
+ private static CTFStreamInputReader getStreamInputReader() throws CTFException {
+ assumeTrue(testTrace.exists());
+ CTFTrace trace = testTrace.getTrace();
+ CTFStream s = trace.getStream((long) 0);
+ Set<CTFStreamInput> streamInput = s.getStreamInputs();
+ CTFStreamInputReader retVal = null;
+ for (CTFStreamInput si : streamInput) {
+ /*
+ * For the tests, we'll use the stream input corresponding to the
+ * CPU 0
+ */
+ if (si.getFilename().endsWith("0_0")) {
+ retVal = new CTFStreamInputReader(si);
+ break;
+ }
+ }
+ return retVal;
+ }
+
+ /**
+ * Run the StreamInputReader(StreamInput) constructor test, with a valid
+ * trace.
+ */
+ @Test
+ public void testStreamInputReader_valid() {
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Run the StreamInputReader(StreamInput) constructor test, with an invalid
+ * trace.
+ *
+ * @throws CTFException
+ * @throws IOException
+ */
+ @Test(expected = CTFException.class)
+ public void testStreamInputReader_invalid() throws CTFException, IOException {
+ CTFStreamInput streamInput = new CTFStreamInput(new CTFStream(new CTFTrace("")), new File(""));
+ try (CTFStreamInputReader result = new CTFStreamInputReader(streamInput)) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the int getCPU() method test.
+ */
+ @Test
+ public void testGetCPU() {
+ int result = fixture.getCPU();
+ assertEquals(0, result);
+ }
+
+ /**
+ * Run the EventDefinition getCurrentEvent() method test.
+ */
+ @Test
+ public void testGetCurrentEvent() {
+ EventDefinition result = fixture.getCurrentEvent();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StructDefinition getCurrentPacketContext() method test.
+ */
+ @Test
+ public void testGetCurrentPacketContext() {
+ ICompositeDefinition result = fixture.getCurrentEvent().getPacketContext();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the int getName() method test.
+ */
+ @Test
+ public void testGetName() {
+ int result = fixture.getName();
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the void goToLastEvent() method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGoToLastEvent1() throws CTFException {
+ final long endTimestamp = goToEnd();
+ final long endTime = 4287422460315L;
+ assertEquals(endTime, endTimestamp);
+ }
+
+ /**
+ * Run the void goToLastEvent() method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGoToLastEvent2() throws CTFException {
+ long timestamp = -1;
+ while (fixture.readNextEvent().equals(CTFResponse.OK)) {
+ timestamp = fixture.getCurrentEvent().getTimestamp();
+ }
+ long endTimestamp = goToEnd();
+ assertEquals(0, timestamp - endTimestamp);
+ }
+
+ private long goToEnd() throws CTFException {
+ fixture.goToLastEvent();
+ return fixture.getCurrentEvent().getTimestamp();
+ }
+
+ /**
+ * Run the boolean readNextEvent() method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testReadNextEvent() throws CTFException {
+ assertEquals(CTFResponse.OK, fixture.readNextEvent());
+ }
+
+ /**
+ * Run the void seek(long) method test. Seek by direct timestamp
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testSeek_timestamp() throws CTFException {
+ long timestamp = 1L;
+ fixture.seek(timestamp);
+ }
+
+ /**
+ * Run the seek test. Seek by passing an EventDefinition to which we've
+ * given the timestamp we want.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testSeek_eventDefinition() throws CTFException {
+ EventDefinition eventDefinition = new EventDefinition(
+ new EventDeclaration(), getStreamInputReader(), 1L, null, null, null, null);
+ fixture.setCurrentEvent(eventDefinition);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputReaderTimestampComparator;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamInputReaderTimestampComparatorTest</code> contains
+ * tests for the class <code>{@link StreamInputReaderTimestampComparator}</code>
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class CTFStreamInputReaderTimestampComparatorTest {
+
+ private StreamInputReaderTimestampComparator fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new StreamInputReaderTimestampComparator();
+ }
+
+ /**
+ * Run the StreamInputReaderTimestampComparator() constructor test.
+ */
+ @Test
+ public void testStreamInputReaderTimestampComparator_1() {
+ assertNotNull(fixture);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamInputTest</code> contains tests for the class
+ * <code>{@link CTFStreamInput}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFStreamInputTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private CTFStreamInput fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ assumeTrue(testTrace.exists());
+ fixture = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile());
+ fixture.setTimestampEnd(1L);
+ }
+
+ @NonNull
+ private static File createFile() {
+ File path = new File(testTrace.getPath());
+ final File[] listFiles = path.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.contains("hann")) {
+ return true;
+ }
+ return false;
+ }
+ });
+ assertNotNull(listFiles);
+ final File returnFile = listFiles[0];
+ assertNotNull(returnFile);
+ return returnFile;
+ }
+
+ /**
+ * Run the StreamInput(Stream,FileChannel,File) constructor test.
+ */
+ @Test
+ public void testStreamInput() {
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Run the String getFilename() method test.
+ */
+ @Test
+ public void testGetFilename() {
+ String result = fixture.getFilename();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getPath() method test.
+ */
+ @Test
+ public void testGetPath() {
+ String result = fixture.getScopePath().getPath();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Stream getStream() method test.
+ */
+ @Test
+ public void testGetStream() {
+ CTFStream result = fixture.getStream();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getTimestampEnd() method test.
+ */
+ @Test
+ public void testGetTimestampEnd() {
+ long result = fixture.getTimestampEnd();
+ assertTrue(0L < result);
+ }
+
+ /**
+ * Run the Definition lookupDefinition(String) method test.
+ */
+ @Test
+ public void testLookupDefinition() {
+ IDefinition result = fixture.lookupDefinition("id");
+ assertNull(result);
+ }
+
+ /**
+ * Run the void setTimestampEnd(long) method test.
+ */
+ @Test
+ public void testSetTimestampEnd() {
+ fixture.setTimestampEnd(1L);
+ assertEquals(fixture.getTimestampEnd(), 1L);
+ }
+
+ CTFStreamInput s1;
+ CTFStreamInput s2;
+
+ @Test
+ public void testEquals1() throws CTFException {
+ s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
+ createFile());
+ assertFalse(s1.equals(null));
+ }
+
+ @Test
+ public void testEquals2() throws CTFException {
+ s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
+ createFile());
+ assertFalse(s1.equals(new Long(23L)));
+
+ }
+
+ @Test
+ public void testEquals3() throws CTFException {
+ s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
+ createFile());
+ assertEquals(s1, s1);
+
+ }
+
+ @Test
+ public void testEquals4() throws CTFException {
+ s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
+ createFile());
+ s2 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
+ createFile());
+ assertEquals(s1, s2);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * The class <code>StreamTest</code> contains tests for the class
+ * <code>{@link CTFStream}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFStreamTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private CTFStream fixture;
+
+ private CTFStreamInput fInput;
+
+ @BeforeClass
+ public static void initialize() {
+ assumeTrue(testTrace.exists());
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ fixture = new CTFStream(testTrace.getTrace());
+ fixture.setEventContext(new StructDeclaration(1L));
+ fixture.setPacketContext(new StructDeclaration(1L));
+ fixture.setEventHeader(new StructDeclaration(1L));
+ fixture.setId(1L);
+ fInput = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile());
+ fixture.addInput(fInput);
+ }
+
+ @NonNull
+ private static File createFile() {
+ File path = new File(testTrace.getPath());
+ final File[] listFiles = path.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.contains("hann")) {
+ return true;
+ }
+ return false;
+ }
+ });
+ assertNotNull(listFiles);
+ final File returnFile = listFiles[0];
+ assertNotNull(returnFile);
+ return returnFile;
+ }
+
+ /**
+ * Run the Stream(CTFTrace) constructor test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testStream() throws CTFException {
+ CTFTrace trace = testTrace.getTrace();
+ CTFStream result = new CTFStream(trace);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the void addEvent(EventDeclaration) method test with the basic event.
+ *
+ * @throws ParseException
+ */
+ @Test
+ public void testAddEvent_base() throws ParseException {
+ EventDeclaration event = new EventDeclaration();
+ fixture.addEvent(event);
+ }
+
+ /**
+ * Run the boolean eventContextIsSet() method test.
+ */
+ @Test
+ public void testEventContextIsSet() {
+ assertTrue(fixture.isEventContextSet());
+ }
+
+ /**
+ * Run the boolean eventContextIsSet() method test.
+ */
+ @Test
+ public void testToString() {
+ assertNotNull(fixture.toString());
+ }
+
+ /**
+ * Run the boolean eventHeaderIsSet() method test.
+ */
+ @Test
+ public void testEventHeaderIsSet() {
+ assertTrue(fixture.isEventHeaderSet());
+ }
+
+ /**
+ * Run the StructDeclaration getEventContextDecl() method test.
+ */
+ @Test
+ public void testGetEventContextDecl() {
+ assertNotNull(fixture.getEventContextDecl());
+ }
+
+ /**
+ * Run the StructDeclaration getEventHeaderDecl() method test.
+ */
+ @Test
+ public void testGetEventHeaderDecl() {
+ IDeclaration eventHeaderDecl = fixture.getEventHeaderDeclaration();
+ assertNotNull(eventHeaderDecl);
+ }
+
+ /**
+ * Run the HashMap<Long, EventDeclaration> getEvents() method test.
+ */
+ @Test
+ public void testGetEvents() {
+ assertNotNull(fixture.getEventDeclarations());
+ }
+
+ /**
+ * Run the Long getId() method test.
+ */
+ @Test
+ public void testGetId() {
+ Long result = fixture.getId();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StructDeclaration getPacketContextDecl() method test.
+ */
+ @Test
+ public void testGetPacketContextDecl() {
+ StructDeclaration result = fixture.getPacketContextDecl();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Set<StreamInput> getStreamInputs() method test.
+ */
+ @Test
+ public void testGetStreamInputs() {
+ Set<CTFStreamInput> result = fixture.getStreamInputs();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the CTFTrace getTrace() method test.
+ */
+ @Test
+ public void testGetTrace() {
+ CTFTrace result = fixture.getTrace();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the boolean idIsSet() method test.
+ */
+ @Test
+ public void testIdIsSet() {
+ boolean result = fixture.isIdSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean packetContextIsSet() method test.
+ */
+ @Test
+ public void testPacketContextIsSet() {
+ boolean result = fixture.isPacketContextSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the void setEventContext(StructDeclaration) method test.
+ */
+ @Test
+ public void testSetEventContext() {
+ StructDeclaration eventContext = new StructDeclaration(1L);
+ fixture.setEventContext(eventContext);
+ }
+
+ /**
+ * Run the void setEventHeader(StructDeclaration) method test.
+ */
+ @Test
+ public void testSetEventHeader() {
+ StructDeclaration eventHeader = new StructDeclaration(1L);
+ fixture.setEventHeader(eventHeader);
+ }
+
+ /**
+ * Run the void setId(long) method test.
+ */
+ @Test
+ public void testSetId() {
+ long id = 1L;
+ fixture.setId(id);
+ }
+
+ /**
+ * Run the void setPacketContext(StructDeclaration) method test.
+ */
+ @Test
+ public void testSetPacketContext() {
+ StructDeclaration packetContext = new StructDeclaration(1L);
+ fixture.setPacketContext(packetContext);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.attribute.FileAttribute;
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests growing streams
+ *
+ * @author Matthew Khouzam
+ *
+ */
+public class CTFTraceGrowingStreamTest {
+
+ private Path fCtfDirectory;
+ private File fGrowingStream;
+ private byte[][] fPackets;
+ private CTFTrace fFixture;
+ private UUID fUUID;
+
+ /**
+ * Run before every test
+ *
+ * @throws IOException won't happen
+ * @throws CTFException won't happen
+ */
+ @Before
+ public void init() throws IOException, CTFException {
+ fCtfDirectory = Files.createTempDirectory("temptrace", new FileAttribute<?>[] {});
+ File metadata = new File(fCtfDirectory.toString() + "/" + "metadata");
+ fGrowingStream = new File(fCtfDirectory.toString() + "/" + "stream");
+ fUUID = UUID.randomUUID();
+ fPackets = new byte[2][];
+ fPackets[0] = new byte[32];
+ fPackets[1] = new byte[32];
+ try (PrintWriter pw = new PrintWriter(metadata)) {
+ pw.println("/*CTF 1.8*/");
+ pw.println("typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;");
+ pw.println("typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;");
+
+ pw.println("trace {");
+ pw.println(" major = 0;");
+ pw.println(" minor = 1;");
+ pw.println(" uuid = \"" + fUUID.toString() + "\";");
+ pw.println(" byte_order = le;");
+ pw.println(" packet.header := struct {");
+ pw.println(" uint32_t magic;");
+ pw.println(" uint8_t uuid[16];");
+ pw.println(" };");
+ pw.println("};");
+ pw.println("");
+ pw.println("stream {");
+ pw.println(" packet.context := struct {");
+ pw.println(" uint32_t packet_size;");
+ pw.println(" uint32_t content_size;");
+ pw.println(" };");
+ pw.println("};");
+ pw.println("");
+ pw.println("event {");
+ pw.println(" name = thing;");
+ pw.println(" fields := struct { uint32_t f; };");
+ pw.println("};");
+ pw.println("");
+ pw.close();
+ }
+ setupPacket(fPackets[0], 41);
+ setupPacket(fPackets[1], 0xbab4face);
+
+ try (FileOutputStream fos = new FileOutputStream(fGrowingStream)) {
+ fos.write(fPackets[0]);
+ }
+ fFixture = new CTFTrace(fCtfDirectory.toString());
+ }
+
+ private void setupPacket(byte data[], int value) {
+ ByteBuffer bb = ByteBuffer.wrap(data);
+ bb.clear();
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ bb.putInt(0xc1fc1fc1);
+ bb.order(ByteOrder.BIG_ENDIAN);
+ bb.putLong(fUUID.getMostSignificantBits());
+ bb.putLong(fUUID.getLeastSignificantBits());
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ bb.putInt(256);
+ bb.putInt(256);
+ bb.putInt(value);
+ }
+
+ /**
+ * Test a growing stream
+ *
+ * @throws CTFException won't happen
+ * @throws IOException won't happen
+ * @throws FileNotFoundException won't happen
+ */
+ @Test
+ public void testGrowingLive() throws CTFException, FileNotFoundException, IOException {
+ try (CTFTraceReader reader = new CTFTraceReader(fFixture);) {
+ reader.setLive(true);
+ assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
+ reader.advance();
+ try (FileOutputStream fos = new FileOutputStream(fGrowingStream, true)) {
+ fos.write(fPackets[1]);
+ }
+ reader.advance();
+ assertNotNull(reader.getCurrentEventDef());
+ assertEquals("0xbab4face", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
+ }
+ }
+
+ /**
+ * Test a growing stream
+ *
+ * @throws CTFException won't happen
+ * @throws IOException won't happen
+ * @throws FileNotFoundException won't happen
+ */
+ @Test
+ public void testGrowingNotLive() throws CTFException, FileNotFoundException, IOException {
+ try (CTFTraceReader reader = new CTFTraceReader(fFixture);) {
+ reader.setLive(false);
+ assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
+ reader.advance();
+ try (FileOutputStream fos = new FileOutputStream(fGrowingStream, true)) {
+ fos.write(fPackets[1]);
+ }
+ reader.advance();
+ assertNull(reader.getCurrentEventDef());
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.eclipse.tracecompass.ctf.core.trace.Metadata;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for streaming support
+ *
+ * @author Matthew Khouzam
+ *
+ */
+public class CTFTraceGrowingTest {
+ final private String fPathName = CtfTestTrace.SYNTHETIC_TRACE.getPath();
+
+ final private CTFTrace fixture = new CTFTrace();
+
+ /**
+ * Init
+ *
+ * @throws IOException
+ * an IO error
+ * @throws FileNotFoundException
+ * file's not there
+ * @throws CTFException
+ * error in metadata
+ */
+ @Before
+ public void init() throws FileNotFoundException, IOException, CTFException {
+ Metadata md = new Metadata(fixture);
+ File metadata = new File(fPathName + "/" + "metadata");
+
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(metadata)))) {
+
+ StringBuilder sb = new StringBuilder();
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ }
+ String result = sb.toString();
+ md.parseText(result);
+ }
+ }
+
+ /**
+ * Empty trace test
+ *
+ * @throws CTFException
+ * will not happen
+ */
+ @Test
+ public void testEmptyStream() throws CTFException {
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ assertNull(reader.getCurrentEventDef());
+ }
+ }
+
+ /**
+ * Add a stream
+ *
+ * @throws CTFException
+ * should not happen
+ */
+ @Test
+ public void testAddStream() throws CTFException {
+ File stream = new File(fPathName + "/" + "channel1");
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ fixture.addStreamFile(stream);
+ reader.update();
+ assertTrue(reader.advance());
+ assertNotNull(reader.getCurrentEventDef());
+ }
+ }
+
+ /**
+ * Adds two a stream
+ *
+ * @throws CTFException
+ * should not happen
+ */
+ @Test
+ public void testAddTwoStreams1() throws CTFException {
+ File stream = new File(fPathName + "/" + "channel1");
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ fixture.addStreamFile(stream);
+ stream = new File(fPathName + "/" + "channel2");
+ fixture.addStreamFile(stream);
+ reader.update();
+ assertTrue(reader.advance());
+ EventDefinition currentEventDef = reader.getCurrentEventDef();
+ assertNotNull(reader.getCurrentEventDef());
+ assertEquals(16518l, currentEventDef.getTimestamp());
+ }
+ }
+
+ /**
+ * Adds two a stream
+ *
+ * @throws CTFException
+ * should not happen
+ */
+ @Test
+ public void testAddTwoStreams2() throws CTFException {
+ File stream = new File(fPathName + "/" + "channel1");
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ fixture.addStreamFile(stream);
+ stream = new File(fPathName + "/" + "channel2");
+ reader.update();
+ assertTrue(reader.advance());
+ fixture.addStreamFile(stream);
+ reader.update();
+ assertTrue(reader.advance());
+ EventDefinition currentEventDef = reader.getCurrentEventDef();
+ assertNotNull(currentEventDef);
+ assertEquals(223007L, currentEventDef.getTimestamp());
+ }
+ }
+
+ /**
+ * Tests that update does not change the position
+ *
+ * @throws CTFException
+ * should not happen
+ */
+ @Test
+ public void testAddTwoStreams3() throws CTFException {
+ File stream = new File(fPathName + "/" + "channel1");
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ fixture.addStreamFile(stream);
+ stream = new File(fPathName + "/" + "channel2");
+ reader.update();
+ reader.update();
+ reader.update();
+ assertTrue(reader.advance());
+ fixture.addStreamFile(stream);
+ reader.update();
+ reader.update();
+ reader.update();
+ reader.update();
+ assertTrue(reader.advance());
+ EventDefinition currentEventDef = reader.getCurrentEventDef();
+ assertNotNull(currentEventDef);
+ assertEquals(223007L, currentEventDef.getTimestamp());
+ }
+ }
+
+ /**
+ * Test adding a bad stream
+ *
+ * @throws CTFException
+ * should happen
+ */
+ @Test(expected = CTFException.class)
+ public void testAddStreamFail() throws CTFException {
+ File stream = new File(fPathName + "/" + "metadata");
+ try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
+ fixture.addStreamFile(stream);
+ assertNull(reader.getCurrentEventDef());
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CTFTraceReaderTest</code> contains tests for the class
+ * <code>{@link CTFTraceReader}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class CTFTraceReaderTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private CTFTraceReader fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ assumeTrue(testTrace.exists());
+ fixture = new CTFTraceReader(testTrace.getTrace());
+ }
+
+ /**
+ * Run the CTFTraceReader(CTFTrace) constructor test. Open a known good
+ * trace.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testOpen_existing() throws CTFException {
+ CTFTrace trace = testTrace.getTrace();
+ try (CTFTraceReader result = new CTFTraceReader(trace);) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the CTFTraceReader(CTFTrace) constructor test. Open a non-existing
+ * trace, expect the exception.
+ *
+ * @throws CTFException
+ */
+ @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
+ public void testOpen_nonexisting() throws CTFException {
+ CTFTrace trace = new CTFTrace("badfile.bad");
+ try (CTFTraceReader result = new CTFTraceReader(trace);) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the CTFTraceReader(CTFTrace) constructor test. Try to pen an invalid
+ * path, expect exception.
+ *
+ * @throws CTFException
+ */
+ @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
+ public void testOpen_invalid() throws CTFException {
+ CTFTrace trace = new CTFTrace("");
+ try (CTFTraceReader result = new CTFTraceReader(trace);) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the boolean advance() method test. Test advancing normally.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testAdvance_normal() throws CTFException {
+ boolean result = fixture.advance();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean advance() method test. Test advancing when we're at the
+ * end, so we expect that there is no more events.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testAdvance_end() throws CTFException {
+ int i = 0;
+ boolean result = fixture.advance();
+ while (result) {
+ result = fixture.advance();
+ i++;
+ }
+ fixture.seek(0);
+ fixture.advance();
+ fixture.goToLastEvent();
+ i = 1;
+ result = fixture.advance();
+ while (result) {
+ result = fixture.advance();
+ i++;
+ }
+ assertFalse(result);
+ assertEquals(i, 1);
+ }
+
+ /**
+ * Run the CTFTraceReader copy constructor test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testCopyFrom() throws CTFException {
+ try (CTFTraceReader result = fixture.copyFrom();) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Test the hashCode method.
+ */
+ @Test
+ public void testHash() {
+ int result = fixture.hashCode();
+ assertTrue(0 != result);
+ }
+
+ /**
+ * Test the equals method. Uses the class-wide 'fixture' and another
+ * method-local 'fixture2', which both point to the same trace.
+ *
+ * Both trace reader are different objects, so they shouldn't "equals" each
+ * other.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testEquals() throws CTFException {
+ try (CTFTraceReader fixture2 = new CTFTraceReader(testTrace.getTrace());) {
+ assertEquals(fixture, fixture2);
+ }
+ }
+
+ /**
+ * Run the getCurrentEventDef() method test. Get the first event's
+ * definition.
+ */
+ @Test
+ public void testGetCurrentEventDef_first() {
+ EventDefinition result = fixture.getCurrentEventDef();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the getCurrentEventDef() method test. Get the last event's
+ * definition.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGetCurrentEventDef_last() throws CTFException {
+ fixture.goToLastEvent();
+ EventDefinition result = fixture.getCurrentEventDef();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getEndTime() method test.
+ */
+ @Test
+ public void testGetEndTime() {
+ long result = fixture.getEndTime();
+ assertTrue(0L < result);
+ }
+
+ /**
+ * Run the long getStartTime() method test.
+ */
+ @Test
+ public void testGetStartTime() {
+ long result = fixture.getStartTime();
+ assertTrue(0L < result);
+ }
+
+ /**
+ * Run the void goToLastEvent() method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testGoToLastEvent() throws CTFException {
+ fixture.goToLastEvent();
+ long ts1 = getTimestamp();
+ long ts2 = fixture.getEndTime();
+ assertEquals(ts1, ts2);
+ }
+
+ /**
+ * Run the boolean hasMoreEvents() method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testHasMoreEvents() {
+ boolean result = fixture.hasMoreEvents();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the void printStats() method test with no 'width' parameter.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_noparam() throws CTFException {
+ fixture.advance();
+ fixture.printStats();
+ }
+
+ /**
+ * Run the void printStats(int) method test with width = 0.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_width0() throws CTFException {
+ fixture.advance();
+ fixture.printStats(0);
+ }
+
+ /**
+ * Run the void printStats(int) method test with width = 1.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_width1() throws CTFException {
+ fixture.advance();
+ fixture.printStats(1);
+ }
+
+ /**
+ * Run the void printStats(int) method test with width = 2.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_width2() throws CTFException {
+ fixture.advance();
+ fixture.printStats(2);
+ }
+
+ /**
+ * Run the void printStats(int) method test with width = 10.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_width10() throws CTFException {
+ fixture.advance();
+ fixture.printStats(10);
+ }
+
+ /**
+ * Run the void printStats(int) method test with width = 100.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testPrintStats_100() throws CTFException {
+ for (int i = 0; i < 1000; i++) {
+ fixture.advance();
+ }
+ fixture.printStats(100);
+ }
+
+ /**
+ * Run the boolean seek(long) method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testSeek() throws CTFException {
+ long timestamp = 1L;
+ boolean result = fixture.seek(timestamp);
+ assertTrue(result);
+ }
+
+ /**
+ * @return
+ */
+ private long getTimestamp() {
+ if (fixture.getCurrentEventDef() != null) {
+ return fixture.getTrace().timestampCyclesToNanos(fixture.getCurrentEventDef().getTimestamp());
+ }
+ return -1;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle - Test in traces directory recursively
+ * Simon Delisle - Add test for getCallsite(eventName, ip)
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.nio.ByteOrder;
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.CTFClock;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CTFTraceTest</code> contains tests for the class
+ * <code>{@link CTFTrace}</code>.
+ *
+ * @author ematkho
+ */
+public class CTFTraceTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private CTFTrace fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ assumeTrue(testTrace.exists());
+ try {
+ fixture = testTrace.getTraceFromFile();
+ } catch (CTFException e) {
+ /* If the assumeTrue() call passed, this should not happen. */
+ fail();
+ }
+ fixture.setMinor(1L);
+ fixture.setUUID(UUID.randomUUID());
+ fixture.setPacketHeader(new StructDeclaration(1L));
+ fixture.setMajor(1L);
+ fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
+ }
+
+ /**
+ * Run the CTFTrace(File) constructor test with a known existing trace.
+ */
+ @Test
+ public void testOpen_existing() {
+ try {
+ CTFTrace result = testTrace.getTraceFromFile();
+ assertNotNull(result.getUUID());
+ } catch (CTFException e) {
+ fail();
+ }
+ }
+
+ /**
+ * Run the CTFTrace(File) constructor test with an invalid path.
+ *
+ * @throws CTFException
+ * is expected
+ */
+ @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
+ public void testOpen_invalid() throws CTFException {
+ File path = new File("");
+ CTFTrace result = new CTFTrace(path);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the boolean UUIDIsSet() method test.
+ */
+ @Test
+ public void testUUIDIsSet() {
+ boolean result = fixture.uuidIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the void addStream(Stream) method test.
+ */
+ @Test
+ public void testAddStream() {
+ // test number of streams
+ int nbStreams = fixture.nbStreams();
+ assertEquals(1, nbStreams);
+
+ // Add a stream
+ try {
+ CTFStream stream = new CTFStream(testTrace.getTrace());
+ stream.setId(1234);
+ fixture.addStream(stream);
+ } catch (CTFException e) {
+ fail();
+ } catch (ParseException e) {
+ fail();
+ }
+
+ // test number of streams
+ nbStreams = fixture.nbStreams();
+ assertEquals(2, nbStreams);
+ }
+
+ /**
+ * Run the boolean byteOrderIsSet() method test.
+ */
+ @Test
+ public void testByteOrderIsSet() {
+ boolean result = fixture.byteOrderIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the ByteOrder getByteOrder() method test.
+ */
+ @Test
+ public void testGetByteOrder_1() {
+ ByteOrder result = fixture.getByteOrder();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getMajor() method test.
+ */
+ @Test
+ public void testGetMajor() {
+ long result = fixture.getMajor();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the long getMinor() method test.
+ */
+ @Test
+ public void testGetMinor() {
+ long result = fixture.getMinor();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the StructDeclaration getPacketHeader() method test.
+ */
+ @Test
+ public void testGetPacketHeader() {
+ StructDeclaration result = fixture.getPacketHeader();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getPath() method test.
+ */
+ @Test
+ public void testGetPath() {
+ String result = fixture.getPath();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Stream getStream(Long) method test.
+ */
+ @Test
+ public void testGetStream() {
+ Long id = new Long(0L);
+ CTFStream result = fixture.getStream(id);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the File getTraceDirectory() method test.
+ */
+ @Test
+ public void testGetTraceDirectory() {
+ File result = fixture.getTraceDirectory();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the UUID getUUID() method test.
+ */
+ @Test
+ public void testGetUUID() {
+ UUID result = fixture.getUUID();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Definition lookupDefinition(String) method test.
+ */
+ @Test
+ public void testLookupDefinition() {
+ String lookupPath = "trace.packet.header";
+ IDefinition result = fixture.lookupDefinition(lookupPath);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the boolean majorIsSet() method test.
+ */
+ @Test
+ public void testMajorIsSet() {
+ boolean result = fixture.majorIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean minorIsSet() method test.
+ */
+ @Test
+ public void testMinorIsSet() {
+ boolean result = fixture.minorIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean packetHeaderIsSet() method test with a valid header set.
+ */
+ @Test
+ public void testPacketHeaderIsSet_valid() {
+ boolean result = fixture.packetHeaderIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean packetHeaderIsSet() method test, without having a valid
+ * header set.
+ */
+ @Test
+ public void testPacketHeaderIsSet_invalid() {
+ try {
+ CTFTrace fixture2 = testTrace.getTraceFromFile();
+ fixture2.setMinor(1L);
+ fixture2.setUUID(UUID.randomUUID());
+ /*
+ * it's null here!
+ */
+ fixture2.setPacketHeader((StructDeclaration) null);
+ fixture2.setMajor(1L);
+ fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
+
+ boolean result = fixture2.packetHeaderIsSet();
+ assertFalse(result);
+ } catch (CTFException e) {
+ fail();
+ }
+ }
+
+ /**
+ * Run the void setByteOrder(ByteOrder) method test.
+ */
+ @Test
+ public void testSetByteOrder() {
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+ fixture.setByteOrder(byteOrder);
+ }
+
+ /**
+ * Run the void setMajor(long) method test.
+ */
+ @Test
+ public void testSetMajor() {
+ long major = 1L;
+ fixture.setMajor(major);
+ }
+
+ /**
+ * Run the void setMinor(long) method test.
+ */
+ @Test
+ public void testSetMinor() {
+ long minor = 1L;
+ fixture.setMinor(minor);
+ }
+
+ /**
+ * Run the void setPacketHeader(StructDeclaration) method test.
+ */
+ @Test
+ public void testSetPacketHeader() {
+ StructDeclaration packetHeader = new StructDeclaration(1L);
+ fixture.setPacketHeader(packetHeader);
+ }
+
+ /**
+ * Run the void setUUID(UUID) method test.
+ */
+ @Test
+ public void testSetUUID() {
+ UUID uuid = UUID.randomUUID();
+ fixture.setUUID(uuid);
+ }
+
+ /**
+ * Run the CTFClock getClock/setClock method test.
+ */
+ @Test
+ public void testGetSetClock_1() {
+ String name = "clockyClock";
+ fixture.addClock(name, new CTFClock());
+ CTFClock result = fixture.getClock(name);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the CTFClock getClock/setClock method test.
+ */
+ @Test
+ public void testGetSetClock_2() {
+ String name = "";
+ CTFClock ctfClock = new CTFClock();
+ ctfClock.addAttribute("name", "Bob");
+ ctfClock.addAttribute("pi", new Double(java.lang.Math.PI));
+ fixture.addClock(name, ctfClock);
+ CTFClock result = fixture.getClock(name);
+
+ assertNotNull(result);
+ assertTrue((Double) ctfClock.getProperty("pi") > 3.0);
+ assertTrue(ctfClock.getName().equals("Bob"));
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_1() {
+ String key = "";
+ String result = fixture.getEnvironment().get(key);
+ assertNull(result);
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_2() {
+ String key = "otherTest";
+ String result = fixture.getEnvironment().get(key);
+ assertNull(result);
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_3() {
+ String key = "test";
+ fixture.addEnvironmentVar(key, key);
+ String result = fixture.getEnvironment().get(key);
+ assertTrue(result.equals(key));
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_4() {
+ String key = "test";
+ fixture.addEnvironmentVar(key, "bozo");
+ fixture.addEnvironmentVar(key, "the clown");
+ String result = fixture.getEnvironment().get(key);
+ assertNotNull(result);
+ }
+
+ /**
+ * Test for getCallsite(eventName, ip)
+ *
+ * @throws CTFException
+ * not expected
+ */
+ @Test
+ public void callsitePosition() throws CTFException {
+ long ip1 = 2;
+ long ip2 = 5;
+ long ip3 = 7;
+ CTFTrace callsiteTest = testTrace.getTraceFromFile();
+ callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
+ callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
+ callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
+
+ assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
+ assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
+ assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
+ assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
+ assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.net.URISyntaxException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceWriter;
+import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * CTFTraceWriter test cases
+ *
+ * @author Bernd Hufmann
+ *
+ */
+@SuppressWarnings("javadoc")
+@RunWith(Parameterized.class)
+public class CTFTraceWriterTest {
+
+ private static File fTempDir;
+
+ // Trace details
+ private static final long CLOCK_OFFSET = 1332166405241713987L;
+ private static final int TOTAL_NB_EVENTS = 695319;
+ private static final long LAST_EVENT_TIME = 1332170692664579801L;
+
+ // Stream 0 values
+ private static final long STREAM0_FIRST_PACKET_TIME = CLOCK_OFFSET + 4277170993912L;
+ private static final long STREAM0_FIRST_EVENT_TIME = 1332170682440316151L;
+ private static final long STREAM0_LAST_EVENT_TIME = 1332170682702066969L;
+ private static final int STREAM0_FIRST_PACKET_NB_EVENTS = 14219;
+
+ // Stream 1 values
+ private static final long STREAM1_FIRST_PACKET_TIME = CLOCK_OFFSET + 4277171555436L;
+ private static final int STREAM1_FIRST_PACKET_NB_EVENTS = 8213;
+ private static final long STREAM1_FIRST_EVENT_TIME = 1332170682440133097L;
+ private static final long STREAM1_FIFTH_PACKET_TIME = CLOCK_OFFSET + 4277970712221L;
+ private static final long STREAM1_TENTH_PACKET_TIME = CLOCK_OFFSET + 4279440048309L;
+ private static final long STREAM1_FIFTH_PACKET_FIRST_EVENT_TIME = 1332170683212426208L;
+ private static final long STREAM1_TENTH_PACKET_LAST_EVENT_TIME = 1332170685256508077L;
+
+ // Miscellaneous
+ private static final int NB_EVENTS_SEVERAL_PACKETS = 138894;
+
+ // Test parameters
+ private String fName;
+ private long fStartTime;
+ private long fEndTime;
+ private int fNbEvents;
+ private long fFirstEventTime;
+ private long fLastEventTime;
+
+ /**
+ * Gets a list of test case parameters.
+ *
+ * @return The list of test parameters
+ */
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> getTestParams() {
+ final List<Object[]> params = new LinkedList<>();
+
+ addParams(params, "WHOLE_TRACE",
+ 0,
+ Long.MAX_VALUE,
+ TOTAL_NB_EVENTS,
+ STREAM1_FIRST_EVENT_TIME,
+ LAST_EVENT_TIME);
+
+ addParams(params, "NO_EVENTS_USING_INVERTED_TIME",
+ Long.MAX_VALUE, Long.MIN_VALUE,
+ 0,
+ -1,
+ -1);
+
+ addParams(params, "NO_EVENTS_USING_FIRST_PACKET",
+ STREAM0_FIRST_PACKET_TIME + 1,
+ STREAM0_FIRST_PACKET_TIME + 1,
+ 0,
+ -1,
+ -1);
+
+ addParams(params, "STREAM0_FIRST_PACKET_TIME",
+ STREAM0_FIRST_PACKET_TIME,
+ STREAM0_FIRST_PACKET_TIME,
+ STREAM0_FIRST_PACKET_NB_EVENTS,
+ STREAM0_FIRST_EVENT_TIME,
+ STREAM0_LAST_EVENT_TIME);
+
+ addParams(params, "BOTH_STREAMS_FIRST_PACKET_ONLY",
+ STREAM0_FIRST_PACKET_TIME,
+ STREAM1_FIRST_PACKET_TIME,
+ STREAM0_FIRST_PACKET_NB_EVENTS + STREAM1_FIRST_PACKET_NB_EVENTS,
+ STREAM1_FIRST_EVENT_TIME,
+ STREAM0_LAST_EVENT_TIME);
+
+ addParams(params, "BOTH_STREAMS_SEVERAL_PACKETS",
+ STREAM1_FIFTH_PACKET_TIME,
+ STREAM1_TENTH_PACKET_TIME,
+ NB_EVENTS_SEVERAL_PACKETS,
+ STREAM1_FIFTH_PACKET_FIRST_EVENT_TIME,
+ STREAM1_TENTH_PACKET_LAST_EVENT_TIME);
+
+ return params;
+ }
+
+ private static void addParams(List<Object[]> params, String name, long startTime, long endTime, int nbEvents, long firstEventTime, long lastEventTime) {
+ Object array[] = new Object[] { name, startTime, endTime, nbEvents, firstEventTime, lastEventTime };
+ params.add(array);
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ String property = System.getProperty("osgi.instance.area"); //$NON-NLS-1$
+ File dir = null;
+ if (property != null) {
+ try {
+ dir = URIUtil.toFile(URIUtil.fromString(property));
+ dir = new File(dir.getAbsolutePath() + File.separator);
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ } catch (URISyntaxException e) {
+ }
+ }
+ if (dir == null) {
+ dir = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$)
+ }
+ String tempDir = dir.getAbsolutePath() + File.separator + "testcases" + File.separator;
+ fTempDir = new File(tempDir);
+ if (!fTempDir.exists()) {
+ fTempDir.mkdirs();
+ }
+ }
+
+ public CTFTraceWriterTest (String name, long startTime, long endTime, int nbEvents, long firstEventTime, long lastEventTime) {
+ fName = name;
+ fStartTime = startTime;
+ fEndTime = endTime;
+ fNbEvents = nbEvents;
+ fFirstEventTime = firstEventTime;
+ fLastEventTime = lastEventTime;
+ }
+
+ /**
+ * Test various time ranges
+ */
+ @Test
+ public void testKernelTrace() {
+ assumeTrue(CtfTestTrace.KERNEL.exists());
+ try {
+ CTFTrace trace = CtfTestTrace.KERNEL.getTrace();
+ CTFTraceWriter ctfWriter = new CTFTraceWriter(checkNotNull(trace));
+ String traceName = createTraceName(fName);
+ ctfWriter.copyPackets(fStartTime, fEndTime, traceName);
+
+ File metadata = new File(traceName + Utils.SEPARATOR + "metadata");
+ assertTrue("metadata", metadata.exists());
+
+ CTFTrace outTrace = new CTFTrace(traceName);
+ int count = 0;
+ Long start = null;
+ long end = 0;
+ try (CTFTraceReader reader = new CTFTraceReader(outTrace)) {
+ while(reader.hasMoreEvents()) {
+ count++;
+ EventDefinition def = reader.getCurrentEventDef();
+ end = def.getTimestamp();
+ if (start == null) {
+ start = outTrace.getClock().getClockOffset() + reader.getStartTime();
+ }
+ reader.advance();
+ }
+ end = outTrace.getClock().getClockOffset() + end;
+ }
+
+ if (fFirstEventTime >= 0) {
+ assertEquals("first event time", Long.valueOf(fFirstEventTime), start);
+ }
+ if (fLastEventTime >= 0) {
+ assertEquals("last event time", fLastEventTime, end);
+ }
+ assertEquals(toString(), fNbEvents, count);
+
+ if (fNbEvents == 0) {
+ assertFalse("channel0", getChannelFile(traceName, 0).exists());
+ assertFalse("channel1", getChannelFile(traceName, 1).exists());
+ }
+
+ } catch (CTFException e) {
+ fail();
+ }
+ }
+
+ private static File getChannelFile(String path, int id) {
+ File channel = new File(path + Utils.SEPARATOR + "channel_" + String.valueOf(id));
+ return channel;
+ }
+
+ private static String createTraceName(String testCase) {
+ return fTempDir.getAbsolutePath() + File.separator + testCase.toString();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Delisle - Generate dummy trace
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.IOStructGen;
+import org.junit.Test;
+
+/**
+ * Unit tests for {@link IOStructGen}
+ *
+ * @author Matthew Khouzam
+ */
+public class IOstructgenTest {
+
+ private static final String metadataDecs = "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n"
+ + "typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n"
+ + "typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n"
+ + "typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n"
+ + "typealias integer { size = 64; align = 8; signed = false; } := unsigned long;\n"
+ + "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
+ + "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
+ + "typealias integer { size = 32; align = 1; signed = true; base = decimal; } := int32_t;\n"
+ + "typealias integer { size = 31; align = 1; signed = true; base = dec; } := int31_t;\n"
+ + "typealias integer { size = 30; align = 1; signed = true; base = d; } := int30_t;\n"
+ + "typealias integer { size = 29; align = 1; signed = true; base = i; } := int29_t;\n"
+ + "typealias integer { size = 28; align = 1; signed = true; base = u; } := int28_t;\n"
+ + "typealias integer { size = 27; align = 1; signed = true; base = hexadecimal; } := int27_t;\n"
+ + "typealias integer { size = 26; align = 1; signed = true; base = hex; } := int26_t;\n"
+ + "typealias integer { size = 25; align = 1; signed = true; base = x; } := int25_t;\n"
+ + "typealias integer { size = 24; align = 1; signed = true; base = X; } := int24_t;\n"
+ + "typealias integer { size = 23; align = 1; signed = true; base = p; } := int23_t;\n"
+ + "typealias integer { size = 22; align = 1; signed = true; base = 16; } := int22_t;\n"
+ + "typealias integer { size = 21; align = 1; signed = true; base = oct; } := int21_t;\n"
+ + "typealias integer { size = 20; align = 1; signed = true; base = b; } := int20_t;\n"
+ + "typealias integer { size = 19; align = 1; signed = true; base = octal; } := int19_t;\n"
+ + "typealias integer { size = 18; align = 1; signed = true; base = o; } := int18_t;\n"
+ + "typealias integer { size = 17; align = 1; signed = true; base = binary; } := int17_t;\n"
+ + "\n"
+ + "trace {\n"
+ + " major = 1;\n"
+ + " minor = 8;\n"
+ + " uuid = \"b04d391b-e736-44c1-8d89-4bb438857f8d\";\n"
+ + " byte_order = le;\n"
+ + " packet.header := struct {\n"
+ + " uint32_t magic;\n"
+ + " uint8_t uuid[16];\n"
+ + " uint32_t stream_id;\n" + " };\n" + "};\n" + "\n";
+ private static final String environmentMD = "env {\n"
+ + " hostname = \"DemoSystem\";\n"
+ + " vpid = 1337;\n"
+ + " procname = \"demo\";\n"
+ + " domain = \"autogenerated\";\n"
+ + " tracer_name = \"tmf\";\n"
+ + " tracer_major = 2;\n"
+ + " tracer_minor = 0x01;\n"
+ + " tracer_patchlevel = 0;\n"
+ + "};\n" + "\n";
+ private static final String clockMD = "clock {\n" + " name = monotonic;\n"
+ + " uuid = \"cbf9f42e-9be7-4798-a96f-11db556e2ebb\";\n"
+ + " description = \"Monotonic Clock\";\n"
+ + " freq = 1000000000; /* Frequency, in Hz */\n"
+ + " /* clock value offset from Epoch is: offset * (1/freq) */\n"
+ + " offset = 1350310657466295832;\n" + "};\n"
+ + "\n";
+
+ private static final String ctfStart =
+ "typealias integer {\n"
+ + " size = 27; align = 1; signed = false;\n"
+ + " map = clock.monotonic.value;\n"
+ + "} := uint27_clock_monotonic_t;\n"
+ + "\n"
+ + "typealias integer {\n"
+ + " size = 32; align = 8; signed = false;\n"
+ + " map = clock.monotonic.value;\n"
+ + "} := uint32_clock_monotonic_t;\n"
+ + "\n"
+ + "typealias integer {\n"
+ + " size = 64; align = 8; signed = false;\n"
+ + " map = clock.monotonic.value;\n"
+ + "} := uint64_clock_monotonic_t;\n"
+ + "\n";
+
+ private static final String ctfHeaders =
+ "struct packet_context {\n"
+ + " uint64_clock_monotonic_t timestamp_begin;\n"
+ + " uint64_clock_monotonic_t timestamp_end;\n"
+ + " uint64_t content_size;\n"
+ + " uint64_t packet_size;\n"
+ + " unsigned long events_discarded;\n"
+ + " uint32_t cpu_id;\n"
+ + "};\n"
+ + "\n"
+ + "struct event_header_compact {\n"
+ + " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
+ + " variant <id> {\n"
+ + " struct {\n"
+ + " uint27_clock_monotonic_t timestamp;\n"
+ + " } compact;\n"
+ + " struct {\n"
+ + " uint32_t id;\n"
+ + " uint64_clock_monotonic_t timestamp;\n"
+ + " } extended;\n"
+ + " } v;\n"
+ + "} align(8);\n"
+ + "\n"
+ + "struct event_header_large {\n"
+ + " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
+ + " variant <id> {\n" + " struct {\n"
+ + " uint32_clock_monotonic_t timestamp;\n"
+ + " } compact;\n" + " struct {\n"
+ + " uint32_t id;\n"
+ + " uint64_clock_monotonic_t timestamp;\n"
+ + " } extended;\n" + " } v;\n" + "} align(8);\n" + "\n";
+
+ private static final String ctfBody = "stream {\n"
+ + " id = 0;\n"
+ + " event.header := struct event_header_compact;\n"
+ + " packet.context := struct packet_context;\n"
+ + " event.context := struct {\n"
+ + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _ip;\n"
+ + " };\n"
+ + "};\n"
+ + "\n"
+ + "event {\n"
+ + " name = \"ust_tests_demo3:done\";\n"
+ + " id = 0;\n"
+ + " stream_id = 0;\n"
+ + " loglevel = 4;\n"
+ + " fields := struct {\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
+ + " };\n"
+ + "};\n"
+ + "\n"
+ + "event {\n"
+ + " name = \"ust_tests_demo:starting\";\n"
+ + " id = 1;\n"
+ + " stream_id = 0;\n"
+ + " loglevel = 2;\n"
+ + " model.emf.uri = \"http://example.com/path_to_model?q=ust_tests_demo:starting\";\n"
+ + " fields := struct {\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
+ + " };\n"
+ + "};\n"
+ + "\n"
+ + "event {\n"
+ + " name = \"ust_tests_demo:done\";\n"
+ + " id = 2;\n"
+ + " stream_id = 0;\n"
+ + " loglevel = 2;\n"
+ + " model.emf.uri = \"http://example.com/path_to_model?q=ust_tests_demo:done\";\n"
+ + " fields := struct {\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
+ + " };\n"
+ + "};\n"
+ + "\n"
+ + "event {\n"
+ + " name = \"ust_tests_demo2:loop\";\n"
+ + " id = 3;\n"
+ + " stream_id = 0;\n"
+ + " loglevel = 4;\n"
+ + " fields := struct {\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _intfield;\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 16; } _intfield2;\n"
+ + " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _longfield;\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; byte_order = be; } _netintfield;\n"
+ + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 16; byte_order = be; } _netintfieldhex;\n"
+ + " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _arrfield1[3];\n"
+ + " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _arrfield2[10];\n"
+ + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 10; } __seqfield1_length;\n"
+ + " integer { size = 8; align = 8; signed = 1; encoding = none; base = 10; } _seqfield1[ __seqfield1_length ];\n"
+ + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 10; } __seqfield2_length;\n"
+ + " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _seqfield2[ __seqfield2_length ];\n"
+ + " string _stringfield;\n"
+ + " floating_point { exp_dig = 8; mant_dig = 24; align = 8; } _floatfield;\n"
+ + " floating_point { exp_dig = 11; mant_dig = 53; align = 8; } _doublefield;\n"
+ + " };\n"
+ + "};\n"
+ + "\n";
+
+ private static final String enumMd =
+ "typealias integer { size = 32; align = 8; signed = false; } := int;\n"
+ + "typealias enum { ONE = 0, a,b,c=10, d} := useless_enum;\n"
+ + "struct useless{ \n"
+ + " enum : uint8_t { A=0, \"B\",} enum3;\n"
+ + " useless_enum enum2;"
+ + " enum { C, D, E } enum4;\n"
+ + " uint16_t val;\n"
+ + "} ;\n"
+ + "\n"
+ + "event {\n"
+ + " name = \"enumEvent\";\n"
+ + " id = 6;\n"
+ + " stream_id = 0;\n"
+ + " loglevel = 5;\n"
+ + " fields := struct{\n"
+ + " uint16_t _some_field;\n"
+ // + " useless junk;\n"
+ // + " bad_enum a;\n"
+ + " enum {A, B, C = 3 , } _other_enum;\n"
+ + " };\n"
+ + "};\n"
+ + "\n";
+
+ private final static String contextMD =
+ "event {\n" +
+ " name = \"someOtherEvent\";\n" +
+ " id = 5;\n" +
+ " stream_id = 0;\n" +
+ " loglevel = 5;\n" +
+ " context := struct{\n" +
+ " uint16_t _someContext;\n" +
+ " };\n" +
+ " fields := struct{\n" +
+ " uint16_t _somefield;\n" +
+ " };\n" +
+ "};\n " +
+ "\n";
+
+ private static final String callsiteMD =
+ "callsite {\n"
+ + " name = \"ust_tests_demo2:loop\";\n"
+ + " func = \"main\";\n" + " ip = 0x400a29;\n"
+ + " file = \"demo.c\";\n" + " line = 59;\n" + "};\n" + "\n"
+ + "callsite {\n" + " name = \"ust_tests_demo3:done\";\n"
+ + " func = \"main\";\n" + " ip = 0x400a6c;\n"
+ + " file = \"demo.c\";\n" + " line = 62;\n" + "};\n" + "\n"
+ + "callsite {\n" + " name = \"ust_tests_demo:done\";\n"
+ + " func = \"main\";\n" + " ip = 0x400aaf;\n"
+ + " file = \"demo.c\";\n" + " line = 61;\n" + "};\n" + "\n"
+ + "callsite {\n" + " name = \"ust_tests_demo:starting\";\n"
+ + " func = \"main\";\n" + " ip = 0x400af2;\n"
+ + " file = \"demo.c\";\n" + " line = 55;\n" + "};\n";
+
+ private static final String simpleTSDL = metadataDecs + ctfStart + ctfHeaders
+ + ctfBody;
+ private static final String enumTSDL = metadataDecs + ctfStart + ctfHeaders
+ + ctfBody + enumMd;
+ private static final String clockTSDL = metadataDecs + clockMD + ctfStart
+ + ctfHeaders + ctfBody;
+ private static final String envTSDL = metadataDecs + environmentMD + ctfStart
+ + ctfHeaders + ctfBody;
+ private static final String contextTSDL = metadataDecs + environmentMD + ctfStart
+ + ctfHeaders + ctfBody + contextMD;
+ private static final String callsiteTSDL = metadataDecs + ctfStart + ctfHeaders
+ + ctfBody + callsiteMD;
+ private static final String allDressedTSDL = metadataDecs + environmentMD + clockMD
+ + ctfStart + ctfHeaders + ctfBody + enumMd + callsiteMD;
+
+ static final String tempTraceDir = CtfCoreTestPlugin.getTemporaryDirPath()
+ + File.separator + "tempTrace";
+
+ private static final int DATA_SIZE = 4096;
+
+ private static final int HEADER_SIZE = 68;
+
+ private static final int PACKET_SIZE = DATA_SIZE + HEADER_SIZE + 512;
+
+ private CTFTrace trace;
+
+ private static class Event {
+ private static final int EVENT_SIZE = 16;
+ private int eventId;
+ private int eventTimestamp;
+ private int eventContent;
+
+ public Event(int id, int content) {
+ eventId = id;
+ eventTimestamp = 0;
+ eventContent = content;
+ }
+
+ public void setEventTimestamp(int eventTimestamp) {
+ this.eventTimestamp = eventTimestamp;
+ }
+
+ public void setEventContent(int eventContent) {
+ this.eventContent = eventContent;
+ }
+
+ public void writeEvent(ByteBuffer data) {
+ // Id and Timestamp
+ int timeId = eventTimestamp << 5;
+ timeId |= eventId & 0x1f;
+ data.putInt(timeId);
+
+ // Context
+ long ip = 0x0000facedecafe00L + ((data.position() /
+ getSize()) & 0x0F);
+ data.putLong(ip);
+
+ // Content
+ data.putInt(eventContent);
+
+ }
+
+ public int getSize() {
+ return EVENT_SIZE;
+ }
+
+ }
+
+ private static void deltree(File f) {
+ for (File elem : f.listFiles()) {
+ if (elem.isDirectory()) {
+ deltree(elem);
+ }
+ elem.delete();
+ }
+ f.delete();
+ }
+
+ private static void createDummyTrace(String metadata) {
+ File dir = new File(tempTraceDir);
+ if (dir.exists()) {
+ deltree(dir);
+ }
+ dir.mkdirs();
+
+ File metadataFile = new File(tempTraceDir + "/metadata");
+ try (FileWriter fw = new FileWriter(metadataFile);) {
+ fw.write(metadata);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ byte magicLE[] = { (byte) 0xC1, (byte) 0x1F, (byte) 0xFC,
+ (byte) 0xC1 };
+ byte uuid[] = { (byte) 0xb0, 0x4d, 0x39, 0x1b, (byte) 0xe7,
+ 0x36, 0x44, (byte) 0xc1, (byte) 0x8d, (byte) 0x89, 0x4b,
+ (byte) 0xb4, 0x38, (byte) 0x85, 0x7f, (byte) 0x8d };
+
+ Event ev = new Event(2, 2);
+
+ final int nbEvents = (DATA_SIZE / ev.getSize()) - 1;
+ final int contentSize = (nbEvents * ev.getSize() +
+ HEADER_SIZE) * 8;
+
+ ByteBuffer data = ByteBuffer.allocate(PACKET_SIZE);
+ data.order(ByteOrder.LITTLE_ENDIAN);
+ data.clear();
+
+ // packet header
+ // magic number 4
+ data.put(magicLE);
+ // uuid 16
+ data.put(uuid);
+ // stream ID 4
+ data.putInt(0);
+
+ // packet context
+ // timestamp_begin 8
+ data.putLong(0xa500);
+
+ // timestamp_end 8
+ data.putLong(nbEvents * 0x10000 + 0xa5a6);
+
+ // content_size 8
+ data.putLong(contentSize);
+
+ // packet_size 8
+ data.putLong(PACKET_SIZE * 8);
+
+ // events_discarded 8
+ data.putLong(0);
+
+ // cpu_id 4
+ data.putInt(0);
+
+ // fill me
+ for (int i = 0; i < nbEvents; i++) {
+ ev.setEventTimestamp(i * 0x10000 + 0xa5a5);
+ ev.setEventContent(i);
+ ev.writeEvent(data);
+ }
+
+ // The byteBuffer needs to be flipped in file writing mode
+ data.flip();
+
+ File dummyFile = new File(tempTraceDir + "/dummyChan");
+ try (FileOutputStream fos = new FileOutputStream(dummyFile);) {
+ fos.getChannel().write(data);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Simple test (only the minimum)
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLSimpleTest() throws CTFException {
+ createDummyTrace(simpleTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test with environment variables
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLEnvironmentTest() throws CTFException {
+ createDummyTrace(envTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test with Clocks
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLEnumTest() throws CTFException {
+ createDummyTrace(enumTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test with Clocks
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLClockTest() throws CTFException {
+ createDummyTrace(clockTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test with Contexts
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLContextTest() throws CTFException {
+ createDummyTrace(contextTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test with Callsites
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLCallsiteTest() throws CTFException {
+ createDummyTrace(callsiteTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+ }
+
+ /**
+ * Test everything
+ *
+ * @throws CTFException
+ * something wrong happened
+ */
+ @Test
+ public void TSDLAllTest() throws CTFException {
+ createDummyTrace(allDressedTSDL);
+ trace = new CTFTrace(tempTraceDir);
+ assertNotNull(trace);
+
+ final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
+ final EventDeclaration eventDeclaration = (EventDeclaration) eventDeclarations.get(2);
+ assertEquals("http://example.com/path_to_model?q=ust_tests_demo:done",
+ eventDeclaration.getCustomAttribute("model.emf.uri"));
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.trace.Metadata;
+import org.junit.Test;
+
+/**
+ * There are so many it makes sense to move them to their own file
+ */
+public class MetadataPrevalidationTests {
+
+ private static final String GOOD_TSDL = "/* CTF 1.8 */\ntrace {\n major = 1 ;\n minor = 8 ;\n byte_order = le ; \n};";
+
+ /**
+ * Test a null should return false
+ *
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceNull() throws CTFException {
+ assertFalse(Metadata.preValidate(null));
+ }
+
+ /**
+ * Test a non-existing file should return false
+ *
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceFileDoesNotExist() throws CTFException {
+ assertFalse(Metadata.preValidate("abcdefghijklmnopqrstuvwxyz"));
+ }
+
+ /**
+ * Test a trace file should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceFile() throws CTFException, IOException {
+ File f = File.createTempFile("test", ".log");
+ try (PrintWriter pw = new PrintWriter(f)) {
+ pw.println("2 hello world");
+ }
+ assertFalse(Metadata.preValidate(f.getAbsolutePath()));
+ }
+
+ /**
+ * Test an empty directory should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithNoFiles() throws IOException, CTFException {
+ Path dir = Files.createTempDirectory("trace");
+ assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a directory with no metadata file should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithNoMetadataButFiles() throws CTFException, IOException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ try (PrintWriter pw = new PrintWriter(f.toFile())) {
+ pw.println("2 hello world");
+ }
+ assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with packetized little endian metadata should return
+ * true
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithLittleEndianMetadata() throws CTFException, IOException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ Files.write(f, packetize(GOOD_TSDL, ByteOrder.BIG_ENDIAN));
+ assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with packetized big endian metadata should return true
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithBigEndianMetadata() throws CTFException, IOException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ Files.write(f, packetize(GOOD_TSDL, ByteOrder.BIG_ENDIAN));
+ assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with text metadata should return true
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithTextMetadata() throws IOException, CTFException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ try (PrintWriter pw = new PrintWriter(f.toFile())) {
+ pw.println(GOOD_TSDL);
+ }
+ assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with text invalid metadata should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithInvalidMetadata() throws IOException, CTFException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ try (PrintWriter pw = new PrintWriter(f.toFile())) {
+ // no header
+ pw.println("trace { major =1 ; minor = 8 ; byte_order = le;};");
+ }
+ assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with an empty metadata should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWithEmptyMetadata() throws IOException, CTFException {
+ Path dir = Files.createTempDirectory("trace");
+ Files.createFile(dir.resolve("metadata"));
+ assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ /**
+ * Test a valid trace with 1 byte long metadata should return false
+ *
+ * @throws IOException
+ * A file error occurs, shouldn't happen
+ * @throws CTFException
+ * if an exception occurs, shouldn't happen
+ */
+ @Test
+ public void testTraceDirectoryWith1ByteMetadata() throws IOException, CTFException {
+ Path dir = Files.createTempDirectory("trace");
+ Path f = Files.createFile(dir.resolve("metadata"));
+ try (FileWriter pw = new FileWriter(f.toFile())) {
+ pw.append('x');
+ }
+ assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
+ }
+
+ private static byte[] packetize(String body, ByteOrder bo) {
+ byte[] retVal = new byte[40 + body.length()];
+ ByteBuffer bb = ByteBuffer.wrap(retVal);
+ bb.order(bo);
+ generateMetadataPacketHeader(bb, body);
+ return retVal;
+ }
+
+ private static void generateMetadataPacketHeader(ByteBuffer headerByteBuffer, String body) {
+ /* Read from the ByteBuffer */
+ headerByteBuffer.putInt(0x75D11D57);
+ final UUID randomUUID = UUID.randomUUID();
+ headerByteBuffer.putLong(randomUUID.getMostSignificantBits());
+ headerByteBuffer.putLong(randomUUID.getLeastSignificantBits());
+ headerByteBuffer.putInt(0); // checksum
+ headerByteBuffer.putInt(body.length());
+ headerByteBuffer.putInt(body.length());
+ headerByteBuffer.put((byte) 0);
+ headerByteBuffer.put((byte) 0);
+ headerByteBuffer.putInt(0);
+ headerByteBuffer.put((byte) 1);
+ headerByteBuffer.put((byte) 8);
+ headerByteBuffer.put(body.getBytes());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.Metadata;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>MetadataTest</code> contains tests for the class
+ * <code>{@link Metadata}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class MetadataTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+ private static final String mdStart = "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n" +
+ " typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n" +
+ " typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n" +
+ " typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n" +
+ " typealias integer { size = 64; align = 8; signed = false; } := unsigned long;\n" +
+ " typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n" +
+ " typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n" +
+ "" +
+ " trace {\n" +
+ " major = 1;\n" +
+ " minor = 8;\n" +
+ " uuid = \"8b1258ba-effb-554b-b779-fbd676746000\";\n" +
+ " byte_order = le;\n" +
+ " packet.header := struct {\n" +
+ " uint32_t magic;\n" +
+ " uint8_t uuid[16];\n" +
+ " uint32_t stream_id;\n" +
+ " };\n" +
+ " };\n" +
+ "" +
+ " env {\n" +
+ " hostname = \"computer\";\n" +
+ " domain = \"kernel\";\n" +
+ " sysname = \"BeOS\";\n" +
+ " kernel_release = \"95\";\n" +
+ " kernel_version = \"BeWare 95\";\n" +
+ " tracer_name = \"BeOS Tracer\";\n" +
+ " tracer_major = 2;\n" +
+ " tracer_minor = 3;\n" +
+ " tracer_patchlevel = 0;\n" +
+ " };\n" +
+ " clock {\n" +
+ " name = monotonic;\n" +
+ " uuid = \"4d737a79-e3f1-4f4d-a649-42015266baf5\";\n" +
+ " description = \"Monotonic Clock\";\n" +
+ " freq = 1000000000; /* Frequency, in Hz */\n" +
+ " /* clock value offset from Epoch is: offset * (1/freq) */\n" +
+ " offset = 1383600210829415521;\n" +
+ " };\n" +
+
+ " typealias integer {\n" +
+ "size = 27; align = 1; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ " } := uint27_clock_monotonic_t;\n" +
+ " \n" +
+ " typealias integer {\n" +
+ " size = 32; align = 8; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ " } := uint32_clock_monotonic_t;\n" +
+ " \n" +
+ " typealias integer {\n" +
+ " size = 64; align = 8; signed = false;\n" +
+ " map = clock.monotonic.value;\n" +
+ " } := uint64_clock_monotonic_t;\n" +
+ " \n" +
+ " struct packet_context {\n" +
+ " uint64_clock_monotonic_t timestamp_begin;\n" +
+ " uint64_clock_monotonic_t timestamp_end;\n" +
+ " uint64_t content_size;\n" +
+ " uint64_t packet_size;\n" +
+ " unsigned long events_discarded;\n" +
+ " uint32_t cpu_id;\n" +
+ " };\n" +
+ " \n" +
+ " struct event_header_compact {\n" +
+ " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n" +
+ " variant <id> {\n" +
+ " struct {\n" +
+ " uint27_clock_monotonic_t timestamp;\n" +
+ " } compact;\n" +
+ " struct {\n" +
+ " uint32_t id;\n" +
+ " uint64_clock_monotonic_t timestamp;\n" +
+ " } extended;\n" +
+ " } v;\n" +
+ " } align(8);\n" +
+ " \n" +
+ " struct event_header_large {\n" +
+ " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n" +
+ " variant <id> {\n" +
+ " struct {\n" +
+ " uint32_clock_monotonic_t timestamp;\n" +
+ " } compact;\n" +
+ " struct {\n" +
+ " uint32_t id;\n" +
+ " uint64_clock_monotonic_t timestamp;\n" +
+ " } extended;\n" +
+ " } v;\n" +
+ " } align(8);\n" +
+ " \n" +
+ " stream {\n" +
+ " id = 0;\n" +
+ " event.header := struct event_header_compact;\n" +
+ " packet.context := struct packet_context;\n" +
+ " };\n" +
+ " \n" +
+ " event {\n" +
+ " name = sched_switch;\n" +
+ " id = 0;\n" +
+ " stream_id = 0;\n" +
+ " fields := struct {\n" +
+ " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _prev_comm[16];\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid;\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio;\n" +
+ " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _prev_state;\n" +
+ " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _next_comm[16];\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid;\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio;\n" +
+ " };\n" +
+ " };";
+
+ private static final String mdSecond = " event {\n" +
+ " name = bozo_the_clown;\n" +
+ " id = 1;\n" +
+ " stream_id = 0;\n" +
+ " fields := struct {\n" +
+ " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } clown_nose;\n" +
+ " };\n" +
+ " };";
+
+ private Metadata fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ assumeTrue(testTrace.exists());
+ fixture = new Metadata(testTrace.getTrace());
+ }
+
+ /**
+ * Run the Metadata(CTFTrace) constructor test.
+ */
+ @Test
+ public void testMetadata() {
+ assertNotNull(fixture);
+ }
+
+ @Test
+ public void testTextMD() throws CTFException {
+ testSingleFragment();
+ }
+
+ protected CTFTrace testSingleFragment() throws CTFException {
+ fixture = new Metadata();
+ CTFTrace trace = fixture.getTrace();
+ for (CTFStream s : trace.getStreams()) {
+ fail("This should be empty, has" + s.toString());
+ }
+ fixture.parseText(mdStart);
+ int count = 0;
+ for (CTFStream s : trace.getStreams()) {
+ count++;
+ assertNotNull(s);
+ }
+ assertEquals(1, count);
+ assertEquals(1, trace.getEventDeclarations(0L).size());
+ return trace;
+ }
+
+ @Test
+ public void testStreamTextMD() throws CTFException {
+ CTFTrace trace = testSingleFragment();
+ fixture.parseTextFragment(mdSecond);
+ final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
+ assertEquals(2, eventDeclarations.size());
+ assertEquals("bozo_the_clown", eventDeclarations.get(1).getName());
+ }
+
+ /**
+ * Run the ByteOrder getDetectedByteOrder() method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testGetDetectedByteOrder() throws CTFException {
+ setUp();
+ ByteOrder result = fixture.getDetectedByteOrder();
+ assertNull(result);
+ }
+
+ /**
+ * Test toString
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testToString() throws CTFException {
+ setUp();
+ String result = fixture.toString();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the void parse() method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testParse() throws CTFException {
+ setUp();
+ assertEquals(new UUID(0xd18e637435a1cd42L, 0x8e70a9cffa712793L), testTrace.getTrace().getUUID());
+ assertEquals(1332166405241713920.0, testTrace.getTrace().getClock().getClockOffset(), 200.0);
+ assertEquals(8, testTrace.getTrace().getEnvironment().size());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013-2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CTFTraceReaderTest.class,
+ CTFTraceTest.class,
+ CTFTraceGrowingTest.class,
+ IOstructgenTest.class,
+ MetadataTest.class,
+ MetadataPrevalidationTests.class,
+ CTFStreamInputPacketIndexEntryTest.class,
+ CTFStreamInputPacketIndexTest.class,
+ CTFStreamInputReaderTest.class,
+ CTFStreamInputReaderTimestampComparatorTest.class,
+ CTFStreamInputTest.class,
+ CTFStreamTest.class,
+ CTFTraceWriterTest.class,
+ TraceReadAllTracesTest.class,
+ UtilsTest.class
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Read all the traces and verify some metrics. Nominally the event count and
+ * the duration of the trace (not the time to parse it).
+ *
+ * @author Matthew Khouzam
+ */
+@RunWith(Parameterized.class)
+public class TraceReadAllTracesTest {
+
+ /** Time-out tests after 20 seconds. */
+ @Rule
+ public TestRule globalTimeout = new Timeout(20000);
+
+ /**
+ * Get the list of traces
+ *
+ * @return the list of traces
+ */
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> getTracePaths() {
+ CtfTestTrace[] values = CtfTestTrace.values();
+ List<Object[]> list = new ArrayList<>();
+ for (CtfTestTrace value : values) {
+ list.add(new Object[] { value.name(), value });
+ }
+ return list;
+ }
+
+ private final CtfTestTrace fTraceEnum;
+
+ /**
+ * Constructor
+ *
+ * @param name
+ * name of the enum
+ *
+ * @param traceEnum
+ * the enum to test
+ */
+ public TraceReadAllTracesTest(String name, CtfTestTrace traceEnum) {
+ fTraceEnum = traceEnum;
+ }
+
+ /**
+ * Reads all the traces
+ */
+ @Test
+ public void readTraces() {
+ if (fTraceEnum.getNbEvents() != -1) {
+ try (CTFTraceReader reader = new CTFTraceReader(new CTFTrace(fTraceEnum.getPath()))) {
+ EventDefinition currentEventDef = reader.getCurrentEventDef();
+ double start = currentEventDef.getTimestamp();
+ long count = 0;
+ double end = start;
+ while (reader.hasMoreEvents()) {
+ reader.advance();
+ count++;
+ currentEventDef = reader.getCurrentEventDef();
+ if (currentEventDef != null) {
+ end = currentEventDef.getTimestamp();
+ if (currentEventDef.getDeclaration().getName().equals(CTFStrings.LOST_EVENT_NAME)) {
+ count += ((IntegerDefinition) currentEventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD)).getValue() - 1;
+ }
+ }
+ }
+ assertEquals("Event count", fTraceEnum.getNbEvents(), count);
+ assertEquals("Trace duration", fTraceEnum.getDuration(), (end - start) / 1000000000.0, 1.0);
+ } catch (CTFException e) {
+ fail(fTraceEnum.getPath() + " " + e.getMessage());
+ }
+ } else {
+ assumeTrue("Trace did not specify events count", false);
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.UUID;
+
+import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
+import org.junit.Test;
+
+/**
+ * The class <code>UtilsTest</code> contains tests for the class
+ * {@link Utils}.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class UtilsTest {
+
+ /**
+ * Run the UUID makeUUID(byte[]) method test.
+ */
+ @Test
+ public void testMakeUUID() {
+ int byteSize = 32;
+ byte[] bytes = new byte[byteSize];
+ for (int i = 0; i < byteSize; i++) {
+ bytes[i] = (byte) (i);
+ }
+
+ UUID result = Utils.makeUUID(bytes);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the UUID makeUUID(byte[]) method test.
+ */
+ @Test
+ public void testMakeUUID_2() {
+ byte[] bytes = new byte[] { (byte) 1, (byte) 1, (byte) 0, (byte) 0,
+ (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1,
+ (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
+
+ UUID result = Utils.makeUUID(bytes);
+
+ assertNotNull(result);
+ assertEquals(72339069014638592L, result.getLeastSignificantBits());
+ assertEquals(72339069014638592L, result.getMostSignificantBits());
+ assertEquals("01010000-0000-0000-0101-000000000000", result.toString());
+ assertEquals(0, result.variant());
+ assertEquals(0, result.version());
+ }
+
+ /**
+ * Run the UUID makeUUID(byte[]) method test.
+ */
+ @Test
+ public void testMakeUUID_3() {
+ byte[] bytes = new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0,
+ (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0,
+ (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
+
+ UUID result = Utils.makeUUID(bytes);
+
+ assertNotNull(result);
+ assertEquals(0L, result.getLeastSignificantBits());
+ assertEquals(0L, result.getMostSignificantBits());
+ assertEquals("00000000-0000-0000-0000-000000000000", result.toString());
+ assertEquals(0, result.variant());
+ assertEquals(0, result.version());
+ }
+
+ /**
+ * Run the int unsignedCompare(long,long) method test.
+ */
+ @Test
+ public void testUnsignedCompare() {
+ long a = 1L;
+ long b = 1L;
+ int result;
+
+ result = Utils.unsignedCompare(a, b);
+ assertEquals(0, result);
+
+ result = Utils.unsignedCompare(0L, 1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(0xFFFFFFFFL, 0x100000000L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(-4L, -1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(-0x80000000L, -1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFEL, 0x7FFFFFFFFFFFFFFFL);
+ assertEquals(-1, result);
+
+ result = Utils.unsignedCompare(1L, 0L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(0x100000000L, 0xFFFFFFFFL);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(-1L, -4L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(-1L, -0x80000000L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFEL);
+ assertEquals(1, result);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.io.Util;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>ArrayDeclaration2Test</code> contains tests for the class
+ * <code>{@link ArrayDeclaration}</code>.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+public class ArrayDeclaration2Test {
+
+ private ArrayDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ }
+
+ /**
+ * Run the ArrayDeclaration(int,Declaration) constructor test.
+ */
+ @Test
+ public void testArrayDeclaration() {
+ int length = 1;
+ IDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ ArrayDeclaration result = new ArrayDeclaration(length, elemType);
+
+ assertNotNull(result);
+ String left = "[declaration] array[";
+ String right = result.toString().substring(0, left.length());
+ assertEquals(left, right);
+ assertEquals(1, result.getLength());
+ }
+
+ /**
+ * Run the ArrayDefinition createDefinition(DefinitionScope,String) method
+ * test.
+ *
+ * @throws CTFException
+ * error in the bitbuffer
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ String fieldName = "";
+ IDefinitionScope definitionScope = null;
+ AbstractArrayDefinition result;
+ byte[] array = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
+ BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(array)));
+ result = fixture.createDefinition(definitionScope, fieldName, bb);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Declaration getElementType() method test.
+ */
+ @Test
+ public void testGetElementType() {
+ IDeclaration result = fixture.getElementType();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the int getLength() method test.
+ */
+ @Test
+ public void testGetLength() {
+ int result = fixture.getLength();
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the boolean isString() method test.
+ */
+ @Test
+ public void testIsString_ownDefs() {
+ // it's an array of strings, not a string
+ assertFalse(fixture.isString());
+ }
+
+ /**
+ * Run the boolean isString() method test.
+ */
+ @Test
+ public void testIsString_complex() {
+ final IntegerDeclaration id = IntegerDeclaration.createDeclaration(8, false, 16,
+ ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 8);
+ CompoundDeclaration ad = new ArrayDeclaration(0, id);
+
+ boolean result = ad.isString();
+
+ assertTrue(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ String left = "[declaration] array[";
+ String right = result.substring(0, left.length());
+
+ assertEquals(left, right);
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ assertEquals(2016, fixture.hashCode());
+ assertEquals(new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8)).hashCode(), fixture.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ ArrayDeclaration a = new ArrayDeclaration(1, IntegerDeclaration.INT_32B_DECL);
+ ArrayDeclaration b = new ArrayDeclaration(2, IntegerDeclaration.INT_32B_DECL);
+ ArrayDeclaration c = new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ ArrayDeclaration d = new ArrayDeclaration(1, IntegerDeclaration.INT_32B_DECL);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertEquals(a, d);
+ assertEquals(a, a);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertEquals(d, a);
+ assertEquals(a, a);
+ assertFalse(a.isBinaryEquivalent(b));
+ assertFalse(b.isBinaryEquivalent(a));
+ assertFalse(a.isBinaryEquivalent(c));
+ assertFalse(c.isBinaryEquivalent(a));
+ assertTrue(a.isBinaryEquivalent(d));
+ assertTrue(d.isBinaryEquivalent(a));
+ assertTrue(a.isBinaryEquivalent(a));
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.*;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.io.Util;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>ArrayDefinition2Test</code> contains tests for the class
+ * <code>{@link ArrayDefinition}</code>.
+ *
+ */
+public class ArrayDefinition2Test {
+
+ private @NonNull CTFTrace trace = new CTFTrace();
+ private ArrayDefinition charArrayFixture;
+ private ArrayDefinition stringArrayFixture;
+ private ArrayDefinition longArrayFixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * structDef shouldn't be null after parsing the CTFTraceReader object, so
+ * we can ignore the warning.
+ */
+ @Before
+ public void setUp() {
+ charArrayFixture = createCharArray();
+ stringArrayFixture = createStringArray();
+ longArrayFixture = createLongArray();
+ }
+
+ private ArrayDefinition createLongArray() {
+ IntegerDeclaration decl = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none", 8);
+ List<Definition> defs = createIntDefs(10, 32);
+ ArrayDefinition temp = setUpDeclaration(decl, defs);
+ return temp;
+ }
+
+ private ArrayDefinition createCharArray() {
+ IntegerDeclaration decl = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none", 8);
+ List<Definition> defs = createIntDefs(4, 8);
+ ArrayDefinition temp = setUpDeclaration(decl, defs);
+ return temp;
+ }
+
+ private ArrayDefinition createStringArray() {
+ StringDeclaration strDecl = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ List<Definition> defs = createDefs();
+ ArrayDefinition temp = setUpDeclaration(strDecl, defs);
+ return temp;
+ }
+
+ private ArrayDefinition setUpDeclaration(@NonNull IDeclaration decl,
+ @NonNull List<Definition> defs) {
+ CompoundDeclaration ad = new ArrayDeclaration(0, decl);
+ ArrayDefinition temp = new ArrayDefinition(ad, this.trace, "Testx", defs);
+ return temp;
+ }
+
+ @NonNull
+ private static List<Definition> createIntDefs(int size, int bits) {
+ List<Definition> defs = new ArrayList<>(size);
+ for (int i = 0; i < size; i++) {
+ String content = "test" + i;
+ defs.add(new IntegerDefinition(IntegerDeclaration.createDeclaration(bits, false,
+ 16, ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, content, 24), null, content, i));
+ }
+ return defs;
+ }
+
+ @NonNull
+ private static List<Definition> createDefs() {
+ int size = 4;
+ List<Definition> defs = new ArrayList<>();
+ for (int i = 0; i < size; i++) {
+ String content = "test" + i;
+ defs.add(new StringDefinition(
+ StringDeclaration.getStringDeclaration(Encoding.UTF8), null, content, content));
+ }
+ return defs;
+ }
+
+ /**
+ * Run the ArrayDefinition(ArrayDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testArrayDefinition_baseDeclaration() {
+ CompoundDeclaration declaration = (CompoundDeclaration) charArrayFixture.getDeclaration();
+ String fieldName = "";
+
+ @SuppressWarnings("null")
+ ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new Definition[0]));
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the ArrayDefinition(ArrayDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testArrayDefinition_newDeclaration() {
+ CompoundDeclaration declaration = new ArrayDeclaration(0,
+ StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ IDefinitionScope definitionScope = getDefinitionScope();
+
+ String fieldName = "";
+ @SuppressWarnings("null")
+ ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new Definition[0]));
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the ArrayDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ CompoundDeclaration result = (CompoundDeclaration) charArrayFixture.getDeclaration();
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Definition getDefinitions().get(int) method test.
+ */
+ @Test
+ public void testgetElem_noDefs() {
+ int i = 0;
+ IDefinition result = charArrayFixture.getDefinitions().get(i);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Definition getDefinitions().get(int) method test.
+ */
+ @Test
+ public void testgetElem_withDefs() {
+ List<Definition> defs = createDefs();
+ IDefinitionScope definitionScope = getDefinitionScope();
+ ArrayDefinition ad = new ArrayDefinition((CompoundDeclaration) charArrayFixture.getDeclaration(), definitionScope, "test", defs);
+ int j = 1;
+
+ IDefinition result = ad.getDefinitions().get(j);
+
+ assertNotNull(result);
+ }
+
+ @NonNull
+ private static IDefinitionScope getDefinitionScope() {
+ return new IDefinitionScope() {
+
+ @Override
+ public Definition lookupDefinition(String lookupPath) {
+ return null;
+ }
+
+ @Override
+ public LexicalScope getScopePath() {
+ return null;
+ }
+ };
+ }
+
+ /**
+ * Run the void read(BitBuffer) method test.
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void testRead_noDefs() throws CTFException {
+ BitBuffer input = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(128)));
+ charArrayFixture.getDeclaration().createDefinition(null, "test", input);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_char() {
+ String result = charArrayFixture.toString();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_long() {
+ String result = longArrayFixture.toString();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_string() {
+ String result = stringArrayFixture.toString();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString_withDefs() {
+ String result = charArrayFixture.toString();
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToStringStringArray() {
+ String result = stringArrayFixture.toString();
+
+ assertNotNull(result);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.junit.Test;
+
+/**
+ * The class <code>DefinitionTest</code> contains tests for the class
+ * <code>{@link Definition}</code>.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+public class DefinitionTest {
+
+ /**
+ * Since Definition is abstract, we'll minimally extend it here to
+ * instantiate it.
+ */
+ static class DefTest extends Definition {
+
+ @NonNull
+ private static final StringDeclaration STRINGDEC = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+
+ public DefTest(IDefinitionScope definitionScope, @NonNull String fieldName) {
+ super(DefTest.STRINGDEC, definitionScope, fieldName);
+ }
+
+ @Override
+ @NonNull
+ public IDeclaration getDeclaration() {
+ return DefTest.STRINGDEC;
+ }
+
+ }
+
+ /**
+ * Test a definition
+ */
+ @Test
+ public void testToString() {
+ IDefinition fixture = new DefTest(null, "Hello");
+ String result = fixture.toString();
+
+ assertNotNull(result);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.io.Util;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>EnumDeclarationTest</code> contains tests for the class
+ * <code>{@link EnumDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class EnumDeclarationTest {
+
+ private EnumDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new EnumDeclaration(IntegerDeclaration.createDeclaration(1, false, 1,
+ ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8));
+ }
+
+ /**
+ * Run the EnumDeclaration(IntegerDeclaration) constructor test.
+ */
+ @Test
+ public void testEnumDeclaration() {
+ IntegerDeclaration containerType = IntegerDeclaration.createDeclaration(1, false, 1,
+ ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
+
+ EnumDeclaration result = new EnumDeclaration(containerType);
+
+ assertNotNull(result);
+ String left = "[declaration] enum[";
+ assertEquals(left, result.toString().substring(0, left.length()));
+ }
+
+ /**
+ * Run the boolean add(long,long,String) method test.
+ */
+ @Test
+ public void testAdd() {
+ long low = 1L;
+ long high = 1L;
+ String label = "";
+
+ boolean result = fixture.add(low, high, label);
+
+ assertTrue(result);
+ }
+
+ /**
+ * Run the EnumDefinition createDefinition(DefinitionScope,String) method
+ * test.
+ *
+ * @throws CTFException
+ * out of bounds error, won't happen
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ IDefinitionScope definitionScope = null;
+ String fieldName = "";
+ byte[] array = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
+ BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(array)));
+
+ EnumDefinition result = fixture.createDefinition(definitionScope,
+ fieldName, bb);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String query(long) method test.
+ */
+ @Test
+ public void testQuery() {
+ long value = 0;
+ String result = fixture.query(value);
+
+ assertNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+
+ String left = "[declaration] enum[";
+ assertEquals(left, result.substring(0, left.length()));
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ EnumDeclaration b = new EnumDeclaration(IntegerDeclaration.createDeclaration(1, false, 1,
+ ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8));
+ assertEquals(b.hashCode(), fixture.hashCode());
+ fixture.add(0, 1, "hello");
+ fixture.add(2, 3, "kitty");
+ b.add(0, 1, "hello");
+ b.add(2, 3, "kitty");
+ assertEquals(fixture.hashCode(), b.hashCode());
+
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ EnumDeclaration a = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ EnumDeclaration b = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ b.add(2, 19, "hi");
+ EnumDeclaration c = new EnumDeclaration(IntegerDeclaration.INT_32B_DECL);
+ EnumDeclaration d = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertNotEquals(b, c);
+ assertEquals(a, d);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertNotEquals(c, b);
+ assertEquals(d, a);
+ a.add(2, 19, "hi");
+ assertEquals(a, a);
+ assertEquals(a, b);
+ assertEquals(b, a);
+ assertNotEquals(a, d);
+ assertNotEquals(d, a);
+ d.add(2, 22, "hi");
+ assertNotEquals(a, d);
+ assertNotEquals(d, a);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>EnumDefinitionTest</code> contains tests for the class
+ * <code>{@link EnumDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class EnumDefinitionTest {
+
+ private EnumDefinition fixtureA;
+ private EnumDefinition fixtureB;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ IntegerDeclaration integerDeclaration = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
+ Encoding.ASCII, "", 8);
+ EnumDeclaration declaration = new EnumDeclaration(
+ integerDeclaration);
+ declaration.add(0, 10, "a");
+ declaration.add(11, 20, "b");
+ String fieldName = "";
+
+ fixtureA = new EnumDefinition(declaration, null, fieldName, new IntegerDefinition(integerDeclaration, null, fieldName, 4));
+ fixtureB = new EnumDefinition(declaration, null, fieldName, new IntegerDefinition(integerDeclaration, null, fieldName, 12));
+ }
+
+ /**
+ * Run the EnumDefinition(EnumDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testEnumDefinition() {
+ assertNotNull(fixtureA);
+ assertNotNull(fixtureB);
+ }
+
+ /**
+ * Run the String getValue() method test.
+ */
+ @Test
+ public void testGetValue() {
+ String result = fixtureA.getValue();
+
+ assertNotNull(result);
+ assertEquals("a", result);
+ }
+
+ /**
+ * Run the long getIntegerValue() method test.
+ */
+ @Test
+ public void testGetIntegerValue_one() {
+ long result = fixtureA.getIntegerValue();
+ assertEquals(4L, result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixtureB.toString();
+
+ assertEquals("{ value = b, container = 12 }", result);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>EventDeclarationTest</code> contains tests for the class
+ * <code>{@link EventDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class EventDeclarationTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private EventDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ assumeTrue(testTrace.exists());
+ fixture = new EventDeclaration();
+ fixture.setContext(new StructDeclaration(1L));
+ fixture.setId(1L);
+ fixture.setFields(new StructDeclaration(1L));
+ fixture.setStream(new CTFStream(testTrace.getTrace()));
+ fixture.setName("");
+ }
+
+ /**
+ * Run the EventDeclaration() constructor test.
+ */
+ @Test
+ public void testEventDeclaration() {
+ EventDeclaration result = new EventDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the boolean contextIsSet() method test.
+ */
+ @Test
+ public void testContextIsSet() {
+ boolean result = fixture.contextIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean contextIsSet() method test.
+ */
+ @Test
+ public void testContextIsSet_null() {
+ fixture.setContext((StructDeclaration) null);
+
+ boolean result = fixture.contextIsSet();
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testEquals() throws CTFException {
+ EventDeclaration obj = new EventDeclaration();
+ obj.setContext(new StructDeclaration(1L));
+ obj.setId(1L);
+ obj.setFields(new StructDeclaration(1L));
+ obj.setStream(new CTFStream(testTrace.getTrace()));
+ obj.setName("");
+
+ assertTrue(fixture.equals(fixture));
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_null() {
+ Object obj = null;
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_emptyObject() {
+ Object obj = new Object();
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_other1() {
+ EventDeclaration obj = new EventDeclaration();
+ obj.setContext(fixture.getContext());
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_other2() {
+ EventDeclaration obj = new EventDeclaration();
+ obj.setContext(new StructDeclaration(1L));
+ obj.setFields(new StructDeclaration(1L));
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_other3() {
+ EventDeclaration obj = new EventDeclaration();
+ obj.setContext(new StructDeclaration(1L));
+ obj.setId(1L);
+ obj.setFields(new StructDeclaration(1L));
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean equals(Object) method test.
+ */
+ @Test
+ public void testEquals_other4() {
+ EventDeclaration obj = new EventDeclaration();
+ obj.setContext(new StructDeclaration(1L));
+ obj.setId(1L);
+ obj.setFields(new StructDeclaration(1L));
+ obj.setName("");
+
+ boolean result = fixture.equals(obj);
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean fieldsIsSet() method test.
+ */
+ @Test
+ public void testFieldsIsSet() {
+ boolean result = fixture.fieldsIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean fieldsIsSet() method test.
+ */
+ @Test
+ public void testFieldsIsSet_null() {
+ fixture.setFields((StructDeclaration) null);
+
+ boolean result = fixture.fieldsIsSet();
+ assertFalse(result);
+ }
+
+ /**
+ * Run the StructDeclaration getFields() method test.
+ */
+ @Test
+ public void testGetFields() {
+ StructDeclaration result = fixture.getFields();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Long getId() method test.
+ */
+ @Test
+ public void testGetId() {
+ assertEquals(1, fixture.id());
+ }
+
+ /**
+ * Run the String getName() method test.
+ */
+ @Test
+ public void testGetName() {
+ String result = fixture.getName();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Stream getStream() method test.
+ */
+ @Test
+ public void testGetStream() {
+ CTFStream result = fixture.getStream();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the int hashCode() method test.
+ */
+ @Test
+ public void testHashCode() {
+ int result = fixture.hashCode();
+ assertTrue(0 != result);
+ }
+
+ /**
+ * Run the int hashCode() method test.
+ */
+ @Test
+ public void testHashCode_null() {
+ fixture.setStream((CTFStream) null);
+ fixture.setName((String) null);
+
+ int result = fixture.hashCode();
+ assertTrue(0 != result);
+ }
+
+ /**
+ * Run the boolean idIsSet() method test.
+ */
+ @Test
+ public void testIdIsSet() {
+ boolean result = fixture.idIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean nameIsSet() method test.
+ */
+ @Test
+ public void testNameIsSet() {
+ boolean result = fixture.nameIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean nameIsSet() method test.
+ */
+ @Test
+ public void testNameIsSet_null() {
+ fixture.setName((String) null);
+
+ boolean result = fixture.nameIsSet();
+ assertFalse(result);
+ }
+
+ /**
+ * Run the boolean streamIsSet() method test.
+ */
+ @Test
+ public void testStreamIsSet() {
+ boolean result = fixture.streamIsSet();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the boolean streamIsSet() method test.
+ */
+ @Test
+ public void testStreamIsSet_null() {
+ fixture.setStream((CTFStream) null);
+
+ boolean result = fixture.streamIsSet();
+ assertEquals(false, result);
+ }
+
+ /**
+ * Test for the EventDefinition class
+ *
+ * @throws CTFException
+ */
+ @Test
+ public void testEventDefinition() throws CTFException {
+ CTFTrace trace = testTrace.getTrace();
+ EventDefinition ed = null;
+ try (CTFTraceReader tr = new CTFTraceReader(trace);) {
+ tr.advance();
+ ed = tr.getCurrentEventDef();
+ }
+
+ assertNotNull(ed);
+ assertNotNull(ed.getScopePath());
+ assertNotNull(ed.getDeclaration());
+ assertNotNull(ed.getFields());
+ assertNull(ed.getContext());
+ assertNotNull(ed.getPacketContext());
+ assertNotNull(ed.getCPU());
+ assertNotNull(ed.getStreamInputReader());
+ assertNull(ed.lookupDefinition("context"));
+ assertNotNull(ed.lookupDefinition("fields"));
+ assertNull(ed.lookupDefinition("other"));
+ assertNotNull(ed.toString());
+ }
+
+ IEventDeclaration e1;
+ IEventDeclaration e2;
+
+ @Test
+ public void testEquals1() {
+ e1 = new EventDeclaration();
+ assertFalse(e1.equals(null));
+ }
+
+ @Test
+ public void testEquals2() {
+ e1 = LostEventDeclaration.INSTANCE;
+ assertFalse(e1.equals(new Long(23L)));
+ }
+
+ @Test
+ public void testEquals3() {
+ e1 = LostEventDeclaration.INSTANCE;
+ assertEquals(e1, e1);
+ }
+
+ @Test
+ public void testEquals4() {
+ e1 = LostEventDeclaration.INSTANCE;
+ e2 = LostEventDeclaration.INSTANCE;
+ assertEquals(e1, e2);
+ }
+
+ @Test
+ public void testEquals5() {
+ e1 = LostEventDeclaration.INSTANCE;
+ e2 = new EventDeclaration();
+ assertFalse(e1.equals(e2));
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderCompactDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderLargeDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Event header declaration tests
+ *
+ * @author Matthew Khouzam
+ *
+ */
+public class EventHeaderDeclarationTest {
+
+ private static final int ID = 2222;
+ private static final int TIMESTAMP = 1000;
+ private static final int VALID_LARGE = 1;
+ private static final int VALID_COMPACT = 0;
+
+ private final List<StructDeclaration> declarations = new ArrayList<>();
+
+ /**
+ * Setup
+ */
+ @Before
+ public void init() {
+ declarations.clear();
+
+ /**
+ * do not reflow
+ *
+ * <pre>
+ * struct event_header_compact {
+ * enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
+ * variant <id> {
+ * struct {
+ * uint27_clock_monotonic_t timestamp;
+ * } compact;
+ * struct {
+ * uint32_t id;
+ * uint64_clock_monotonic_t timestamp;
+ * } extended;
+ * } v;
+ * } align(8);
+ * </pre>
+ */
+
+ StructDeclaration base = new StructDeclaration(8);
+ EnumDeclaration enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ enumDec.add(0, 30, "compact");
+ enumDec.add(31, 31, "extended");
+ base.addField("id", enumDec);
+ VariantDeclaration variantV = new VariantDeclaration();
+ StructDeclaration compact = new StructDeclaration(1);
+ compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ variantV.addField("compact", compact);
+ StructDeclaration large = new StructDeclaration(1);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ /**
+ * Do not reflow
+ *
+ * <pre>
+ * struct event_header_large {
+ * enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
+ * variant <id> {
+ * struct {
+ * uint32_clock_monotonic_t timestamp;
+ * } compact;
+ * struct {
+ * uint32_t id;
+ * uint64_clock_monotonic_t timestamp;
+ * } extended;
+ * } v;
+ * } align(8);
+ * </pre>
+ */
+
+ base = new StructDeclaration(8);
+ enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ enumDec.add(0, 65534, "compact");
+ enumDec.add(65535, 65535, "extended");
+ base.addField("id", enumDec);
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_32B_DECL);
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad - misnamed enum
+ base = new StructDeclaration(8);
+ enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ enumDec.add(0, 30, "compact");
+ enumDec.add(31, 31, "large");
+ base.addField("id", enumDec);
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(1);
+ compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(1);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad - missing enum
+ base = new StructDeclaration(8);
+ enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ enumDec.add(0, 30, "compact");
+ base.addField("id", enumDec);
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(1);
+ compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(1);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad - int 5 alignment 8 bit
+ base = new StructDeclaration(8);
+ enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8));
+ enumDec.add(0, 30, "compact");
+ enumDec.add(31, 31, "extended");
+ base.addField("id", enumDec);
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(1);
+ compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(1);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad - well, sounds nice though
+ base = new StructDeclaration(8);
+ base.addField("potato salad", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ base.addField("bbq ribs", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_16B_DECL));
+ base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
+ base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
+ variantV.addField("compact1", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp1", IntegerDeclaration.UINT_64B_DECL);
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
+ variantV.addField("compact", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
+ variantV.addField("compact", compact);
+ variantV.addField("surprise!", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_16B_DECL));
+ variantV = new VariantDeclaration();
+ compact = new StructDeclaration(8);
+ compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
+ variantV.addField("compact", compact);
+ variantV.addField("surprise!", compact);
+ large = new StructDeclaration(8);
+ large.addField("id", IntegerDeclaration.UINT_32B_DECL);
+ large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ variantV.addField("extended", large);
+ base.addField("v", variantV);
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", IntegerDeclaration.INT_32B_DECL);
+ base.addField("timestamp", IntegerDeclaration.INT_32B_DECL);
+ declarations.add(base);
+ // bad
+ base = new StructDeclaration(8);
+ base.addField("id", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
+ base.addField("timestamp", IntegerDeclaration.INT_32B_DECL);
+ declarations.add(base);
+ }
+
+ /**
+ * Validate a compact declaration
+ */
+ @Test
+ public void validateCompact() {
+ assertEquals(true, EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isCompactEventHeader(declarations.get(VALID_COMPACT)));
+ }
+
+ /**
+ * Fail if it validates
+ */
+ @Test
+ public void validateCompactFail() {
+ for (int i = 0; i < declarations.size(); i++) {
+ if (i == VALID_COMPACT) {
+ continue;
+ }
+ assertEquals(false, EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isCompactEventHeader(declarations.get(i)));
+ }
+ }
+
+ /**
+ * Validate a large declaration
+ */
+ @Test
+ public void validateLarge() {
+ assertEquals(true, EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isLargeEventHeader(declarations.get(VALID_LARGE)));
+ }
+
+ /**
+ * Fail if it validates
+ */
+ @Test
+ public void validateLargeFail() {
+ for (int i = 0; i < declarations.size(); i++) {
+ if (i == VALID_LARGE) {
+ continue;
+ }
+ assertEquals(false, EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isLargeEventHeader(declarations.get(i)));
+ }
+ }
+
+ /**
+ * Test an compact compact header
+ *
+ * @throws CTFException
+ * if {@link BitBuffer} is null
+ */
+ @Test
+ public void testCompactCompact() throws CTFException {
+ ByteBuffer buffer = ByteBuffer.allocate(16);
+ buffer.putInt(0x80000042);
+ byte[] validCompact1 = buffer.array();
+
+ EventHeaderCompactDeclaration decl = EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
+ final ByteBuffer input = ByteBuffer.wrap(validCompact1);
+ assertNotNull(input);
+ EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
+ assertNotNull(def);
+ assertEquals(16, def.getId());
+ assertEquals(0x42, def.getTimestamp());
+ }
+
+ /**
+ * Test an extended compact header
+ *
+ * @throws CTFException
+ * if {@link BitBuffer} is null
+ */
+ @Test
+ public void testCompactExtended() throws CTFException {
+ ByteBuffer buffer = ByteBuffer.allocate(16);
+ buffer.put((byte) 0xFF);
+ buffer.putInt(ID);
+ buffer.putLong(TIMESTAMP);
+ byte[] validCompact2 = buffer.array();
+
+ EventHeaderCompactDeclaration decl = EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
+ final ByteBuffer input = ByteBuffer.wrap(validCompact2);
+ assertNotNull(input);
+ EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
+ assertNotNull(def);
+ assertEquals(ID, def.getId());
+ assertEquals(TIMESTAMP, def.getTimestamp());
+ }
+
+ /**
+ * Test an compact large header
+ *
+ * @throws CTFException
+ * if {@link BitBuffer} is null
+ */
+ @Test
+ public void testLargeCompact() throws CTFException {
+ ByteBuffer buffer = ByteBuffer.allocate(16);
+ buffer.putShort((short) ID);
+ buffer.putInt(TIMESTAMP);
+ byte[] validLarge1 = buffer.array();
+
+ EventHeaderLargeDeclaration decl = EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
+ final ByteBuffer input = ByteBuffer.wrap(validLarge1);
+ assertNotNull(input);
+ EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
+ assertNotNull(def);
+ assertEquals(ID, def.getId());
+ assertEquals(TIMESTAMP, def.getTimestamp());
+ assertEquals(ID, ((IntegerDefinition) def.getDefinition("id")).getValue());
+ assertEquals(TIMESTAMP, ((IntegerDefinition) def.getDefinition("timestamp")).getValue());
+ }
+
+ /**
+ * Test an large large header
+ *
+ * @throws CTFException
+ * if {@link BitBuffer} is null
+ */
+ @Test
+ public void testLargeExtended() throws CTFException {
+ ByteBuffer buffer = ByteBuffer.allocate(16);
+ buffer.putShort((short) -1);
+ buffer.putInt(ID);
+ buffer.putLong(TIMESTAMP);
+ byte[] validLarge2 = buffer.array();
+
+ EventHeaderLargeDeclaration decl = EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
+ final ByteBuffer input = ByteBuffer.wrap(validLarge2);
+ assertNotNull(input);
+ EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
+ assertNotNull(def);
+ assertEquals(ID, def.getId());
+ assertEquals(TIMESTAMP, def.getTimestamp());
+ assertEquals(ID, ((IntegerDefinition) def.getDefinition("id")).getValue());
+ assertEquals(TIMESTAMP, ((IntegerDefinition) def.getDefinition("timestamp")).getValue());
+ }
+
+ /**
+ * Test maximum sizes, make sure they don't change unannounced
+ */
+ @Test
+ public void testMaxSizes() {
+ assertEquals(112, (EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN)).getMaximumSize());
+ assertEquals(104, (EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN)).getMaximumSize());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.junit.Test;
+
+@SuppressWarnings("javadoc")
+public class FloatDeclarationTest {
+ private FloatDeclaration fixture;
+
+ @Test
+ public void ctorTest() {
+ for (int i = 1; i < 20; i++) {
+ fixture = new FloatDeclaration(i, 32 - i, ByteOrder.nativeOrder(), 0);
+ assertNotNull(fixture);
+ }
+ }
+
+ @Test
+ public void getterTest() {
+ fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 1);
+ assertEquals(fixture.getAlignment(), 1);
+ assertEquals(fixture.getByteOrder(), ByteOrder.nativeOrder());
+ assertEquals(fixture.getExponent(), 8);
+ assertEquals(fixture.getMantissa(), 24);
+ }
+
+ @Test
+ public void toStringTest() {
+ fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
+ assertTrue(fixture.toString().contains("float"));
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ FloatDeclaration floatDeclaration = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
+ FloatDeclaration a = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
+ FloatDeclaration b = new FloatDeclaration(8, 24, ByteOrder.LITTLE_ENDIAN, 0);
+ assertEquals(a.hashCode(), floatDeclaration.hashCode());
+ assertNotEquals(b.hashCode(), floatDeclaration.hashCode());
+ assertEquals(floatDeclaration.hashCode(), floatDeclaration.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ FloatDeclaration a = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
+ FloatDeclaration b = new FloatDeclaration(8, 24, ByteOrder.LITTLE_ENDIAN, 0);
+ FloatDeclaration c = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 8);
+ FloatDeclaration d = new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 0);
+ FloatDeclaration e = new FloatDeclaration(24, 24, ByteOrder.BIG_ENDIAN, 0);
+ FloatDeclaration f = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertNotEquals(a, d);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertNotEquals(d, a);
+ assertNotEquals(e, a);
+ assertNotEquals(a, e);
+
+ assertEquals(a, f);
+ assertEquals(f, a);
+ assertEquals(a, a);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>IntegerDefinitionTest</code> contains tests for the class
+ * <code>{@link IntegerDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class FloatDefinitionTest {
+
+ private FloatDefinition fixture;
+ private FloatDefinition singleFixture;
+ private FloatDefinition doubleFixture; // all the way.
+ private FloatDeclaration parent;
+ @NonNull
+ private static final String fieldName = "float";
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * error creating floats
+ */
+ @Before
+ public void setUp() throws CTFException {
+ testFloat248();
+ testFloat5311();
+ }
+
+ @Test
+ public void testFloat248() throws CTFException {
+ parent = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
+ BitBuffer bb = create32BitFloatByteBuffer();
+ singleFixture = parent.createDefinition(null, fieldName, bb);
+ assertNotNull(singleFixture);
+ }
+
+ @Test
+ public void testFloat5311() throws CTFException {
+ parent = new FloatDeclaration(11, 53, ByteOrder.nativeOrder(), 0);
+ BitBuffer bb = create64BitFloatByteBuffer();
+ doubleFixture = parent.createDefinition(null, fieldName, bb);
+ assertNotNull(doubleFixture);
+ }
+
+ @Test
+ public void testFloat32Bit() throws CTFException {
+ for (int i = 1; i < 31; i++) {
+ parent = new FloatDeclaration(i, 32 - i, ByteOrder.nativeOrder(), 0);
+
+ fixture = parent.createDefinition(null, fieldName, create32BitFloatByteBuffer());
+ assertNotNull(fixture);
+ assertEquals("test" + i, "2.0", fixture.toString());
+ }
+ }
+
+ @Test
+ public void testFloat64Bit() throws CTFException {
+ for (int i = 1; i < 63; i++) {
+ parent = new FloatDeclaration(i, 64 - i, ByteOrder.nativeOrder(), 0);
+ fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer());
+ assertNotNull(fixture);
+ if (i <= 32) {
+ assertEquals("test" + i, "2.0", fixture.toString());
+ } else if (i == 33) {
+ assertEquals("test" + i, "1.0", fixture.toString());
+ } else {
+ assertNotNull(fixture.getValue());
+ }
+
+ }
+ }
+
+ @Test
+ public void testFloat48Bit() throws CTFException {
+ parent = new FloatDeclaration(12, 32, ByteOrder.nativeOrder(), 0);
+ fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer());
+ assertNotNull(fixture);
+ assertEquals(Double.NaN, fixture.getValue(), 0.1);
+ }
+
+ /**
+ * Run the IntegerDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ FloatDeclaration result = singleFixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getValue() method test.
+ */
+ @Test
+ public void testGetValue() {
+ double result = singleFixture.getValue();
+ assertEquals(2.0, result, 0.1);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = singleFixture.toString();
+ assertNotNull(result);
+ assertEquals("2.0", result);
+ }
+
+ @NonNull
+ private static BitBuffer create32BitFloatByteBuffer() {
+ float[] data = new float[2];
+ data[0] = 2.0f;
+ data[1] = 3.14f;
+ ByteBuffer byb = ByteBuffer.allocate(128);
+ byb.order(ByteOrder.nativeOrder());
+ byb.mark();
+ byb.putFloat(data[0]);
+ byb.putFloat(data[1]);
+ byb.reset();
+ BitBuffer bb = new BitBuffer(byb);
+ return bb;
+ }
+
+ @NonNull
+ private static BitBuffer create64BitFloatByteBuffer() {
+ double[] data = new double[2];
+ data[0] = 2.0f;
+ data[1] = 3.14f;
+ ByteBuffer byb = ByteBuffer.allocate(128);
+ byb.order(ByteOrder.nativeOrder());
+ byb.mark();
+ byb.putDouble(data[0]);
+ byb.putDouble(data[1]);
+ byb.reset();
+ BitBuffer bb = new BitBuffer(byb);
+ return bb;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle - Add min/maximum for validation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.math.BigInteger;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>IntegerDeclarationTest</code> contains tests for the class
+ * <code>{@link IntegerDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class IntegerDeclarationTest {
+
+ private IntegerDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
+ Encoding.ASCII, "", 32);
+ }
+
+ /**
+ * Run the IntegerDeclaration(int,boolean,int,ByteOrder,Encoding)
+ * constructor test.
+ */
+ @Test
+ public void testIntegerDeclaration() {
+ int len = 1;
+ boolean signed = false;
+ int base = 1;
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+ Encoding encoding = Encoding.ASCII;
+
+ IntegerDeclaration result = IntegerDeclaration.createDeclaration(len, signed, base,
+ byteOrder, encoding, "", 16);
+
+ assertNotNull(result);
+ assertEquals(1, result.getBase());
+ assertEquals(false, result.isCharacter());
+ String outputValue = "[declaration] integer[";
+ assertEquals(outputValue,
+ result.toString().substring(0, outputValue.length()));
+ assertEquals(1, result.getLength());
+ assertEquals(false, result.isSigned());
+ }
+
+ /**
+ * Test the factory part more rigorously to make sure there are no
+ * regressions
+ */
+ @Test
+ public void testIntegerDeclarationBruteForce() {
+ ByteOrder[] bos = { ByteOrder.LITTLE_ENDIAN, ByteOrder.BIG_ENDIAN };
+ Encoding[] encodings = { Encoding.ASCII, Encoding.NONE, Encoding.UTF8 };
+ boolean[] signeds = { true, false }; // not a real word
+ String[] clocks = { "something", "" };
+ int[] bases = { 2, 4, 6, 8, 10, 12, 16 };
+ for (int len = 2; len < 65; len++) {
+ for (ByteOrder bo : bos) {
+ for (boolean signed : signeds) {
+ for (int base : bases) {
+ for (Encoding enc : encodings) {
+ for (String clock : clocks) {
+ assertNotNull(enc);
+ assertNotNull(clock);
+ IntegerDeclaration intDec = IntegerDeclaration.createDeclaration(len, signed, base, bo, enc, clock, 8);
+ String title = Integer.toString(len) + " " + bo + " " + signed + " " + base + " " + enc;
+ assertEquals(title, signed, intDec.isSigned());
+ assertEquals(title, base, intDec.getBase());
+ // at len 8 le and be are the same
+ if (len != 8) {
+ assertEquals(title, bo, intDec.getByteOrder());
+ }
+ assertEquals(title, len, intDec.getLength());
+ assertEquals(title, len, intDec.getMaximumSize());
+ assertEquals(title, clock, intDec.getClock());
+ assertEquals(title, !signed && len == 8, intDec.isUnsignedByte());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Run the int getBase() method test.
+ */
+ @Test
+ public void testGetBase() {
+ int result = fixture.getBase();
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the ByteOrder getByteOrder() method test.
+ */
+ @Test
+ public void testGetByteOrder() {
+ ByteOrder result = fixture.getByteOrder();
+ assertNotNull(result);
+ assertEquals("BIG_ENDIAN", result.toString());
+ }
+
+ /**
+ * Run the Encoding getEncoding() method test.
+ */
+ @Test
+ public void testGetEncoding() {
+ Encoding result = fixture.getEncoding();
+ assertNotNull(result);
+ assertEquals("ASCII", result.name());
+ assertEquals("ASCII", result.toString());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the int getLength() method test.
+ */
+ @Test
+ public void testGetLength() {
+ int result = fixture.getLength();
+ assertEquals(1, result);
+ }
+
+ /**
+ * Run the boolean isCharacter() method test.
+ */
+ @Test
+ public void testIsCharacter() {
+ boolean result = fixture.isCharacter();
+ assertEquals(false, result);
+ }
+
+ /**
+ * Run the boolean isCharacter() method test.
+ */
+ @Test
+ public void testIsCharacter_8bytes() {
+ IntegerDeclaration fixture8 = IntegerDeclaration.createDeclaration(8, true, 1,
+ ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
+
+ boolean result = fixture8.isCharacter();
+ assertEquals(true, result);
+ }
+
+ /**
+ * Run the boolean isSigned() method test.
+ */
+ @Test
+ public void testIsSigned_signed() {
+ IntegerDeclaration fixtureSigned = IntegerDeclaration.createDeclaration(2, true,
+ 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
+ boolean result = fixtureSigned.isSigned();
+ assertEquals(true, result);
+ }
+
+ /**
+ * Run the boolean isSigned() method test.
+ */
+ @Test
+ public void testIsSigned_unsigned() {
+ boolean result = fixture.isSigned();
+ assertEquals(false, result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ String trunc = result.substring(0, 22);
+ assertEquals("[declaration] integer[", trunc);
+ }
+
+ /**
+ * Run the long getMaxValue() method test.
+ */
+ @Test
+ public void testMaxValue() {
+ assertEquals(BigInteger.ONE, fixture.getMaxValue());
+
+ IntegerDeclaration signed8bit = IntegerDeclaration.createDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(127), signed8bit.getMaxValue());
+
+ IntegerDeclaration unsigned8bit = IntegerDeclaration.createDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(255), unsigned8bit.getMaxValue());
+
+ IntegerDeclaration signed32bit = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(2147483647), signed32bit.getMaxValue());
+
+ IntegerDeclaration unsigned32bit = IntegerDeclaration.createDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(4294967295l), unsigned32bit.getMaxValue());
+
+ IntegerDeclaration signed64bit = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(9223372036854775807L), signed64bit.getMaxValue());
+
+ IntegerDeclaration unsigned64bit = IntegerDeclaration.createDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(2).pow(64).subtract(BigInteger.ONE), unsigned64bit.getMaxValue());
+ }
+
+ /**
+ * Run the long getMinValue() method test.
+ */
+ @Test
+ public void testMinValue() {
+ assertEquals(BigInteger.ZERO, fixture.getMinValue());
+
+ IntegerDeclaration signed8bit = IntegerDeclaration.createDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(-128), signed8bit.getMinValue());
+
+ IntegerDeclaration unsigned8bit = IntegerDeclaration.createDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.ZERO, unsigned8bit.getMinValue());
+
+ IntegerDeclaration signed32bit = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(-2147483648), signed32bit.getMinValue());
+
+ IntegerDeclaration unsigned32bit = IntegerDeclaration.createDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.ZERO, unsigned32bit.getMinValue());
+
+ IntegerDeclaration signed64bit = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.valueOf(-9223372036854775808L), signed64bit.getMinValue());
+
+ IntegerDeclaration unsigned64bit = IntegerDeclaration.createDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
+ assertEquals(BigInteger.ZERO, unsigned64bit.getMinValue());
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ IntegerDeclaration a = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration i = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ assertEquals(a.hashCode(), i.hashCode());
+ assertEquals(a.hashCode(), a.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ IntegerDeclaration a = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration b = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration c = IntegerDeclaration.createDeclaration(32, true, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration d = IntegerDeclaration.createDeclaration(32, false, 16, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration e = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 32);
+ IntegerDeclaration f = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "", 32);
+ IntegerDeclaration g = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "hi", 32);
+ IntegerDeclaration h = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 16);
+ IntegerDeclaration i = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertNotEquals(a, d);
+ assertNotEquals(a, e);
+ assertNotEquals(a, f);
+ assertNotEquals(a, g);
+ assertNotEquals(a, h);
+ assertEquals(a, i);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertNotEquals(d, a);
+ assertNotEquals(e, a);
+ assertNotEquals(f, a);
+ assertNotEquals(g, a);
+ assertNotEquals(h, a);
+ assertEquals(i, a);
+ assertEquals(a, a);
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>IntegerDefinitionTest</code> contains tests for the class
+ * <code>{@link IntegerDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class IntegerDefinitionTest {
+
+ private IntegerDefinition fixture;
+ @NonNull private static final String NAME = "testInt";
+ @NonNull private static final String clockName = "clock";
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * won't happen
+ */
+ @Before
+ public void setUp() throws CTFException {
+ IntegerDeclaration id = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
+ ByteBuffer byb = ByteBuffer.allocate(128);
+ byb.mark();
+ byb.putInt(1);
+ byb.reset();
+ BitBuffer bb = new BitBuffer(byb);
+ fixture = id.createDefinition(null, NAME, bb);
+ }
+
+ /**
+ * Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testIntegerDefinition() {
+ IntegerDeclaration declaration = IntegerDeclaration.createDeclaration(1, false, 1,
+ ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
+ IDefinitionScope definitionScope = null;
+ String fieldName = "";
+
+ IntegerDefinition result = new IntegerDefinition(declaration,
+ definitionScope, fieldName, 1);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the IntegerDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ IntegerDeclaration result = fixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getValue() method test.
+ */
+ @Test
+ public void testGetValue() {
+ long result = fixture.getValue();
+ assertEquals(0L, result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ assertEquals("0", result);
+ }
+
+ /**
+ * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+ * for unsigned values.
+ */
+ @Test
+ public void testFormatNumber_unsignedLong() {
+
+ long unsignedLongValue = -64;
+ String result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ // -64 + 2^64 = 18446744073709551552
+ assertEquals("18446744073709551552", result);
+
+ unsignedLongValue = -131940199973272L;
+ result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ // -131940199973272l + 2^64 = 18446612133509578344
+ assertEquals("18446612133509578344", result);
+
+ unsignedLongValue = 123456789L;
+ result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
+ assertEquals("123456789", result);
+ }
+
+ /**
+ * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
+ * for signed values.
+ */
+ @Test
+ public void testFormatNumber_signedLong() {
+ long signedValue = -64L;
+ String result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("-64", result);
+
+ signedValue = -131940199973272L;
+ result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("-131940199973272", result);
+
+ signedValue = 123456789L;
+ result = IntegerDefinition.formatNumber(signedValue, 10, true);
+ assertEquals("123456789", result);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 École Polytechnique de Montréal, Ericsson
+ *
+ * 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:
+ * Geneviève Bastien - Initial API and implementation
+ * Alexandre Montplaisir - Split out in separate class
+ * Matthew Khouzam - update api (exceptions)
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Endianness test for {@link IntegerDefinition}.
+ *
+ * @author Geneviève Bastien
+ */
+public class IntegerEndiannessTest {
+
+ private static final @NonNull String name = "testInt";
+ private static final @NonNull String clockName = "clock";
+
+ private ByteBuffer bb;
+
+ private @NonNull BitBuffer input = new BitBuffer();
+
+ /**
+ * Set up the bit-buffer to be used
+ */
+ @Before
+ public void setUp() {
+ bb = java.nio.ByteBuffer.allocateDirect(8);
+ final ByteBuffer byb = bb;
+ if (byb == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ bb.put((byte) 0xab);
+ bb.put((byte) 0xcd);
+ bb.put((byte) 0xef);
+ bb.put((byte) 0x12);
+ bb.put((byte) 0x34);
+ bb.put((byte) 0x56);
+ bb.put((byte) 0x78);
+ bb.put((byte) 0x9a);
+
+ input = new BitBuffer(byb);
+ }
+
+ /**
+ * Read 32-bits BE
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void test32BE() throws CTFException {
+ IntegerDeclaration be = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
+ IntegerDefinition fixture_be = be.createDefinition(null, name, input);
+ assertEquals(0xabcdef12, fixture_be.getValue());
+ }
+
+ /**
+ * Read 64-bits BE
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void test64BE() throws CTFException {
+ IntegerDeclaration be = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
+ IntegerDefinition fixture_be = be.createDefinition(null, name, input);
+ assertEquals(0xabcdef123456789aL, fixture_be.getValue());
+ }
+
+ /**
+ * Read 32-bits LE
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void test32LE() throws CTFException {
+ IntegerDeclaration le = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8);
+ IntegerDefinition fixture_le = le.createDefinition(null, name, input);
+ assertEquals(0x12efcdab, fixture_le.getValue());
+ }
+
+ /**
+ * Read 64-bits LE
+ *
+ * @throws CTFException
+ * error
+ */
+ @Test
+ public void test64LE() throws CTFException {
+ IntegerDeclaration le = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8);
+ IntegerDefinition fixture_le = le.createDefinition(null, name, input);
+ assertEquals(0x9a78563412efcdabL, fixture_le.getValue());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>SequenceDeclarationTest</code> contains tests for the class
+ * <code>{@link SequenceDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class SequenceDeclaration2Test {
+
+ @NonNull
+ private static final String FIELD_NAME = "LengthName";
+
+ private SequenceDeclaration fixture;
+ @NonNull
+ private BitBuffer input = new BitBuffer();
+
+ @Before
+ public void setUp() {
+ fixture = new SequenceDeclaration(FIELD_NAME, StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ byte array[] = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
+ ByteBuffer byb = ByteBuffer.wrap(array);
+ if (byb == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ input = new BitBuffer(byb);
+ }
+
+ /**
+ * Run the SequenceDeclaration(String,Declaration) constructor test.
+ */
+ @Test
+ public void testSequenceDeclaration() {
+ String lengthName = "";
+ IDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+
+ SequenceDeclaration result = new SequenceDeclaration(lengthName, elemType);
+ assertNotNull(result);
+ String string = "[declaration] sequence[";
+ assertEquals(string, result.toString().substring(0, string.length()));
+ }
+
+ /**
+ * Run the SequenceDefinition createDefinition(DefinitionScope,String)
+ * method test.
+ *
+ * @throws CTFException
+ * an error in the bitbuffer
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ long seqLen = 2;
+ IntegerDeclaration id = IntegerDeclaration.createDeclaration(8, false, 8,
+ ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 32);
+ StructDeclaration structDec = new StructDeclaration(0);
+ structDec.addField(FIELD_NAME, id);
+ StructDefinition structDef = new StructDefinition(
+ structDec,
+ null,
+ "x",
+ new Definition[] {
+ new IntegerDefinition(
+ id,
+ null,
+ FIELD_NAME,
+ seqLen)
+ });
+ AbstractArrayDefinition result = fixture.createDefinition(structDef, FIELD_NAME, input);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Declaration getElementType() method test.
+ */
+ @Test
+ public void testGetElementType() {
+ IDeclaration result = fixture.getElementType();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ String left = "[declaration] sequence[";
+ assertEquals(left, result.substring(0, left.length()));
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ assertEquals(-1140774256, fixture.hashCode());
+ SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
+ SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL);
+ SequenceDeclaration c = new SequenceDeclaration("Hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
+ assertNotEquals(a.hashCode(), b.hashCode());
+ assertNotEquals(a.hashCode(), c.hashCode());
+ assertEquals(a.hashCode(), d.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
+ SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL);
+ SequenceDeclaration c = new SequenceDeclaration("Hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertEquals(a, d);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertEquals(d, a);
+ assertEquals(a, a);
+ assertFalse(a.isBinaryEquivalent(b));
+ assertFalse(a.isBinaryEquivalent(c));
+ assertTrue(a.isBinaryEquivalent(d));
+ assertFalse(b.isBinaryEquivalent(a));
+ assertFalse(c.isBinaryEquivalent(a));
+ assertTrue(d.isBinaryEquivalent(a));
+ assertTrue(a.isBinaryEquivalent(a));
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ByteArrayDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>SequenceDefinition2Test</code> contains tests for the class
+ * <code>{@link SequenceDefinition2}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@SuppressWarnings("javadoc")
+public class SequenceDefinition2Test {
+
+ private ByteArrayDefinition fixture;
+ private final static int seqLen = 15;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ */
+ @Before
+ public void setUp() throws CTFException {
+ fixture = initString();
+ }
+
+ private static ByteArrayDefinition initString() throws CTFException {
+ StructDeclaration structDec;
+ StructDefinition structDef;
+
+ int len = 8;
+ IntegerDeclaration id = IntegerDeclaration.createDeclaration(len, false, len,
+ ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 8);
+ String lengthName = "LengthName";
+ structDec = new StructDeclaration(0);
+ structDec.addField(lengthName, id);
+
+ structDef = new StructDefinition(structDec, null, "x", new Definition[] { new IntegerDefinition(id, null, lengthName, seqLen) });
+
+ SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
+ ByteBuffer allocateDirect = java.nio.ByteBuffer.allocateDirect(seqLen * len);
+ if( allocateDirect == null){
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer input = new BitBuffer(allocateDirect);
+ for (int i = 0; i < seqLen; i++) {
+ input.putInt(i);
+ }
+
+ ByteArrayDefinition ret = (ByteArrayDefinition) sd.createDefinition(structDef, "TestX", input);
+ assertNotNull(ret);
+ return ret;
+ }
+
+ /**
+ * Run the FixedStringDefinition(SequenceDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testFixedStringDefinition() {
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Run the SequenceDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ SequenceDeclaration result = (SequenceDeclaration) fixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Definition getElem(int) method test.
+ */
+ @Test
+ public void testGetElem() {
+ int i = 1;
+ IDefinition result = fixture.getDefinitions().get(i);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ assertNotNull(result);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StringDeclarationTest</code> contains tests for the class
+ * <code>{@link StringDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class StringDeclarationTest {
+
+ private StringDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = StringDeclaration.getStringDeclaration(Encoding.ASCII);
+ }
+
+ /**
+ * Run the StringDeclaration() constructor test.
+ */
+ @Test
+ public void testStringDeclaration() {
+ StringDeclaration result = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+
+ assertNotNull(result);
+ String string = "[declaration] string[";
+ assertEquals(string, result.toString().substring(0, string.length()));
+ }
+
+ /**
+ * Run the StringDeclaration(Encoding) constructor test.
+ */
+ @Test
+ public void testStringDeclaration_2() {
+ Encoding encoding = Encoding.ASCII;
+ StringDeclaration result = StringDeclaration.getStringDeclaration(encoding);
+
+ assertNotNull(result);
+ String string = "[declaration] string[";
+ assertEquals(string, result.toString().substring(0, string.length()));
+ }
+
+ /**
+ * Run the StringDefinition createDefinition(DefinitionScope,String) method
+ * test.
+ *
+ * @throws CTFException
+ * out of buffer exception
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ IDefinitionScope definitionScope = null;
+ String fieldName = "id";
+ ByteBuffer allocate = ByteBuffer.allocate(100);
+ if (allocate == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer bb = new BitBuffer(allocate);
+ StringDefinition result = fixture.createDefinition(definitionScope,
+ fieldName, bb);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Encoding getEncoding() method test.
+ */
+ @Test
+ public void testGetEncoding() {
+ Encoding result = fixture.getEncoding();
+
+ assertNotNull(result);
+ assertEquals("ASCII", result.name());
+ assertEquals("ASCII", result.toString());
+ assertEquals(1, result.ordinal());
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ String left = "[declaration] string[";
+ String right = result.substring(0, left.length());
+
+ assertEquals(left, right);
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ assertEquals(32, fixture.hashCode());
+ StringDeclaration a = StringDeclaration.getStringDeclaration(Encoding.ASCII);
+ StringDeclaration b = StringDeclaration.getStringDeclaration();
+ StringDeclaration c = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ StringDeclaration d = StringDeclaration.getStringDeclaration(Encoding.ASCII);
+ assertEquals(b.hashCode(), c.hashCode());
+ assertEquals(a.hashCode(), d.hashCode());
+ assertEquals(a.hashCode(), a.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ StringDeclaration a = StringDeclaration.getStringDeclaration(Encoding.ASCII);
+ StringDeclaration b = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ StringDeclaration c = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ StringDeclaration d = StringDeclaration.getStringDeclaration(Encoding.ASCII);
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertEquals(a, d);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertEquals(d, a);
+ assertEquals(a, a);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StringDefinitionTest</code> contains tests for the class
+ * <code>{@link StringDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class StringDefinitionTest {
+
+ private StringDefinition fixture;
+ private String testString;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * won't happen
+ */
+ @Before
+ public void setUp() throws CTFException {
+ String name = "testString";
+ StringDeclaration stringDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ ByteBuffer byteBuffer = ByteBuffer.allocate(100);
+ if (byteBuffer == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer bb = new BitBuffer(byteBuffer);
+ byteBuffer.mark();
+ testString = new String("testString");
+ byteBuffer.put(testString.getBytes());
+ byteBuffer.reset();
+ fixture = stringDec.createDefinition(null, name, bb);
+ }
+
+ /**
+ * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
+ * constructor test.
+ */
+ @Test
+ public void testStringDefinition() {
+ StringDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ IDefinitionScope definitionScope = null;
+ String fieldName = "";
+
+ StringDefinition result = new StringDefinition(declaration,
+ definitionScope, fieldName, "");
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StringDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ StringDeclaration result = fixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getValue() method test.
+ */
+ @Test
+ public void testGetValue() {
+ String result = fixture.getValue();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String setValue() method test.
+ */
+ @Test
+ public void testSetValue() {
+
+ String result = fixture.getValue();
+ assertNotNull(result);
+ assertEquals("testString", result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ assertNotNull(result);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StructDeclarationTest</code> contains tests for the class
+ * <code>{@link StructDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class StructDeclarationTest {
+
+ private StructDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new StructDeclaration(1L);
+ }
+
+ /**
+ * Run the StructDeclaration(long) constructor test.
+ */
+ @Test
+ public void testStructDeclaration() {
+ assertNotNull(fixture);
+ assertEquals(1L, fixture.getMaxAlign());
+
+ String regex = "^\\[declaration\\] struct\\[*.\\]$";
+ assertTrue(fixture.toString().matches(regex));
+ }
+
+ /**
+ * Run the void addField(String,Declaration) method test.
+ */
+ @Test
+ public void testAddField() {
+ String name = "";
+ IDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ fixture.addField(name, declaration);
+ }
+
+ /**
+ * Run the StructDefinition createDefinition(DefinitionScope,String) method
+ * test.
+ *
+ * @throws CTFException
+ * out of bounds
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ String fieldName = "";
+ ByteBuffer allocate = ByteBuffer.allocate(100);
+ if (allocate == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer bb = new BitBuffer(allocate);
+ StructDefinition result = fixture.createDefinition(null, fieldName, bb);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Declaration getField(String) method test.
+ */
+ @Test
+ public void testGetField() {
+ IDeclaration result = fixture.getField("test");
+
+ assertNull(result);
+ }
+
+ /**
+ * Run the List<String> getFieldsList() method test.
+ */
+ @Test
+ public void testGetFieldsList() {
+ Iterable<String> result = fixture.getFieldsList();
+
+ assertNotNull(result);
+ assertEquals(false, result.iterator().hasNext());
+ }
+
+ /**
+ * Run the long getMinAlign() method test.
+ */
+ @Test
+ public void testGetMinAlign() {
+ long result = fixture.getMaxAlign();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the boolean hasField(String) method test.
+ */
+ @Test
+ public void testHasField() {
+ String name = "";
+ boolean result = fixture.hasField(name);
+
+ assertEquals(false, result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ String trunc = result.substring(0, 21);
+
+ assertEquals("[declaration] struct[", trunc);
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ assertEquals(32, fixture.hashCode());
+ StructDeclaration a = new StructDeclaration(8);
+ fixture.addField("hello", a);
+ a.addField("Time", IntegerDeclaration.INT_32B_DECL);
+ StructDeclaration b = new StructDeclaration(8);
+ StructDeclaration c = new StructDeclaration(8);
+ b.addField("hello", c);
+ c.addField("Time", IntegerDeclaration.INT_32B_DECL);
+ assertEquals(b.hashCode(), fixture.hashCode());
+ c.addField("Space", IntegerDeclaration.INT_32L_DECL);
+ assertNotEquals(b.hashCode(), fixture.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ StructDeclaration a = new StructDeclaration(8);
+ StructDeclaration b = new StructDeclaration(16);
+ StructDeclaration c = new StructDeclaration(8);
+ StructDeclaration d = new StructDeclaration(8);
+ StructDeclaration e = new StructDeclaration(8);
+ StructDeclaration f = new StructDeclaration(8);
+ c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertEquals(a, d);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertEquals(d, a);
+ assertEquals(a, a);
+ a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ f.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ e.addField("hello", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ assertEquals(a, c);
+ assertEquals(c, a);
+ assertNotEquals(a, d);
+ d.addField("hi", IntegerDeclaration.INT_32B_DECL);
+ assertNotEquals(a, d);
+ a.addField("hello", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ e.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ f.addField("hello", IntegerDeclaration.INT_32B_DECL);
+ assertNotEquals(a, e);
+ assertNotEquals(a, f);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.io.Util;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>StructDefinitionTest</code> contains tests for the class
+ * <code>{@link StructDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class StructDefinitionTest {
+
+ private static final @NonNull String TEST_STRUCT_ID = "testStruct";
+ private static final @NonNull String ENUM_2 = "y";
+ private static final @NonNull String ENUM_1 = "x";
+ private static final @NonNull String TAG_ID = "Tag";
+ private static final @NonNull String INT_ID = "_id";
+ private static final @NonNull String STRING_ID = "_args";
+ private static final @NonNull String ENUM_ID = "_enumArgs";
+ private static final @NonNull String SEQUENCE_ID = "_seq";
+ private static final @NonNull String LENGTH_SEQ = "_len";
+ private static final @NonNull String VAR_FIELD_NAME = "SomeVariant";
+
+ private StructDefinition fixture;
+ private StructDefinition emptyStruct;
+ private StructDefinition simpleStruct;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws CTFException
+ * won't happen
+ */
+ @Before
+ public void setUp() throws CTFException {
+ StructDeclaration sDec = new StructDeclaration(12);
+ IntegerDeclaration id = IntegerDeclaration.INT_32B_DECL;
+ IntegerDeclaration lenDec = IntegerDeclaration.UINT_8_DECL;
+ StringDeclaration sd = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ EnumDeclaration ed = new EnumDeclaration(id);
+ SequenceDeclaration seqDec = new SequenceDeclaration(LENGTH_SEQ, id);
+ VariantDeclaration varDec = new VariantDeclaration();
+ EnumDeclaration tagDec = new EnumDeclaration(id);
+ tagDec.add(0, 1, ENUM_1);
+ tagDec.add(2, 3, ENUM_2);
+ varDec.addField(ENUM_2, id);
+ varDec.addField(ENUM_1, sd);
+ varDec.setTag(TAG_ID);
+ sDec.addField(INT_ID, id);
+ sDec.addField(STRING_ID, sd);
+ sDec.addField(ENUM_ID, ed);
+ sDec.addField(TAG_ID, tagDec);
+ sDec.addField(LENGTH_SEQ, lenDec);
+ sDec.addField(SEQUENCE_ID, seqDec);
+ sDec.addField(VAR_FIELD_NAME, varDec);
+ byte bytes[] = new byte[100];
+ bytes[4] = 1;
+ bytes[8] = 2;
+ bytes[13] = 3;
+ BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(bytes)));
+ fixture = sDec.createDefinition(null, TEST_STRUCT_ID, bb);
+ EnumDefinition eDef = tagDec.createDefinition(fixture, TAG_ID, bb);
+ assertNotNull(eDef);
+ VariantDefinition vd = varDec.createDefinition(fixture, VAR_FIELD_NAME, bb);
+ assertNotNull(vd);
+ // Create an empty struct
+ StructDeclaration esDec = new StructDeclaration(32);
+ emptyStruct = esDec.createDefinition(null, TEST_STRUCT_ID, bb);
+
+ // Create a simple struct with two items
+ StructDeclaration ssDec = new StructDeclaration(32);
+ ssDec.addField(INT_ID, id);
+ ssDec.addField(STRING_ID, sd);
+ simpleStruct = ssDec.createDefinition(null, TEST_STRUCT_ID, bb);
+ }
+
+ /**
+ * Run the StructDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ StructDeclaration result = fixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the HashMap<String, Definition> getDefinitions() method test.
+ */
+ @Test
+ public void testGetDefinitions_1() {
+ IDefinition result = fixture.getDefinition("_id");
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the ArrayDefinition lookupArray(String) method test.
+ */
+ @Test
+ public void testLookupArray() {
+ String name = INT_ID;
+ AbstractArrayDefinition result = fixture.lookupArrayDefinition(name);
+ assertNull(result);
+ }
+
+ /**
+ * Run the Definition lookupDefinition(String) method test.
+ */
+ @Test
+ public void testLookupDefinition() {
+ String lookupPath = "args";
+ IDefinition result = fixture.lookupDefinition(lookupPath);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the EnumDefinition lookupEnum(String) method test.
+ */
+ @Test
+ public void testLookupEnum() {
+ String name = ENUM_ID;
+ EnumDefinition result = fixture.lookupEnum(name);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the IntegerDefinition lookupInteger(String) method test.
+ */
+ @Test
+ public void testLookupInteger_1() {
+ String name = "_id";
+ IntegerDefinition result = fixture.lookupInteger(name);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the IntegerDefinition lookupInteger(String) method test.
+ */
+ @Test
+ public void testLookupInteger_2() {
+ String name = VAR_FIELD_NAME;
+ IntegerDefinition result = fixture.lookupInteger(name);
+ assertNull(result);
+ }
+
+ /**
+ * Run the SequenceDefinition lookupSequence(String) method test.
+ */
+ @Test
+ public void testLookupFixedStringDefinition() {
+ String name = SEQUENCE_ID;
+ AbstractArrayDefinition result = fixture.lookupArrayDefinition(name);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the StringDefinition lookupString(String) method test.
+ */
+ @Test
+ public void testLookupString() {
+ String name = VAR_FIELD_NAME;
+ StringDefinition result = fixture.lookupString(name);
+
+ assertNull(result);
+ }
+
+ /**
+ * Run the StructDefinition lookupStruct(String) method test.
+ */
+ @Test
+ public void testLookupStruct() {
+ String name = VAR_FIELD_NAME;
+ StructDefinition result = fixture.lookupStruct(name);
+
+ assertNull(result);
+ }
+
+ /**
+ * Run the VariantDefinition lookupVariant(String) method test.
+ */
+ @Test
+ public void testLookupVariant() {
+ String name = VAR_FIELD_NAME;
+ VariantDefinition result = fixture.lookupVariant(name);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ assertNotNull(result);
+
+ result = emptyStruct.toString();
+ assertEquals("{ }", result);
+
+ result = simpleStruct.toString();
+ assertEquals("{ _id = 0, _args = \"\" }", result);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ ArrayDeclaration2Test.class,
+ ArrayDefinition2Test.class,
+ DefinitionTest.class,
+ EnumDeclarationTest.class,
+ EnumDefinitionTest.class,
+ EventDeclarationTest.class,
+ EventHeaderDeclarationTest.class,
+ FloatDeclarationTest.class,
+ FloatDefinitionTest.class,
+ IntegerDeclarationTest.class,
+ IntegerDefinitionTest.class,
+ IntegerEndiannessTest.class,
+ SequenceDeclaration2Test.class,
+ SequenceDefinition2Test.class,
+ StringDeclarationTest.class,
+ StringDefinitionTest.class,
+ StructDeclarationTest.class,
+ StructDefinitionTest.class,
+ VariantDeclarationTest.class,
+ VariantDefinitionTest.class,
+})
+public class TestAll {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>VariantDeclarationTest</code> contains tests for the class
+ * <code>{@link VariantDeclaration}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class VariantDeclarationTest {
+
+ private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
+
+ private VariantDeclaration fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new VariantDeclaration();
+ }
+
+ private static IDefinitionScope createDefinitionScope() throws CTFException {
+ assumeTrue(testTrace.exists());
+ StructDeclaration declaration = new StructDeclaration(8);
+ VariantDeclaration variantDeclaration = new VariantDeclaration();
+ variantDeclaration.addField("a", IntegerDeclaration.INT_32B_DECL);
+ variantDeclaration.addField("b", IntegerDeclaration.INT_32L_DECL);
+ variantDeclaration.setTag("a");
+
+ EnumDeclaration enumDeclaration = new EnumDeclaration(IntegerDeclaration.UINT_8_DECL);
+ enumDeclaration.add(0, 1, "a");
+ enumDeclaration.add(2, 2, "b");
+ declaration.addField("tag", enumDeclaration);
+ declaration.addField("variant", variantDeclaration);
+ EnumDefinition tagDef = new EnumDefinition(
+ enumDeclaration,
+ null,
+ "tag",
+ new IntegerDefinition(
+ IntegerDeclaration.UINT_8_DECL,
+ null,
+ "test",
+ 0)
+ );
+ VariantDefinition variantDefinition = new VariantDefinition(
+ variantDeclaration,
+ testTrace.getTrace(),
+ "tag",
+ "tag",
+ new StringDefinition(
+ StringDeclaration.getStringDeclaration(Encoding.UTF8),
+ null,
+ "f",
+ "tag"
+ ));
+
+ IDefinitionScope definitionScope = new StructDefinition(
+ declaration,
+ variantDefinition,
+ "",
+ new Definition[] { tagDef, variantDefinition }
+ );
+
+ return definitionScope;
+ }
+
+ /**
+ * Run the VariantDeclaration() constructor test.
+ */
+ @Test
+ public void testVariantDeclaration() {
+ assertNotNull(fixture);
+ assertEquals(false, fixture.isTagged());
+ String left = "[declaration] variant[";
+ assertEquals(left, fixture.toString().substring(0, left.length()));
+ }
+
+ /**
+ * Run the void addField(String,Declaration) method test.
+ */
+ @Test
+ public void testAddField() {
+ fixture.setTag("");
+ String tag = "";
+ IDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ fixture.addField(tag, declaration);
+ }
+
+ /**
+ * Run the VariantDefinition createDefinition(DefinitionScope,String) method
+ * test.
+ *
+ * @throws CTFException
+ * Should not happen
+ */
+ @Test
+ public void testCreateDefinition() throws CTFException {
+ fixture.setTag("tag");
+ fixture.addField("a", IntegerDeclaration.UINT_64B_DECL);
+ IDefinitionScope definitionScope = createDefinitionScope();
+ String fieldName = "";
+ ByteBuffer allocate = ByteBuffer.allocate(100);
+ if (allocate == null) {
+ throw new IllegalStateException("Failed to allocate memory");
+ }
+ BitBuffer bb = new BitBuffer(allocate);
+ VariantDefinition result = fixture.createDefinition(definitionScope, fieldName, bb);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the boolean hasField(String) method test.
+ */
+ @Test
+ public void testHasField() {
+ fixture.setTag("");
+ String tag = "";
+ boolean result = fixture.hasField(tag);
+
+ assertEquals(false, result);
+ }
+
+ /**
+ * Run the boolean isTagged() method test.
+ */
+ @Test
+ public void testIsTagged() {
+ fixture.setTag("");
+ boolean result = fixture.isTagged();
+
+ assertEquals(true, result);
+ }
+
+ /**
+ * Run the boolean isTagged() method test.
+ */
+ @Test
+ public void testIsTagged_null() {
+ fixture.setTag((String) null);
+ boolean result = fixture.isTagged();
+
+ assertEquals(false, result);
+ }
+
+ /**
+ * Run the void setTag(String) method test.
+ */
+ @Test
+ public void testSetTag() {
+ fixture.setTag("");
+ String tag = "";
+ fixture.setTag(tag);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ fixture.setTag("");
+ String result = fixture.toString();
+ String left = "[declaration] variant[";
+ String right = result.substring(0, left.length());
+
+ assertEquals(left, right);
+ }
+
+ /**
+ * Test the hashcode
+ */
+ @Test
+ public void hashcodeTest() {
+ VariantDeclaration a = new VariantDeclaration();
+ assertEquals(fixture.hashCode(), a.hashCode());
+
+ VariantDeclaration b = new VariantDeclaration();
+ b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ VariantDeclaration c = new VariantDeclaration();
+ c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ assertEquals(b.hashCode(), c.hashCode());
+ }
+
+ /**
+ * Test the equals
+ */
+ @Test
+ public void equalsTest() {
+ VariantDeclaration a = new VariantDeclaration();
+ VariantDeclaration b = new VariantDeclaration();
+ b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ VariantDeclaration c = new VariantDeclaration();
+ c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ VariantDeclaration d = new VariantDeclaration();
+ assertNotEquals(a, null);
+ assertNotEquals(a, new Object());
+ assertNotEquals(a, b);
+ assertNotEquals(a, c);
+ assertEquals(a, d);
+ assertEquals(a, a);
+ assertEquals(b, c);
+ assertNotEquals(b, a);
+ assertNotEquals(c, a);
+ assertEquals(d, a);
+ assertEquals(c, b);
+ b.setTag("hi");
+ assertNotEquals(b, c);
+ c.setTag("Hello");
+ assertNotEquals(b, c);
+ c.setTag("hi");
+ assertEquals(b, c);
+ b.addField("hello", IntegerDeclaration.INT_32B_DECL);
+ d.addField("hello", IntegerDeclaration.INT_32B_DECL);
+ d.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ d.setTag("hi");
+ assertEquals(b, d);
+ assertEquals(d, b);
+ }
+
+ /**
+ * Test the equals out of order
+ */
+ @Test
+ public void equalsOutOfOrderTest() {
+ VariantDeclaration a = new VariantDeclaration();
+ VariantDeclaration b = new VariantDeclaration();
+ b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ b.addField("hello", new VariantDeclaration());
+ a.addField("hello", new VariantDeclaration());
+ a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ assertEquals(b, a);
+ }
+
+ /**
+ * Test the equals out of order
+ */
+ @Test
+ public void equalsAddTwiceTest() {
+ VariantDeclaration a = new VariantDeclaration();
+ VariantDeclaration b = new VariantDeclaration();
+ b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ assertEquals(b, a);
+ b.addField("hi", new VariantDeclaration());
+ assertNotEquals(b, a);
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.tests.types;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
+import org.eclipse.tracecompass.ctf.core.tests.io.Util;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>VariantDefinitionTest</code> contains tests for the class
+ * <code>{@link VariantDefinition}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class VariantDefinitionTest {
+
+ private VariantDefinition fixture;
+
+ StructDefinition fStructDefinition;
+ private static final @NonNull String TEST_STRUCT_ID = "testStruct";
+ private static final @NonNull String ENUM_7 = "g";
+ private static final @NonNull String ENUM_6 = "f";
+ private static final @NonNull String ENUM_5 = "e";
+ private static final @NonNull String ENUM_4 = "d";
+ private static final @NonNull String ENUM_3 = "c";
+ private static final @NonNull String ENUM_2 = "b";
+ private static final @NonNull String ENUM_1 = "a";
+ private static final @NonNull String TAG_ID = "a";
+ private static final @NonNull String LENGTH_SEQ = "_len";
+ private static final @NonNull String VAR_FIELD_NAME = "var";
+ private static final @NonNull String ENUM_8 = "bbq ribs";
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * Not sure it needs to be that complicated, oh well...
+ *
+ * @throws CTFException
+ * won't happen
+ */
+ @Before
+ public void setUp() throws CTFException {
+ StructDeclaration sDec = new StructDeclaration(12);
+ StructDeclaration smallStruct = new StructDeclaration(8);
+ IntegerDeclaration iDec = IntegerDeclaration.createDeclaration(32, false, 32, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8);
+ IntegerDeclaration lenDec = IntegerDeclaration.createDeclaration(8, false, 8, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8);
+ StringDeclaration strDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ EnumDeclaration enDec = new EnumDeclaration(iDec);
+ VariantDeclaration varDec = new VariantDeclaration();
+ EnumDeclaration tagDec = new EnumDeclaration(iDec);
+ CompoundDeclaration arrDec = new ArrayDeclaration(2, iDec);
+ FloatDeclaration fDec = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 8);
+ tagDec.add(0, 1, ENUM_1);
+ tagDec.add(2, 3, ENUM_2);
+ tagDec.add(4, 5, ENUM_3);
+ tagDec.add(8, 9, ENUM_5);
+ tagDec.add(10, 11, ENUM_6);
+ tagDec.add(12, 13, ENUM_7);
+ varDec.addField(ENUM_4, lenDec);
+ varDec.addField(ENUM_7, fDec);
+ varDec.addField(ENUM_6, smallStruct);
+ varDec.addField(ENUM_5, enDec);
+ varDec.addField(ENUM_3, arrDec);
+ varDec.addField(ENUM_2, iDec);
+ varDec.addField(ENUM_1, strDec);
+
+ sDec.addField(TAG_ID, tagDec);
+ sDec.addField(LENGTH_SEQ, lenDec);
+
+ sDec.addField(VAR_FIELD_NAME, varDec);
+ varDec.setTag(TAG_ID);
+
+ final ByteBuffer byteBuffer = Util.testMemory(ByteBuffer.allocate(100));
+ BitBuffer bb = new BitBuffer(byteBuffer);
+ byteBuffer.mark();
+ byteBuffer.putInt(1);
+ byteBuffer.putInt(2);
+ byteBuffer.putInt(3);
+ byteBuffer.reset();
+ fStructDefinition = sDec.createDefinition(null, TEST_STRUCT_ID, bb);
+ fixture = (VariantDefinition) fStructDefinition.getDefinition(VAR_FIELD_NAME);
+ }
+
+ /**
+ * Run the VariantDefinition(VariantDeclaration,DefinitionScope,String)
+ *
+ * @throws CTFException
+ * should not happen
+ */
+ @Test
+ public void testVariantDefinition() throws CTFException {
+ VariantDeclaration declaration = new VariantDeclaration();
+ declaration.setTag("");
+ VariantDeclaration variantDeclaration = new VariantDeclaration();
+ variantDeclaration.addField("", new EnumDeclaration(IntegerDeclaration.INT_32B_DECL));
+ variantDeclaration.addField("a", IntegerDeclaration.INT_64B_DECL);
+ declaration.addField(ENUM_3, StringDeclaration.getStringDeclaration(Encoding.UTF8));
+ variantDeclaration.setTag("a");
+
+ byte[] bytes = new byte[128];
+ ByteBuffer byb = ByteBuffer.wrap(bytes);
+ byb.mark();
+ byb.putInt(0);
+ byb.putShort((short) 2);
+ byb.put(new String("hello").getBytes());
+ byb.reset();
+ BitBuffer bb = new BitBuffer(byb);
+ VariantDefinition variantDefinition = variantDeclaration.createDefinition(fStructDefinition, "field", bb);
+ EnumDeclaration declaration2 = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
+ declaration2.add(0, 2, ENUM_3);
+ EnumDefinition enumDefinition = new EnumDefinition(
+ declaration2,
+ null,
+ "a",
+ new IntegerDefinition(
+ IntegerDeclaration.INT_8_DECL,
+ null,
+ "A",
+ 1
+ ));
+ final StructDeclaration declarationScope = new StructDeclaration(1L);
+ declarationScope.addField("", enumDefinition.getDeclaration());
+ declarationScope.addField("variant", variantDeclaration);
+ IDefinitionScope definitionScope = new StructDefinition(
+ declarationScope,
+ variantDefinition,
+ "",
+ new Definition[] { enumDefinition, variantDefinition }
+ );
+ String fieldName = "";
+ declaration.setTag("");
+ VariantDefinition result = declaration.createDefinition(definitionScope, fieldName, bb);
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Definition getCurrentField() method test.
+ */
+ @Test
+ public void testGetCurrentField() {
+ IDefinition result = fixture.getCurrentField();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getCurrentFieldName() method test.
+ */
+ @Test
+ public void testGetCurrentFieldName() {
+ String result = fixture.getCurrentFieldName();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the VariantDeclaration getDeclaration() method test.
+ */
+ @Test
+ public void testGetDeclaration() {
+ VariantDeclaration result = fixture.getDeclaration();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the HashMap<String, Definition> getDefinitions() method test.
+ */
+ @Test
+ public void testGetDefinitions() {
+ IDefinition result = fixture.getCurrentField();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getPath() method test.
+ */
+ @Test
+ public void testGetPath() {
+ String result = fixture.getScopePath().getPath();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the ArrayDefinition lookupArray(String) method test.
+ */
+ @Test
+ public void testLookupArray() {
+ AbstractArrayDefinition result = fixture.lookupArrayDefinition(ENUM_3);
+ assertNull(result);
+ }
+
+ /**
+ * Run the Definition lookupDefinition(String) method test.
+ */
+ @Test
+ public void testLookupDefinition() {
+ IDefinition result = fixture.lookupDefinition(ENUM_1);
+ assertNotNull(result);
+ assertEquals("a", ((EnumDefinition) result).getStringValue());
+ }
+
+ /**
+ * Run the EnumDefinition lookupEnum(String) method test.
+ */
+ @Test
+ public void testLookupEnum() {
+ EnumDefinition result = fixture.lookupEnum(ENUM_5);
+ assertNull(result);
+ }
+
+ /**
+ * Run the IntegerDefinition lookupInteger(String) method test.
+ */
+ @Test
+ public void testLookupInteger() {
+ IntegerDefinition result = fixture.lookupInteger(ENUM_2);
+ assertNull(result);
+ }
+
+ /**
+ * Run the StringDefinition lookupString(String) method test.
+ */
+ @Test
+ public void testLookupString() {
+ StringDefinition result = fixture.lookupString(ENUM_1);
+ assertNull(result);
+ }
+
+ /**
+ * Run the StructDefinition lookupStruct(String) method test.
+ */
+ @Test
+ public void testLookupStruct() {
+ StructDefinition result = fixture.lookupStruct(ENUM_6);
+ assertNull(result);
+ }
+
+ /**
+ * Run the VariantDefinition lookupVariant(String) method test.
+ */
+ @Test
+ public void testLookupVariant() {
+ VariantDefinition result = fixture.lookupVariant(ENUM_8);
+ assertNull(result);
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ String result = fixture.toString();
+ assertEquals("{ a = \"\" }", result);
+ }
+}
--- /dev/null
+*.bz2
+*.gz
+*.tar
+*.ht
+*.zip
+/ctf-testsuite
+/cyg-profile
+/funky_trace
+/hello-lost
+/kernel
+/kernel_vm
+/synctraces
+/synthetic-trace
+/trace2
+/exp
+/django-benchmark
+/bug446190
+/flipping-endianness
--- /dev/null
+4c67592e010111285c6e5a89dda0e008
--- /dev/null
+00000000006062cc b angle
+0000000000606248 d animate
+00000000006062e0 b asp
+0000000000606290 d blue.19445
+00000000006062b0 B __bss_start
+00000000006062b8 b completed.6718
+ U cos@@GLIBC_2.2.5
+0000000000401aac t current_time
+ U __cyg_profile_func_enter@@GLIBC_2.2.5
+ U __cyg_profile_func_exit@@GLIBC_2.2.5
+0000000000606230 D __data_start
+0000000000606230 W data_start
+00000000004019f0 t deregister_tm_clones
+0000000000401a60 t __do_global_dtors_aux
+0000000000605de8 t __do_global_dtors_aux_fini_array_entry
+00000000004033a7 t draw
+0000000000403760 t draw_frame
+000000000040357a t draw_gears
+0000000000606238 D __dso_handle
+0000000000605df8 d _DYNAMIC
+00000000006062b0 D _edata
+00000000006062e8 B _end
+00000000004045c8 t event_loop
+ U exit@@GLIBC_2.2.5
+000000000060624c d eyesep
+ U fflush@@GLIBC_2.2.5
+0000000000404c54 T _fini
+0000000000606250 d fix_point
+0000000000401a80 t frame_dummy
+0000000000605de0 t __frame_dummy_init_array_entry
+0000000000405470 r __FRAME_END__
+00000000006062e4 b frames.19426
+00000000006062d0 b fullscreen
+0000000000401b23 t gear
+00000000006062c0 b gear1
+00000000006062c4 b gear2
+00000000006062c8 b gear3
+ U getenv@@GLIBC_2.2.5
+ U gettimeofday@@GLIBC_2.2.5
+ U glBegin
+ U glCallList
+ U glClear
+ U glDeleteLists
+ U glDrawBuffer
+ U glEnable
+ U glEnd
+ U glEndList
+ U glFrustum
+ U glGenLists
+ U glGetString
+ U glLightfv
+ U glLoadIdentity
+ U glMaterialfv
+ U glMatrixMode
+ U glNewList
+ U glNormal3f
+0000000000606000 d _GLOBAL_OFFSET_TABLE_
+ U glPopMatrix
+ U glPushMatrix
+ U glRotatef
+ U glShadeModel
+ U glTranslated
+ U glTranslatef
+ U glVertex3f
+ U glViewport
+ U glXChooseVisual
+ U glXCreateContext
+ U glXDestroyContext
+ U glXGetProcAddressARB
+ U glXMakeCurrent
+ U glXQueryDrawable
+ U glXQueryExtensionsString
+ U glXSwapBuffers
+ w __gmon_start__
+0000000000606280 d green.19444
+0000000000404412 t handle_event
+0000000000403b14 t init
+0000000000401560 T _init
+0000000000605de8 t __init_array_end
+0000000000605de0 t __init_array_start
+0000000000404c60 R _IO_stdin_used
+0000000000404244 t is_glx_extension_supported
+ w _ITM_deregisterTMCloneTable
+ w _ITM_registerTMCloneTable
+0000000000605df0 d __JCR_END__
+0000000000605df0 d __JCR_LIST__
+ w _Jv_RegisterClasses
+00000000006062d8 b left
+0000000000404c50 T __libc_csu_fini
+0000000000404bc0 T __libc_csu_init
+ U __libc_start_main@@GLIBC_2.2.5
+000000000040472b T main
+0000000000403d60 t make_window
+0000000000405034 r MWM_HINTS_DECORATIONS.19450
+0000000000403cb1 t no_border
+0000000000606260 d pos.19442
+ U printf@@GLIBC_2.2.5
+0000000000405038 r PROP_MOTIF_WM_HINTS_ELEMENTS.19451
+ U puts@@GLIBC_2.2.5
+0000000000404311 t query_vsync
+0000000000606270 d red.19443
+0000000000401a20 t register_tm_clones
+000000000040392b t reshape
+00000000006062dc b right
+00000000006062d4 b samples
+ U sin@@GLIBC_2.2.5
+ U sqrt@@GLIBC_2.2.5
+ U __stack_chk_fail@@GLIBC_2.4
+00000000004019c0 T _start
+00000000006062b0 B stdout@@GLIBC_2.2.5
+00000000006062d1 b stereo
+ U strcmp@@GLIBC_2.2.5
+ U strlen@@GLIBC_2.2.5
+ U strstr@@GLIBC_2.2.5
+ U strtod@@GLIBC_2.2.5
+00000000006062b0 D __TMC_END__
+00000000006062a8 d tRate0.19428
+00000000006062a0 d tRot0.19427
+00000000004046bd t usage
+0000000000606240 d view_rotx
+0000000000606244 d view_roty
+00000000006062bc b view_rotz
+ U XChangeProperty
+ U XCloseDisplay
+ U XCreateColormap
+ U XCreateWindow
+ U XDestroyWindow
+ U XFree
+ U XInternAtom
+ U XLookupKeysym
+ U XLookupString
+ U XMapWindow
+ U XNextEvent
+ U XOpenDisplay
+ U XParseGeometry
+ U XPending
+ U XSetNormalHints
+ U XSetStandardProperties
--- /dev/null
+088795f3d7b483d197ffad51137ab39e
--- /dev/null
+afd538a1dc0c42e825292f0ce4123583
--- /dev/null
+c6309471689cf999ce2d3123f1594713
+
--- /dev/null
+9c68dba0f722d4c4a34791651c5b0e83
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright (C) 2013, Red Hat, 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
+-->
+
+<project name="Extract Traces" default="main" >
+<target name="main">
+ <antcall>
+ <target name="checkAnyTraceExists"/>
+ <target name="verifyChecksum"/>
+ <target name="deleteFailedCheckSumTraces"/>
+ </antcall>
+ <antcall target="downloadTraceFiles"/>
+ <exec executable = "git" failifexecutionfails="false" timeout="20000">
+ <arg value = "clone"/>
+ <arg value = "https://github.com/efficios/ctf-testsuite.git"/>
+ </exec>
+ <condition property="testSuiteExists">
+ <and>
+ <available file="ctf-testsuite" type="dir"/>
+ </and>
+ </condition>
+ <antcall target="pullTestSuite"/>
+ <condition property="tracesExist">
+ <and>
+ <available file="sample-ctf-trace-20120412.tar.bz2"/>
+ <available file="trace2.tar.bz2"/>
+ <available file="kernel_vm.tar.bz2" />
+ <available file="synctraces.tar.gz" />
+ <available file="django-benchmark.tar.gz" />
+ <available file="hello-lost.tar.bz2" />
+ <available file="cyg-profile.tar.bz2" />
+ <available file="funky_trace.tar.bz2" />
+ <available file="bug446190.tar.bz2" />
+ <available file="flipping-endianness.tar.bz2" />
+ </and>
+ </condition>
+ <antcall target="extractTraces"/>
+</target>
+
+<target name="checkAnyTraceExists">
+ <pathconvert property="anyTraceExists" setonempty="false" pathsep=" ">
+ <path>
+ <fileset dir="." includes="*.tar.bz2" />
+ <fileset dir="." includes="*.tar.gz" />
+ <fileset dir="." includes="*.zip" />
+ </path>
+ </pathconvert>
+</target>
+
+<target name="verifyChecksum">
+ <echo message="Verifying: ${anyTraceExists}"/>
+ <condition property="failedCheckSum">
+ <and>
+ <isset property="anyTraceExists"/>
+ <not>
+ <and>
+ <checksum>
+ <fileset dir="." includes="*.tar.bz2" />
+ <fileset dir="." includes="*.tar.gz" />
+ <fileset dir="." includes="*.zip" />
+ </checksum>
+ </and>
+ </not>
+ </and>
+ </condition>
+</target>
+
+
+<target name="deleteFailedCheckSumTraces" if="failedCheckSum">
+ <echo message="Some traces have failed the checksum tests. Deleting traces."/>
+ <delete verbose="true">
+ <fileset dir="." includes="*.tar.bz2" />
+ <fileset dir="." includes="*.tar.gz" />
+ <fileset dir="." includes="*.zip" />
+ </delete>
+</target>
+
+<target name="warnFailedCheckSum" if="failedCheckSum">
+ <echo message="WARNING: Some downloaded traces failed the checkum."/>
+</target>
+
+<target name="downloadTraceFiles">
+ <echo message="Attempting to download test traces"/>
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="sample-ctf-trace-20120412.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/sample-ctf-trace-20120412.tar.bz2"/>
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="trace2.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/trace2.tar.bz2"/>
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="kernel_vm.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/kernel_vm.tar.bz2" />
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="synctraces.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/synctraces.tar.gz" />
+ <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="django-benchmark.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/django-benchmark.tar.gz" />
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="hello-lost.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/hello-lost.tar.bz2" />
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="cyg-profile.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/cyg-profile.tar.bz2" />
+ <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="funky_trace.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/funky_trace.tar.bz2" />
+ <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="testtraceExp.zip" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/testtraceExp.zip" />
+ <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="bug446190.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/bug446190.tar.bz2" />
+ <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="flipping-endianness.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/flipping-endianness.tar.bz2" />
+</target>
+
+<target name="pullTestSuite" if="testSuiteExists">
+ <!-- Update the local 'master' branch -->
+ <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
+ <arg value = "checkout"/>
+ <arg value = "master"/>
+ </exec>
+ <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
+ <arg value = "pull"/>
+ </exec>
+
+ <!-- Checkout the commit requested by the current build -->
+ <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
+ <arg value = "checkout"/>
+ <arg value = "${ctf-test-suite-commit}"/>
+ </exec>
+</target>
+
+<target name="extractTraces" if="tracesExist">
+ <antcall>
+ <target name="checkAnyTraceExists"/>
+ <target name="verifyChecksum"/>
+ <target name="warnFailedCheckSum"/>
+ </antcall>
+ <bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
+ <bunzip2 src="trace2.tar.bz2"/>
+ <bunzip2 src="kernel_vm.tar.bz2" />
+ <gunzip src="synctraces.tar.gz" />
+ <gunzip src="django-benchmark.tar.gz" />
+ <bunzip2 src="hello-lost.tar.bz2" />
+ <bunzip2 src="cyg-profile.tar.bz2" />
+ <bunzip2 src="funky_trace.tar.bz2" />
+ <bunzip2 src="bug446190.tar.bz2"/>
+ <bunzip2 src="flipping-endianness.tar.bz2"/>
+ <unzip src="testtraceExp.zip" dest="./exp" />
+
+ <untar src="sample-ctf-trace-20120412.tar" dest="." />
+ <untar src="trace2.tar" dest="." />
+ <untar src="kernel_vm.tar" dest="." />
+ <untar src="synctraces.tar" dest="." />
+ <untar src="django-benchmark.tar" dest="." />
+ <untar src="hello-lost.tar" dest="." />
+ <untar src="cyg-profile.tar" dest="." />
+ <untar src="funky_trace.tar" dest="." />
+ <untar src="bug446190.tar" dest="." />
+ <untar src="flipping-endianness.tar" dest="." />
+
+ <echo message="Traces extracted successfully"/>
+</target>
+</project>
--- /dev/null
+4ca17df0c3e3a0dc14940a988630d2d1
--- /dev/null
+0aa7f55c4305e642e62c482474b937b3
--- /dev/null
+6b54b6b4ff7313eb7cd1edb44b39b1d3
--- /dev/null
+715e024f8b641d5cb3c5541d34ade5da
--- /dev/null
+6c0bffcfaee984bc70eab5bcddce4708
--- /dev/null
+6971bb6f2385abdb17d017f4faaefc16
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.ctf.core</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=1
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.ctf.core;singleton:=true
+Bundle-Activator: org.eclipse.tracecompass.internal.ctf.core.Activator
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.tracecompass.common.core,
+ org.eclipse.tracecompass.ctf.parser
+Export-Package: org.eclipse.tracecompass.ctf.core,
+ org.eclipse.tracecompass.ctf.core.event,
+ org.eclipse.tracecompass.ctf.core.event.io,
+ org.eclipse.tracecompass.ctf.core.event.scope,
+ org.eclipse.tracecompass.ctf.core.event.types,
+ org.eclipse.tracecompass.ctf.core.trace,
+ org.eclipse.tracecompass.internal.ctf.core;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.event;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.event.metadata;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.event.types;x-friends:="org.eclipse.tracecompass.ctf.core.tests,org.eclipse.tracecompass.tmf.ctf.core,org.eclipse.tracecompass.tmf.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.event.types.composite;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
+ org.eclipse.tracecompass.internal.ctf.core.trace;x-friends:="org.eclipse.tracecompass.ctf.core.tests"
+Import-Package: com.google.common.base,
+ com.google.common.collect,
+ org.antlr.runtime;version="3.2.0",
+ org.antlr.runtime.tree;version="3.2.0"
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+# LTTng Trace Control bash completion
+#
+
+_lttng_complete_sessions() {
+ local sessions
+ if ! _complete_as_root ; then
+ sessions=$(for i in $(ls -d ~/.lttng/*/); do basename $i; done)
+ COMPREPLY=( $(compgen -W "${sessions}" -- $cur) )
+ #else
+ # Permission denied, what should we do ?
+ # sessions=$(for i in $(ls -d ~root/.lttng/*/); do basename $i; done)
+ #COMPREPLY=( $(compgen -W "${sessions}" -- $cur) )
+ fi
+}
+
+_lttng_create() {
+ local create_opts
+ create_opts="-h --help -o --output"
+
+ case $prev in
+ --output|-o)
+ _filedir -d
+ return
+ ;;
+ esac
+
+ case $cur in
+ -*)
+ COMPREPLY=( $(compgen -W "${create_opts}" -- $cur) )
+ return
+ ;;
+ esac
+}
+
+_lttng_start_stop() {
+ local start_stop_opts
+ start_stop_opts="-h --help"
+
+ case $cur in
+ -*)
+ COMPREPLY=( $(compgen -W "${start_stop_opts}" -- $cur) )
+ ;;
+ *)
+ _lttng_complete_sessions
+ ;;
+ esac
+}
+
+_lttng_opts() {
+ local opts
+ opts=$(lttng --dump-options)
+
+ COMPREPLY=( $(compgen -W "${opts}" -- $cur) )
+}
+
+_lttng_commands() {
+ COMPREPLY=( $(compgen -W "$commands" -- $cur) )
+}
+
+_lttng_before_command() {
+ # Check if the previous word should alter the behavior
+ case $prev in
+ --group|-g)
+ COMPREPLY=( $(compgen -g -- $cur) )
+ return
+ ;;
+ esac
+
+ case $cur in
+ -*)
+ # If the current word starts with a dash, complete with options
+ _lttng_opts
+ ;;
+ *)
+ # Otherwise complete with commands
+ _lttng_commands
+ ;;
+ esac
+}
+
+_lttng_after_command() {
+ case $command_found in
+ "create")
+ _lttng_create
+ ;;
+ "start"|"stop")
+ _lttng_start_stop
+ ;;
+ esac
+}
+
+_lttng_is_command() {
+ for command in $commands; do
+ if [ "$1" == "$command" ]; then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+_lttng() {
+ local cur prev commands command_found command_found_index
+
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ commands=$(lttng --dump-commands)
+
+ command_found=""
+ command_found_index=-1
+
+ for (( i = 1 ; i < ${#COMP_WORDS[@]} ; i++ )); do
+ _lttng_is_command ${COMP_WORDS[$i]}
+ if [ $? -eq 0 ]; then
+ command_found=${COMP_WORDS[$i]}
+ command_found_index=$i
+ break
+ fi
+
+ done
+
+ if [ -n "$command_found" ] && [ "$COMP_CWORD" -gt "$command_found_index" ]; then
+ _lttng_after_command
+ else
+ _lttng_before_command
+ fi
+}
+
+complete -F _lttng lttng
+
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+#Properties file for org.eclipse.tracecompass.ctf.core
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = Trace Compass CTF Core Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Trace Compass CTF Core Plug-in</name>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <artifactId>org.eclipse.tracecompass.ctf.core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core;
+
+/**
+ * General exception that is thrown when there is a problem somewhere with the
+ * CTF trace reader.
+ *
+ * @author Alexandre Montplaisir
+ * @since 1.0
+ */
+public class CTFException extends Exception {
+
+ private static final long serialVersionUID = 2065258365219777672L;
+
+ /**
+ * Default constructor with no message.
+ */
+ public CTFException() {
+ super();
+ }
+
+ /**
+ * Constructor with an attached message.
+ *
+ * @param message
+ * The message attached to this exception
+ */
+ public CTFException(String message) {
+ super(message);
+ }
+
+ /**
+ * Re-throw an exception into this type.
+ *
+ * @param e
+ * The previous Exception we caught
+ */
+ public CTFException(Exception e) {
+ super(e);
+ }
+
+ /**
+ * Constructor with an attached message and re-throw an exception into this type.
+ *
+ * @param message
+ * The message attached to this exception
+ * @param exception
+ * The previous Exception caught
+ */
+ public CTFException(String message, Throwable exception) {
+ super(message, exception);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ * Matthew Khouzam - Add packet header Strings
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Non-externalized strings for use with the CTF plugin (event names, field
+ * names, etc.)
+ *
+ * @author Alexandre Montplaisir
+ */
+@SuppressWarnings("nls")
+@NonNullByDefault
+public interface CTFStrings {
+
+ /** Event name for lost events */
+ String LOST_EVENT_NAME = "Lost event";
+
+ /**
+ * Name of the field in lost events indicating how many actual events were
+ * lost
+ */
+ String LOST_EVENTS_FIELD = "Lost events";
+
+ /**
+ * Name of the field in lost events indicating the time range
+ */
+ String LOST_EVENTS_DURATION = "duration";
+
+ // -------------------------------------------------------------------------
+ // Packet header strings
+ // -------------------------------------------------------------------------
+
+ /**
+ * Lost events so far in this stream (LTTng Specific)
+ *
+ * @since 1.0
+ */
+ String EVENTS_DISCARDED = "events_discarded";
+
+ /**
+ * The CPU ID of this packet (LTTng Specific)
+ *
+ * @since 1.0
+ */
+ String CPU_ID = "cpu_id";
+
+ /**
+ * The device of this packet
+ *
+ * @since 1.0
+ */
+ String DEVICE = "device";
+
+ /**
+ * The first time stamp of this packet
+ *
+ * @since 1.0
+ */
+ String TIMESTAMP_BEGIN = "timestamp_begin";
+
+ /**
+ * The last time stamp of this packet
+ *
+ * @since 1.0
+ */
+ String TIMESTAMP_END = "timestamp_end";
+
+ /**
+ * Size of this packet
+ *
+ * @since 1.0
+ */
+ String PACKET_SIZE = "packet_size";
+
+ /**
+ * Size of data in this packet (not necessarily the packet size)
+ *
+ * @since 1.0
+ */
+ String CONTENT_SIZE = "content_size";
+
+ /**
+ * Magic number
+ *
+ * @since 1.0
+ */
+ String MAGIC = "magic";
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
+
+/**
+ * Callsite information to help with cdt integration
+ *
+ * @author Matthew Khouzam
+ */
+public class CTFCallsite implements Comparable<CTFCallsite> {
+
+ // Integer size
+ private static final int INT_BITS = Integer.SIZE;
+
+ // a bitmask for the size of an integer
+ private static final long INT_MASK = (1L << INT_BITS) - 1;
+
+ /**
+ * The event name
+ */
+ private final String fEventName;
+
+ /**
+ * the file name of the callsite
+ */
+ private final String fFileName;
+
+ /**
+ * the instruction pointer
+ */
+ private final long fIp;
+
+ /**
+ * the function name
+ */
+ private final String fFunctionName;
+
+ /**
+ * the line number of the callsite
+ */
+ private final long fLineNumber;
+
+ /**
+ * The callsite constructor
+ *
+ * @param en
+ * The event name
+ * @param func
+ * the function name
+ * @param ip
+ * the instruction pointer of the callsite
+ * @param fn
+ * the file name of the callsite
+ * @param line
+ * the line number of the callsite
+ */
+ public CTFCallsite(String en, String func, long ip, String fn, long line) {
+ fEventName = en;
+ fFileName = fn;
+ fFunctionName = func;
+ fIp = ip;
+ fLineNumber = line;
+ }
+
+ /**
+ * @return the eventName
+ */
+ public String getEventName() {
+ return fEventName;
+ }
+
+ /**
+ * @return the fileName
+ */
+ public String getFileName() {
+ return fFileName;
+ }
+
+ /**
+ * @return the ip
+ */
+ public long getIp() {
+ return fIp;
+ }
+
+ /**
+ * @return the functionName
+ */
+ public String getFunctionName() {
+ return fFunctionName;
+ }
+
+ /**
+ * @return the lineNumber
+ */
+ public long getLineNumber() {
+ return fLineNumber;
+ }
+
+ /*
+ * The callsites will be sorted by calling addresses. To do this we take IPs
+ * (instruction pointers) and compare them. Java only supports signed
+ * operation and since memory addresses are unsigned, we will convert the
+ * longs into integers that contain the high and low bytes and compare them.
+ */
+ @Override
+ public int compareTo(CTFCallsite o) {
+ /*
+ * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
+ * will return the lower 32 bits
+ */
+
+ long other = o.fIp;
+ /*
+ * To get a high int: we downshift by 32 and bitwise and with the mask
+ * to get rid of the sign
+ *
+ * To get the low int: we bitwise and with the mask.
+ */
+ long otherHigh = (other >> INT_BITS) & INT_MASK;
+ long otherLow = other & INT_MASK;
+ long ownHigh = (fIp >> INT_BITS) & INT_MASK;
+ long ownLow = fIp & INT_MASK;
+ /* are the high values different, if so ignore the lower values */
+ if (ownHigh > otherHigh) {
+ return 1;
+ }
+ if (ownHigh < otherHigh) {
+ return -1;
+ }
+ /* the high values are the same, compare the lower values */
+ if (ownLow > otherLow) {
+ return 1;
+ }
+ if (ownLow < otherLow) {
+ return -1;
+ }
+ /* the values are identical */
+ return 0;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
+ result = prime * result + ((fFileName == null) ? 0 : fFileName.hashCode());
+ result = prime * result + ((fFunctionName == null) ? 0 : fFunctionName.hashCode());
+ result = prime * result + (int) (fIp ^ (fIp >>> 32));
+ result = prime * result + (int) (fLineNumber ^ (fLineNumber >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CTFCallsite other = (CTFCallsite) obj;
+ if (!equalsNullable(fEventName, other.fEventName)) {
+ return false;
+ }
+ if (!equalsNullable(fFileName, other.fFileName)) {
+ return false;
+ }
+ if (!equalsNullable(fFunctionName, other.fFunctionName)) {
+ return false;
+ }
+ if (fIp != other.fIp) {
+ return false;
+ }
+ if (fLineNumber != other.fLineNumber) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return fFileName + "/" + fFunctionName + ":" + fLineNumber; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Clock description used in CTF traces
+ */
+public class CTFClock {
+
+ private static final long ONE_BILLION_L = 1000000000L;
+ private static final double ONE_BILLION_D = 1000000000.0;
+
+ private static final String NAME = "name"; //$NON-NLS-1$
+ private static final String FREQ = "freq"; //$NON-NLS-1$
+ private static final String OFFSET = "offset"; //$NON-NLS-1$
+
+ private long fClockOffset = 0;
+ private double fClockScale = 1.0;
+ private double fClockAntiScale = 1.0;
+
+ /**
+ * Field properties.
+ */
+ private final Map<String, Object> fProperties = new HashMap<>();
+ /**
+ * Field name.
+ */
+ private String fName;
+ private boolean fIsScaled = false;
+
+ /**
+ * Default constructor
+ */
+ public CTFClock() {
+ }
+
+ /**
+ * Method addAttribute.
+ *
+ * @param key
+ * String
+ * @param value
+ * Object
+ */
+ public void addAttribute(String key, Object value) {
+ fProperties.put(key, value);
+ if (key.equals(NAME)) {
+ fName = (String) value;
+ }
+ if (key.equals(FREQ)) {
+ /*
+ * Long is converted to a double. the double is then dividing
+ * another double that double is saved. this is precise as long as
+ * the long is under 53 bits long. this is ok as long as we don't
+ * have a system with a frequency of > 1 600 000 000 GHz with
+ * 200 ppm precision
+ */
+ fIsScaled = !((Long) getProperty(FREQ)).equals(ONE_BILLION_L);
+ fClockScale = ONE_BILLION_D / ((Long) getProperty(FREQ)).doubleValue();
+ fClockAntiScale = 1.0 / fClockScale;
+
+ }
+ if (key.equals(OFFSET)) {
+ fClockOffset = (Long) getProperty(OFFSET);
+ }
+ }
+
+ /**
+ * Method getName.
+ *
+ * @return String
+ */
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * Method getProperty.
+ *
+ * @param key
+ * String
+ * @return Object
+ */
+ public Object getProperty(String key) {
+ return fProperties.get(key);
+ }
+
+ /**
+ * @return the clockOffset
+ */
+ public long getClockOffset() {
+ return fClockOffset;
+ }
+
+ /**
+ * @return the clockScale
+ */
+ public double getClockScale() {
+ return fClockScale;
+ }
+
+ /**
+ * @return the clockAntiScale
+ */
+ public double getClockAntiScale() {
+ return fClockAntiScale;
+ }
+
+ /**
+ * @return is the clock in ns or cycles?
+ */
+ public boolean isClockScaled() {
+ return fIsScaled;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+
+/**
+ * Representation of a particular instance of an event.
+ */
+public final class EventDefinition implements IDefinitionScope {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * A null event, can be used for testing or poison pilling
+ */
+ @NonNull
+ public static final EventDefinition NULL_EVENT = new EventDefinition(new EventDeclaration(), null, -1L, null, null, null, null);
+
+ /**
+ * The corresponding event declaration.
+ */
+ private final IEventDeclaration fDeclaration;
+
+ /**
+ * The timestamp of the current event.
+ */
+ private final long fTimestamp;
+
+ /**
+ * The event context structure definition.
+ */
+ private final ICompositeDefinition fEventContext;
+
+ private final ICompositeDefinition fStreamContext;
+
+ private final ICompositeDefinition fPacketContext;
+
+ /**
+ * The event fields structure definition.
+ */
+ private final ICompositeDefinition fFields;
+
+ /**
+ * The StreamInputReader that reads this event definition.
+ */
+ private final CTFStreamInputReader fStreamInputReader;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs an event definition.
+ *
+ * @param declaration
+ * The corresponding event declaration
+ * @param streamInputReader
+ * The SIR from where this EventDef was read
+ * @param timestamp
+ * event timestamp
+ * @param eventContext
+ * The event context
+ * @param packetContext
+ * the packet context
+ * @param streamContext
+ * the stream context
+ * @param fields
+ * The event fields
+ * @since 1.0
+ */
+ public EventDefinition(IEventDeclaration declaration,
+ CTFStreamInputReader streamInputReader,
+ long timestamp,
+ ICompositeDefinition streamContext,
+ ICompositeDefinition eventContext,
+ ICompositeDefinition packetContext,
+ ICompositeDefinition fields) {
+ fDeclaration = declaration;
+ fStreamInputReader = streamInputReader;
+ fTimestamp = timestamp;
+ fFields = fields;
+ fEventContext = eventContext;
+ fPacketContext = packetContext;
+ fStreamContext = streamContext;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ILexicalScope getScopePath() {
+ String eventName = fDeclaration.getName();
+ if (eventName == null) {
+ return null;
+ }
+ ILexicalScope myScope = ILexicalScope.EVENT.getChild(eventName);
+ if (myScope == null) {
+ myScope = new LexicalScope(ILexicalScope.EVENT, eventName);
+ }
+ return myScope;
+ }
+
+ /**
+ * Gets the declaration (the form) of the data
+ *
+ * @return the event declaration
+ */
+ public IEventDeclaration getDeclaration() {
+ return fDeclaration;
+ }
+
+ /**
+ * Gets the fields of a definition
+ *
+ * @return the fields of a definition in struct form. Can be null.
+ * @since 1.0
+ */
+ public ICompositeDefinition getFields() {
+ return fFields;
+ }
+
+ /**
+ * Gets the context of this event without the context of the stream
+ *
+ * @return the context in struct form
+ * @since 1.0
+ */
+ public ICompositeDefinition getEventContext() {
+ return fEventContext;
+ }
+
+ /**
+ * Gets the context of this event within a stream
+ *
+ * @return the context in struct form
+ * @since 1.0
+ */
+ public ICompositeDefinition getContext() {
+
+ /* Most common case so far */
+ if (fStreamContext == null) {
+ return fEventContext;
+ }
+
+ /* streamContext is not null, but the context of the event is null */
+ if (fEventContext == null) {
+ return fStreamContext;
+ }
+
+ // TODO: cache if this is a performance issue
+
+ /* The stream context and event context are assigned. */
+ StructDeclaration mergedDeclaration = new StructDeclaration(1);
+
+ List<Definition> fieldValues = new ArrayList<>();
+
+ /* Add fields from the stream */
+ List<String> fieldNames = fStreamContext.getFieldNames();
+ for (String fieldName : fieldNames) {
+ Definition definition = fStreamContext.getDefinition(fieldName);
+ mergedDeclaration.addField(fieldName, definition.getDeclaration());
+ fieldValues.add(definition);
+ }
+
+ /*
+ * Add fields from the event context, overwrite the stream ones if
+ * needed.
+ */
+ for (String fieldName : fEventContext.getFieldNames()) {
+ Definition definition = fEventContext.getDefinition(fieldName);
+ mergedDeclaration.addField(fieldName, definition.getDeclaration());
+ if (fieldNames.contains(fieldName)) {
+ fieldValues.set((fieldNames.indexOf(fieldName)), definition);
+ } else {
+ fieldValues.add(definition);
+ }
+ }
+ return new StructDefinition(mergedDeclaration, this, "context", //$NON-NLS-1$
+ fieldValues.toArray(new Definition[fieldValues.size()]));
+ }
+
+ /**
+ * Gets the stream input reader that this event was made by
+ *
+ * @return the parent
+ */
+ public CTFStreamInputReader getStreamInputReader() {
+ return fStreamInputReader;
+ }
+
+ /**
+ * Gets the context of packet the event is in.
+ *
+ * @return the packet context
+ * @since 1.0
+ */
+ public ICompositeDefinition getPacketContext() {
+ return fPacketContext;
+ }
+
+ /**
+ * gets the CPU the event was generated by. Slightly LTTng specific
+ *
+ * @return The CPU the event was generated by
+ */
+ public int getCPU() {
+ return fStreamInputReader.getCPU();
+ }
+
+ /**
+ * @return the timestamp
+ */
+ public long getTimestamp() {
+ return fTimestamp;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public IDefinition lookupDefinition(String lookupPath) {
+ if (lookupPath.equals("context")) { //$NON-NLS-1$
+ return fEventContext;
+ } else if (lookupPath.equals("fields")) { //$NON-NLS-1$
+ return fFields;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String toString() {
+ Iterable<String> list;
+ StringBuilder retString = new StringBuilder();
+ final String cr = System.getProperty("line.separator");//$NON-NLS-1$
+
+ retString.append("Event type: ").append(fDeclaration.getName()).append(cr); //$NON-NLS-1$
+ retString.append("Timestamp: ").append(Long.toString(fTimestamp)).append(cr); //$NON-NLS-1$
+
+ if (fEventContext != null) {
+ list = fEventContext.getFieldNames();
+
+ for (String field : list) {
+ retString.append(field).append(" : ").append(fEventContext.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
+ }
+ }
+
+ if (fFields != null) {
+ list = fFields.getFieldNames();
+
+ for (String field : list) {
+ retString.append(field).append(" : ").append(fFields.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
+ }
+ }
+
+ return retString.toString();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+
+/**
+ * Representation of one type of event. A bit like "int" or "long" but for trace
+ * events.
+ *
+ * @author Matthew Khouzam
+ */
+public interface IEventDeclaration {
+
+ /**
+ * Id of events when not set
+ *
+ * @since 1.0
+ */
+ public static final long UNSET_EVENT_ID = -2L;
+
+ /**
+ * Creates an instance of EventDefinition corresponding to this declaration.
+ *
+ * @param streamInputReader
+ * The StreamInputReader for which this definition is created.
+ * @param input
+ * the bitbuffer input source
+ * @param timestamp
+ * The timestamp when the event was taken
+ * @return A new EventDefinition.
+ * @throws CTFException
+ * As a bitbuffer is used to read, it could have wrapped
+ * IOExceptions.
+ */
+ EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException;
+
+ /**
+ * Gets the name of an event declaration
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Gets the fields of an event declaration
+ *
+ * @return fields the fields in {@link StructDeclaration} format
+ */
+ StructDeclaration getFields();
+
+ /**
+ * Gets the context of an event declaration
+ *
+ * @return context the fields in {@link StructDeclaration} format
+ */
+ StructDeclaration getContext();
+
+ /**
+ * Gets the id of an event declaration
+ *
+ * @return The EventDeclaration ID
+ */
+ Long getId();
+
+ /**
+ * Gets the {@link CTFStream} of an event declaration
+ *
+ * @return the stream
+ */
+ CTFStream getStream();
+
+ /**
+ * What is the log level of this event?
+ *
+ * @return the log level.
+ */
+ long getLogLevel();
+
+ /**
+ * Get the {@link Set} of names of the custom CTF attributes.
+ *
+ * @return The set of custom attributes
+ */
+ Set<String> getCustomAttributes();
+
+ /**
+ * Get the value of a given CTF attribute.
+ *
+ * @param key
+ * The CTF attribute name
+ * @return the CTF attribute
+ */
+ String getCustomAttribute(String key);
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+
+/**
+ * A lost event definition
+ *
+ * @author Matthew Khouzam
+ * @since 1.0
+ */
+public class LostEventDeclaration implements IEventDeclaration {
+
+ /**
+ * Id of lost events
+ *
+ * @since 1.0
+ */
+ public static final long LOST_EVENT_ID = -1L;
+
+ /**
+ * Gets a "lost" event. This is a synthetic event that is there to show that
+ * there should be something there.
+ */
+ public static final LostEventDeclaration INSTANCE = new LostEventDeclaration();
+
+ private final StructDeclaration fFields = new StructDeclaration(0);
+
+ private LostEventDeclaration() {
+ getFields().addField(CTFStrings.LOST_EVENTS_FIELD, IntegerDeclaration.UINT_32B_DECL);
+ getFields().addField(CTFStrings.LOST_EVENTS_DURATION, IntegerDeclaration.UINT_64B_DECL);
+ }
+
+ @Override
+ public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, BitBuffer input, long timestamp) throws CTFException {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return CTFStrings.LOST_EVENT_NAME;
+ }
+
+ @Override
+ public StructDeclaration getFields() {
+ return fFields;
+ }
+
+ @Override
+ public StructDeclaration getContext() {
+ return null;
+ }
+
+ @Override
+ public Long getId() {
+ return LOST_EVENT_ID;
+ }
+
+ @Override
+ public CTFStream getStream() {
+ return null;
+ }
+
+ @Override
+ public long getLogLevel() {
+ return 0;
+ }
+
+ @Override
+ public Set<String> getCustomAttributes() {
+ return Collections.<String> emptySet();
+ }
+
+ @Override
+ public String getCustomAttribute(String key) {
+ return null;
+ }
+
+}
--- /dev/null
+/*******************************************************************************.
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial Design and implementation + overhaul
+ * Francis Giraldeau - Initial API and implementation
+ * Philippe Proulx - Some refinement and optimization
+ * Etienne Bergeron <Etienne.Bergeron@gmail.com> - fix zero size read + cleanup
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.io;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.nio.BufferUnderflowException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+
+/**
+ * <b><u>BitBuffer</u></b>
+ * <p>
+ * A bitwise buffer capable of accessing fields with bit offsets.
+ */
+public final class BitBuffer {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /* default bit width */
+ private static final int BIT_CHAR = Byte.SIZE; // yum
+ private static final int BYTE_MASK = (1 << BIT_CHAR) - 1;
+ private static final int BIT_SHORT = Short.SIZE;
+ private static final int SHORT_MASK = (1 << BIT_SHORT) - 1;
+ private static final int BIT_INT = Integer.SIZE;
+ private static final long INT_MASK = (1L << BIT_INT) - 1;
+ private static final int BIT_LONG = Long.SIZE;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final @NonNull ByteBuffer fBuffer;
+ private final long fBitCapacity;
+
+ /**
+ * Bit-buffer's position, maximum value = Integer.MAX_VALUE * 8
+ */
+ private long fPosition;
+ private ByteOrder fByteOrder;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Default constructor, makes a big-endian buffer
+ */
+ public BitBuffer() {
+ this(checkNotNull(ByteBuffer.allocateDirect(0)), ByteOrder.BIG_ENDIAN);
+ }
+
+ /**
+ * Constructor, makes a big-endian buffer
+ *
+ * @param buf
+ * the bytebuffer to read
+ */
+ public BitBuffer(@NonNull ByteBuffer buf) {
+ this(buf, ByteOrder.BIG_ENDIAN);
+ }
+
+ /**
+ * Constructor that is fully parameterizable
+ *
+ * @param buf
+ * the buffer to read
+ * @param order
+ * the byte order (big-endian, little-endian, network?)
+ */
+ public BitBuffer(@NonNull ByteBuffer buf, ByteOrder order) {
+ fBuffer = buf;
+ setByteOrder(order);
+ resetPosition();
+ fBitCapacity = (long) fBuffer.capacity() * BIT_CHAR;
+ }
+
+ private void resetPosition() {
+ fPosition = 0;
+ }
+
+ // ------------------------------------------------------------------------
+ // 'Get' operations on buffer
+ // ------------------------------------------------------------------------
+
+ /**
+ * Relative <i>get</i> method for reading 32-bit integer.
+ *
+ * Reads next four bytes from the current bit position according to current
+ * byte order.
+ *
+ * @return The int value (signed) read from the buffer
+ * @throws CTFException
+ * An error occurred reading the long. This exception can be
+ * raised if the buffer tries to read out of bounds
+ */
+ public int getInt() throws CTFException {
+ return getInt(BIT_INT, true);
+ }
+
+ /**
+ * Relative <i>get</i> method for reading 64-bit integer.
+ *
+ * Reads next eight bytes from the current bit position according to current
+ * byte order.
+ *
+ * @return The long value (signed) read from the buffer
+ * @throws CTFException
+ * An error occurred reading the long. This exception can be
+ * raised if the buffer tries to read out of bounds
+ */
+ public long getLong() throws CTFException {
+ return get(BIT_LONG, true);
+ }
+
+ /**
+ * Relative <i>get</i> method for reading long of <i>length</i> bits.
+ *
+ * Reads <i>length</i> bits starting at the current position. The result is
+ * signed extended if <i>signed</i> is true. The current position is
+ * increased of <i>length</i> bits.
+ *
+ * @param length
+ * The length in bits of this integer
+ * @param signed
+ * The sign extended flag
+ * @return The long value read from the buffer
+ * @throws CTFException
+ * An error occurred reading the data. If more than 64 bits at a
+ * time are read, or the buffer is read beyond its end, this
+ * exception will be raised.
+ */
+ public long get(int length, boolean signed) throws CTFException {
+ if (length > BIT_LONG) {
+ throw new CTFException("Cannot read a long longer than 64 bits. Rquested: " + length); //$NON-NLS-1$
+ }
+ if (length > BIT_INT) {
+ final int highShift = length - BIT_INT;
+ long a = getInt();
+ long b = getInt(highShift, false);
+ long retVal;
+ /* Cast the signed-extended int into a unsigned int. */
+ a &= INT_MASK;
+ b &= (1L << highShift) - 1L;
+
+ retVal = (fByteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a);
+ /* sign extend */
+ if (signed) {
+ int signExtendBits = BIT_LONG - length;
+ retVal = (retVal << signExtendBits) >> signExtendBits;
+ }
+ return retVal;
+ }
+ long retVal = getInt(length, signed);
+ return (signed ? retVal : (retVal & INT_MASK));
+ }
+
+ /**
+ * Relative bulk <i>get</i> method.
+ *
+ * <p>
+ * This method transfers <strong>bytes</strong> from this buffer into the
+ * given destination array. This method currently only supports reads
+ * aligned to 8 bytes. It is up to the developer to shift the bits in
+ * post-processing to do unaligned reads.
+ *
+ * @param dst
+ * the bytes to write to
+ * @throws BufferUnderflowException
+ * - If there are fewer than length bytes remaining in this
+ * buffer
+ */
+ public void get(@NonNull byte[] dst) {
+ fBuffer.position((int) (fPosition / BIT_CHAR));
+ fBuffer.get(dst);
+ fPosition += dst.length * BIT_CHAR;
+ }
+
+ /**
+ * Relative <i>get</i> method for reading integer of <i>length</i> bits.
+ *
+ * Reads <i>length</i> bits starting at the current position. The result is
+ * signed extended if <i>signed</i> is true. The current position is
+ * increased of <i>length</i> bits.
+ *
+ * @param length
+ * The length in bits of this integer
+ * @param signed
+ * The sign extended flag
+ * @return The int value read from the buffer
+ * @throws CTFException
+ * An error occurred reading the data. When the buffer is read
+ * beyond its end, this exception will be raised.
+ */
+ private int getInt(int length, boolean signed) throws CTFException {
+
+ /* Nothing to read. */
+ if (length == 0) {
+ return 0;
+ }
+
+ /* Validate that the buffer has enough bits. */
+ if (!canRead(length)) {
+ throw new CTFException("Cannot read the integer, " + //$NON-NLS-1$
+ "the buffer does not have enough remaining space. " + //$NON-NLS-1$
+ "Requested:" + length); //$NON-NLS-1$
+ }
+
+ /* Get the value from the byte buffer. */
+ int val = 0;
+ boolean gotIt = false;
+
+ /*
+ * Try a fast read when the position is byte-aligned by using
+ * java.nio.ByteBuffer's native methods
+ */
+ /*
+ * A faster alignment detection as the compiler cannot guaranty that pos
+ * is always positive.
+ */
+ if ((fPosition & (BitBuffer.BIT_CHAR - 1)) == 0) {
+ switch (length) {
+ case BitBuffer.BIT_CHAR:
+ // Byte
+ val = fBuffer.get((int) (fPosition / BIT_CHAR));
+ if (!signed) {
+ val = val & BYTE_MASK;
+ }
+ gotIt = true;
+ break;
+
+ case BitBuffer.BIT_SHORT:
+ // Word
+ val = fBuffer.getShort((int) (fPosition / BIT_CHAR));
+ if (!signed) {
+ val = val & SHORT_MASK;
+ }
+ gotIt = true;
+ break;
+
+ case BitBuffer.BIT_INT:
+ // Double word
+ val = fBuffer.getInt((int) (fPosition / BIT_CHAR));
+ gotIt = true;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ /* When not byte-aligned, fall-back to a general decoder. */
+ if (!gotIt) {
+ // Nothing read yet: use longer methods
+ if (fByteOrder == ByteOrder.LITTLE_ENDIAN) {
+ val = getIntLE(fPosition, length, signed);
+ } else {
+ val = getIntBE(fPosition, length, signed);
+ }
+ }
+ fPosition += length;
+
+ return val;
+ }
+
+ private int getIntBE(long index, int length, boolean signed) {
+ if ((length <= 0) || (length > BIT_INT)) {
+ throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
+ }
+ long end = index + length;
+ int startByte = (int) (index / BIT_CHAR);
+ int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
+ int currByte, lshift, cshift, mask, cmask, cache;
+ int value = 0;
+
+ currByte = startByte;
+ cache = fBuffer.get(currByte) & BYTE_MASK;
+ boolean isNeg = (cache & (1 << (BIT_CHAR - (index % BIT_CHAR) - 1))) != 0;
+ if (signed && isNeg) {
+ value = ~0;
+ }
+ if (startByte == (endByte - 1)) {
+ cmask = cache >>> ((BIT_CHAR - (end % BIT_CHAR)) % BIT_CHAR);
+ if (((length) % BIT_CHAR) > 0) {
+ mask = ~((~0) << length);
+ cmask &= mask;
+ }
+ value <<= length;
+ value |= cmask;
+ return value;
+ }
+ cshift = (int) (index % BIT_CHAR);
+ if (cshift > 0) {
+ mask = ~((~0) << (BIT_CHAR - cshift));
+ cmask = cache & mask;
+ lshift = BIT_CHAR - cshift;
+ value <<= lshift;
+ value |= cmask;
+ currByte++;
+ }
+ for (; currByte < (endByte - 1); currByte++) {
+ value <<= BIT_CHAR;
+ value |= fBuffer.get(currByte) & BYTE_MASK;
+ }
+ lshift = (int) (end % BIT_CHAR);
+ if (lshift > 0) {
+ mask = ~((~0) << lshift);
+ cmask = fBuffer.get(currByte) & BYTE_MASK;
+ cmask >>>= BIT_CHAR - lshift;
+ cmask &= mask;
+ value <<= lshift;
+ value |= cmask;
+ } else {
+ value <<= BIT_CHAR;
+ value |= fBuffer.get(currByte) & BYTE_MASK;
+ }
+ return value;
+ }
+
+ private int getIntLE(long index, int length, boolean signed) {
+ if ((length <= 0) || (length > BIT_INT)) {
+ throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
+ }
+ long end = index + length;
+ int startByte = (int) (index / BIT_CHAR);
+ int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
+ int currByte, lshift, cshift, mask, cmask, cache, mod;
+ int value = 0;
+
+ currByte = endByte - 1;
+ cache = fBuffer.get(currByte) & BYTE_MASK;
+ mod = (int) (end % BIT_CHAR);
+ lshift = (mod > 0) ? mod : BIT_CHAR;
+ boolean isNeg = (cache & (1 << (lshift - 1))) != 0;
+ if (signed && isNeg) {
+ value = ~0;
+ }
+ if (startByte == (endByte - 1)) {
+ cmask = cache >>> (index % BIT_CHAR);
+ if (((length) % BIT_CHAR) > 0) {
+ mask = ~((~0) << length);
+ cmask &= mask;
+ }
+ value <<= length;
+ value |= cmask;
+ return value;
+ }
+ cshift = (int) (end % BIT_CHAR);
+ if (cshift > 0) {
+ mask = ~((~0) << cshift);
+ cmask = cache & mask;
+ value <<= cshift;
+ value |= cmask;
+ currByte--;
+ }
+ for (; currByte >= (startByte + 1); currByte--) {
+ value <<= BIT_CHAR;
+ value |= fBuffer.get(currByte) & BYTE_MASK;
+ }
+ lshift = (int) (index % BIT_CHAR);
+ if (lshift > 0) {
+ mask = ~((~0) << (BIT_CHAR - lshift));
+ cmask = fBuffer.get(currByte) & BYTE_MASK;
+ cmask >>>= lshift;
+ cmask &= mask;
+ value <<= (BIT_CHAR - lshift);
+ value |= cmask;
+ } else {
+ value <<= BIT_CHAR;
+ value |= fBuffer.get(currByte) & BYTE_MASK;
+ }
+ return value;
+ }
+
+ // ------------------------------------------------------------------------
+ // 'Put' operations on buffer
+ // ------------------------------------------------------------------------
+
+ /**
+ * Relative <i>put</i> method to write signed 32-bit integer.
+ *
+ * Write four bytes starting from current bit position in the buffer
+ * according to the current byte order. The current position is increased of
+ * <i>length</i> bits.
+ *
+ * @param value
+ * The int value to write
+ * @throws CTFException
+ * An error occurred writing the data. If the buffer is written
+ * beyond its end, this exception will be raised.
+ */
+ public void putInt(int value) throws CTFException {
+ putInt(BIT_INT, value);
+ }
+
+ /**
+ * Relative <i>put</i> method to write <i>length</i> bits integer.
+ *
+ * Writes <i>length</i> lower-order bits from the provided <i>value</i>,
+ * starting from current bit position in the buffer. Sequential bytes are
+ * written according to the current byte order. The sign bit is carried to
+ * the MSB if signed is true. The sign bit is included in <i>length</i>. The
+ * current position is increased of <i>length</i>.
+ *
+ * @param length
+ * The number of bits to write
+ * @param value
+ * The value to write
+ * @throws CTFException
+ * An error occurred writing the data. If the buffer is written
+ * beyond its end, this exception will be raised.
+ */
+ public void putInt(int length, int value) throws CTFException {
+ final long curPos = fPosition;
+
+ if (!canRead(length)) {
+ throw new CTFException("Cannot write to bitbuffer, " //$NON-NLS-1$
+ + "insufficient space. Requested: " + length); //$NON-NLS-1$
+ }
+ if (length == 0) {
+ return;
+ }
+ if (fByteOrder == ByteOrder.LITTLE_ENDIAN) {
+ putIntLE(curPos, length, value);
+ } else {
+ putIntBE(curPos, length, value);
+ }
+ fPosition += length;
+ }
+
+ private void putIntBE(long index, int length, int value) {
+ if ((length <= 0) || (length > BIT_INT)) {
+ throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
+ }
+ long end = index + length;
+ int startByte = (int) (index / BIT_CHAR);
+ int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
+ int currByte, lshift, cshift, mask, cmask;
+ int correctedValue = value;
+
+ /*
+ * mask v high bits. Works for unsigned and two complement signed
+ * numbers which value do not overflow on length bits.
+ */
+
+ if (length < BIT_INT) {
+ correctedValue &= ~(~0 << length);
+ }
+
+ /* sub byte */
+ if (startByte == (endByte - 1)) {
+ lshift = (int) ((BIT_CHAR - (end % BIT_CHAR)) % BIT_CHAR);
+ mask = ~((~0) << lshift);
+ if ((index % BIT_CHAR) > 0) {
+ mask |= (~(0)) << (BIT_CHAR - (index % BIT_CHAR));
+ }
+ cmask = correctedValue << lshift;
+ /*
+ * low bits are cleared because of left-shift and high bits are
+ * already cleared
+ */
+ cmask &= ~mask;
+ int b = fBuffer.get(startByte) & BYTE_MASK;
+ fBuffer.put(startByte, (byte) ((b & mask) | cmask));
+ return;
+ }
+
+ /* head byte contains MSB */
+ currByte = endByte - 1;
+ cshift = (int) (end % BIT_CHAR);
+ if (cshift > 0) {
+ lshift = BIT_CHAR - cshift;
+ mask = ~((~0) << lshift);
+ cmask = correctedValue << lshift;
+ cmask &= ~mask;
+ int b = fBuffer.get(currByte) & BYTE_MASK;
+ fBuffer.put(currByte, (byte) ((b & mask) | cmask));
+ correctedValue >>>= cshift;
+ currByte--;
+ }
+
+ /* middle byte(s) */
+ for (; currByte >= (startByte + 1); currByte--) {
+ fBuffer.put(currByte, (byte) correctedValue);
+ correctedValue >>>= BIT_CHAR;
+ }
+ /* end byte contains LSB */
+ if ((index % BIT_CHAR) > 0) {
+ mask = (~0) << (BIT_CHAR - (index % BIT_CHAR));
+ cmask = correctedValue & ~mask;
+ int b = fBuffer.get(currByte) & BYTE_MASK;
+ fBuffer.put(currByte, (byte) ((b & mask) | cmask));
+ } else {
+ fBuffer.put(currByte, (byte) correctedValue);
+ }
+ }
+
+ private void putIntLE(long index, int length, int value) {
+ if ((length <= 0) || (length > BIT_INT)) {
+ throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
+ }
+ long end = index + length;
+ int startByte = (int) (index / BIT_CHAR);
+ int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
+ int currByte, lshift, cshift, mask, cmask;
+ int correctedValue = value;
+
+ /*
+ * mask v high bits. Works for unsigned and two complement signed
+ * numbers which value do not overflow on length bits.
+ */
+
+ if (length < BIT_INT) {
+ correctedValue &= ~(~0 << length);
+ }
+
+ /* sub byte */
+ if (startByte == (endByte - 1)) {
+ lshift = (int) (index % BIT_CHAR);
+ mask = ~((~0) << lshift);
+ if ((end % BIT_CHAR) > 0) {
+ mask |= (~(0)) << (end % BIT_CHAR);
+ }
+ cmask = correctedValue << lshift;
+ /*
+ * low bits are cleared because of left-shift and high bits are
+ * already cleared
+ */
+ cmask &= ~mask;
+ int b = fBuffer.get(startByte) & BYTE_MASK;
+ fBuffer.put(startByte, (byte) ((b & mask) | cmask));
+ return;
+ }
+
+ /* head byte */
+ currByte = startByte;
+ cshift = (int) (index % BIT_CHAR);
+ if (cshift > 0) {
+ mask = ~((~0) << cshift);
+ cmask = correctedValue << cshift;
+ cmask &= ~mask;
+ int b = fBuffer.get(currByte) & BYTE_MASK;
+ fBuffer.put(currByte, (byte) ((b & mask) | cmask));
+ correctedValue >>>= BIT_CHAR - cshift;
+ currByte++;
+ }
+
+ /* middle byte(s) */
+ for (; currByte < (endByte - 1); currByte++) {
+ fBuffer.put(currByte, (byte) correctedValue);
+ correctedValue >>>= BIT_CHAR;
+ }
+ /* end byte */
+ if ((end % BIT_CHAR) > 0) {
+ mask = (~0) << (end % BIT_CHAR);
+ cmask = correctedValue & ~mask;
+ int b = fBuffer.get(currByte) & BYTE_MASK;
+ fBuffer.put(currByte, (byte) ((b & mask) | cmask));
+ } else {
+ fBuffer.put(currByte, (byte) correctedValue);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Buffer attributes handling
+ // ------------------------------------------------------------------------
+
+ /**
+ * Can this buffer be read for thus amount of bits?
+ *
+ * @param length
+ * the length in bits to read
+ * @return does the buffer have enough room to read the next "length"
+ */
+ public boolean canRead(int length) {
+ return ((fPosition + length) <= fBitCapacity);
+ }
+
+ /**
+ * Sets the order of the buffer.
+ *
+ * @param order
+ * The order of the buffer.
+ */
+ public void setByteOrder(ByteOrder order) {
+ fByteOrder = order;
+ fBuffer.order(order);
+ }
+
+ /**
+ * Sets the order of the buffer.
+ *
+ * @return The order of the buffer.
+ */
+ public ByteOrder getByteOrder() {
+ return fByteOrder;
+ }
+
+ /**
+ * Sets the position in the buffer.
+ *
+ * @param newPosition
+ * The new position of the buffer.
+ * @throws CTFException
+ * Thrown on out of bounds exceptions
+ */
+ public void position(long newPosition) throws CTFException {
+
+ if (newPosition > fBitCapacity) {
+ throw new CTFException("Out of bounds exception on a position move, attempting to access position: " + newPosition); //$NON-NLS-1$
+ }
+ fPosition = newPosition;
+ }
+
+ /**
+ *
+ * Sets the position in the buffer.
+ *
+ * @return order The position of the buffer.
+ */
+ public long position() {
+ return fPosition;
+ }
+
+ /**
+ * Gets the byte buffer
+ *
+ * @return The byte buffer
+ */
+ public ByteBuffer getByteBuffer() {
+ return fBuffer;
+ }
+
+ /**
+ * Resets the bitbuffer.
+ */
+ public void clear() {
+ resetPosition();
+ fBuffer.clear();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * A lttng specific speedup node (the packet header with ID and V) of a lexical
+ * scope
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class EventHeaderScope extends LexicalScope {
+
+
+ /**
+ * The scope constructor
+ *
+ * @param parent
+ * The parent node, can be null, but shouldn't
+ * @param name
+ * the name of the field
+ */
+ EventHeaderScope(ILexicalScope parent, String name) {
+ super(parent, name);
+ }
+
+ @Override
+ @Nullable
+ public ILexicalScope getChild(String name) {
+ if (name.equals(EVENT_HEADER_ID.getName())) {
+ return EVENT_HEADER_ID;
+ }
+ if (name.equals(EVENT_HEADER_V.getName())) {
+ return EVENT_HEADER_V;
+ }
+ return super.getChild(name);
+ }
+
+ @Override
+ public String getPath() {
+ return "event.header"; //$NON-NLS-1$
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * A lttng specific speedup node (v variant for event headers) of a lexical
+ * scope they normally contain a timestamp
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class EventHeaderVScope extends LexicalScope {
+
+ /**
+ * The scope constructor
+ *
+ * @param parent
+ * The parent node, can be null, but shouldn't
+ * @param name
+ * the name of the field
+ */
+ EventHeaderVScope(ILexicalScope parent, String name) {
+ super(parent, name);
+ }
+
+ @Override
+ @Nullable
+ public ILexicalScope getChild(String name) {
+ if (name.equals(EVENT_HEADER_V_TIMESTAMP.getName())) {
+ return EVENT_HEADER_V_TIMESTAMP;
+ }
+ if (name.equals(EVENT_HEADER_V_ID.getName())) {
+ return EVENT_HEADER_V_ID;
+ }
+ return super.getChild(name);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * A lttng specific speedup node field scope of a lexical scope
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class FieldsScope extends LexicalScope {
+
+ /**
+ * The scope constructor
+ *
+ * @param parent
+ * The parent node, can be null, but shouldn't
+ * @param name
+ * the name of the field
+ */
+ FieldsScope(ILexicalScope parent, String name) {
+ super(parent, name);
+ }
+
+ @Override
+ @Nullable
+ public ILexicalScope getChild(String name) {
+ if (name.equals(FIELDS_RET.getName())) {
+ return FIELDS_RET;
+ }
+ if (name.equals(FIELDS_TID.getName())) {
+ return FIELDS_TID;
+ }
+ return super.getChild(name);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+
+/**
+ * The scope of a CTF definition. Used for compound types.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public interface IDefinitionScope {
+
+ /**
+ * Gets the path in a C style for the scope.
+ *
+ * @return the path
+ * @since 1.0
+ */
+ ILexicalScope getScopePath();
+
+ /**
+ * Looks up in this definition scope.
+ *
+ * @param lookupPath
+ * The path to look up
+ * @return The Definition that was read
+ * @since 1.0
+ */
+ IDefinition lookupDefinition(String lookupPath);
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * @since 1.0
+ */
+@NonNullByDefault
+public interface ILexicalScope {
+ /**
+ * Empty string
+ */
+ ILexicalScope ROOT = new RootScope();
+
+ /**
+ * Trace string
+ */
+ ILexicalScope TRACE = new LexicalScope(ROOT, "trace"); //$NON-NLS-1$
+ /**
+ * Env string
+ */
+ ILexicalScope ENV = new LexicalScope(ROOT, "env"); //$NON-NLS-1$
+ /**
+ * Stream string
+ */
+ LexicalScope STREAM = new LexicalScope(ROOT, "stream"); //$NON-NLS-1$
+ /**
+ * Event string
+ */
+ LexicalScope EVENT = new LexicalScope(ROOT, "event"); //$NON-NLS-1$
+ /**
+ * Variant string
+ */
+ ILexicalScope VARIANT = new LexicalScope(ROOT, "variant"); //$NON-NLS-1$
+ /**
+ * packet string
+ */
+ LexicalScope PACKET = new LexicalScope(ROOT, "packet"); //$NON-NLS-1$
+ /**
+ * Packet header string
+ */
+ LexicalScope PACKET_HEADER = new PacketHeaderScope();
+
+ /**
+ * Packet header v id string
+ */
+ ILexicalScope EVENT_HEADER_V_ID = new LexicalScope(PACKET_HEADER, "id"); //$NON-NLS-1$
+ /**
+ * Packet header v timestamp string
+ */
+ ILexicalScope EVENT_HEADER_V_TIMESTAMP = new LexicalScope(PACKET_HEADER, "timestamp"); //$NON-NLS-1$
+
+ /**
+ * Stream packet scope
+ */
+ LexicalScope STREAM_PACKET = new LexicalScope(STREAM, "packet"); //$NON-NLS-1$
+ /**
+ * Stream Packet header string
+ */
+ ILexicalScope STREAM_PACKET_CONTEXT = new LexicalScope(STREAM_PACKET, "context"); //$NON-NLS-1$
+ /**
+ * Trace packet scope
+ */
+ LexicalScope TRACE_PACKET = new LexicalScope(TRACE, "packet"); //$NON-NLS-1$
+ /**
+ * Stream event scope
+ */
+ LexicalScope STREAM_EVENT = new LexicalScope(STREAM, "event"); //$NON-NLS-1$
+ /**
+ * Trace packet header string
+ */
+ ILexicalScope TRACE_PACKET_HEADER = new LexicalScope(TRACE_PACKET, "header"); //$NON-NLS-1$
+ /**
+ * Stream event context
+ */
+ ILexicalScope STREAM_EVENT_CONTEXT = new LexicalScope(STREAM_EVENT, "context"); //$NON-NLS-1$
+ /**
+ * Stream event header
+ */
+ ILexicalScope STREAM_EVENT_HEADER = new LexicalScope(STREAM_EVENT, "header"); //$NON-NLS-1$
+ /**
+ * Context of an event
+ */
+ LexicalScope CONTEXT = new LexicalScope(ROOT, "context"); //$NON-NLS-1$
+ /**
+ * Event Header scope
+ */
+ ILexicalScope EVENT_HEADER = new EventHeaderScope(EVENT, "header"); //$NON-NLS-1$
+
+ /**
+ * Event header id string
+ */
+ ILexicalScope EVENT_HEADER_ID = new LexicalScope(EVENT_HEADER, "id"); //$NON-NLS-1$
+
+ /**
+ * Event header v as in variant string
+ */
+ ILexicalScope EVENT_HEADER_V = new EventHeaderVScope(EVENT_HEADER, "v"); //$NON-NLS-1$
+
+ /**
+ * Fields in an event
+ */
+ ILexicalScope FIELDS = new FieldsScope(ROOT, "fields"); //$NON-NLS-1$
+
+ /**
+ * ret field
+ */
+ ILexicalScope FIELDS_RET = new LexicalScope(FIELDS, "_ret"); //$NON-NLS-1$
+
+ /**
+ * tid field
+ */
+ ILexicalScope FIELDS_TID = new LexicalScope(FIELDS, "_tid"); //$NON-NLS-1$
+
+ /**
+ * Get the name
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Gets a child of a given name
+ *
+ * @param name
+ * the child
+ * @return the scope, can be null
+ */
+ @Nullable
+ ILexicalScope getChild(String name);
+
+ // -------------------------------------------------------------------------
+ // helpers
+ // -------------------------------------------------------------------------
+
+ /**
+ * Adds a child lexical scope
+ *
+ * @param name
+ * the name of the child
+ * @param child
+ * the child
+ */
+ void addChild(String name, ILexicalScope child);
+
+ /**
+ * Get the path of the scope
+ *
+ * @return the path of the scope
+ */
+ String getPath();
+
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * A node of a lexical scope
+ *
+ * @author Matthew Khouzam
+ */
+public class LexicalScope implements ILexicalScope {
+ private int hash = 0;
+ private final @NonNull String fName;
+ private final @NonNull String fPath;
+ private final Map<String, ILexicalScope> fChildren = new ConcurrentHashMap<>();
+
+ /**
+ * Hidden constructor for the root node only
+ *
+ * @since 1.0
+ */
+ protected LexicalScope() {
+ fPath = ""; //$NON-NLS-1$
+ fName = ""; //$NON-NLS-1$
+ }
+
+ /**
+ * The scope constructor
+ *
+ * @param parent
+ * The parent node, can be null, but shouldn't
+ * @param name
+ * the name of the field
+ * @since 1.0
+ */
+ public LexicalScope(ILexicalScope parent, @NonNull String name) {
+ fName = name;
+ fPath = parent.getPath().isEmpty() ? fName : parent.getPath() + '.' + fName;
+ parent.addChild(name, this);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void addChild(String name, ILexicalScope child) {
+ fChildren.put(name, child);
+ }
+
+ @Override
+ public @NonNull String getName() {
+ return fName;
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public @Nullable ILexicalScope getChild(String name) {
+ return fChildren.get(name);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public @NonNull String getPath() {
+ return fPath;
+ }
+
+ // for debugging purposes
+ @Override
+ public String toString() {
+ return getPath();
+ }
+
+ @Override
+ public synchronized int hashCode() {
+ if (hash == 0) {
+ final int prime = 31;
+ hash = prime * (prime + fName.hashCode()) + fPath.hashCode();
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LexicalScope other = (LexicalScope) obj;
+ if (!fName.equals(other.fName)) {
+ return false;
+ }
+ return fPath.equals(other.fPath);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * A lttng specific speedup node (the packet header with magic, uuid and stream
+ * id ) of a lexical scope the sole reason to have this is to accelerate tostring()
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public class PacketHeaderScope extends LexicalScope {
+
+ /**
+ * Constructor
+ */
+ public PacketHeaderScope() {
+ super(PACKET, "header"); //$NON-NLS-1$
+ }
+
+ @Override
+ public String getPath() {
+ return "packet.header"; //$NON-NLS-1$
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.scope;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+
+/**
+ * A lttng specific speedup node a root with accelerated returns for some scopes
+ * of a lexical scope
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class RootScope extends LexicalScope {
+
+ /**
+ * The scope constructor
+ */
+ public RootScope() {
+ super();
+ }
+
+ @Override
+ @Nullable
+ public ILexicalScope getChild(String name) {
+ /*
+ * This happens ~40 % of the time
+ */
+ if (name.equals(EVENT_HEADER.getPath())) {
+ return EVENT_HEADER;
+ }
+ /*
+ * This happens ~30 % of the time
+ */
+ if (name.equals(FIELDS.getPath())) {
+ return FIELDS;
+ }
+ /*
+ * This happens ~30 % of the time
+ */
+ if (name.equals(CONTEXT.getPath())) {
+ return CONTEXT;
+ }
+ /*
+ * This happens ~1 % of the time
+ */
+ if (name.equals(PACKET_HEADER.getPath())) {
+ return PACKET_HEADER;
+ }
+ return super.getChild(name);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * Array definition, used for compound definitions and fixed length strings
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public abstract class AbstractArrayDefinition extends Definition {
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the event declaration
+ *
+ * @param definitionScope
+ * the definition is in a scope, (normally a struct) what is it?
+ * @param fieldName
+ * the name of the definition. (it is a field in the parent
+ * scope)
+ */
+ public AbstractArrayDefinition(IDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName) {
+ super(declaration, definitionScope, fieldName);
+ }
+
+ /**
+ * Get the defintions, an array is a collection of definitions
+ *
+ * @return the definitions
+ */
+ public abstract List<Definition> getDefinitions();
+
+ /**
+ * Get the the number of elements in the array
+ *
+ * @return how many elements in the array
+ * @since 1.0
+ */
+ public abstract int getLength();
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+/**
+ * Parent of sequences and arrays
+ *
+ * @author Matthew Khouzam
+ */
+public abstract class CompoundDeclaration extends Declaration {
+
+ private static final int BIT_MASK = 0x03;
+ private static final int BITS_PER_BYTE = 8;
+
+ /**
+ * Get the element type
+ *
+ * @return the type of element in the array
+ */
+ public abstract IDeclaration getElementType();
+
+ @Override
+ public long getAlignment() {
+ return getElementType().getAlignment();
+ }
+
+ /**
+ * Sometimes, strings are encoded as an array of 1-byte integers (each one
+ * being an UTF-8 byte).
+ *
+ * @return true if this array is in fact an UTF-8 string. false if it's a
+ * "normal" array of generic Definition's.
+ */
+ public boolean isString() {
+ IDeclaration elementType = getElementType();
+ if (elementType instanceof IntegerDeclaration) {
+ IntegerDeclaration elemInt = (IntegerDeclaration) elementType;
+ return elemInt.isCharacter();
+ }
+ return false;
+ }
+
+ /**
+ * If an array contains 8 bit aligned 8 bit ints, it can be bulk read.
+ *
+ * @return true if this array 1 byte aligned. false if it's a "normal" array
+ * of generic Definition's.
+ * @since 1.0
+ */
+ public boolean isAlignedBytes() {
+ IDeclaration elementType = getElementType();
+ if (elementType instanceof IntegerDeclaration) {
+ IntegerDeclaration elemInt = (IntegerDeclaration) elementType;
+ return (elemInt.getLength() == BITS_PER_BYTE) && ((getAlignment() & BIT_MASK) == 0);
+ }
+ return false;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+
+/**
+ * Declaration base, it helps for basic functionality that is often called, so
+ * performance is often a high priority in this class
+ *
+ * @author Matthew Khouzam
+ */
+public abstract class Declaration implements IDeclaration {
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ILexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName) {
+ if (definitionScope != null) {
+ final ILexicalScope parentPath = definitionScope.getScopePath();
+ if (parentPath != null) {
+ ILexicalScope myScope = parentPath.getChild(fieldName);
+ if (myScope == null) {
+ myScope = new LexicalScope(parentPath, fieldName);
+ }
+ return myScope;
+ }
+ }
+ ILexicalScope child = ILexicalScope.ROOT.getChild(fieldName);
+ if (child != null) {
+ return child;
+ }
+ return new LexicalScope(ILexicalScope.ROOT, fieldName);
+ }
+
+ /**
+ * Offset the buffer position wrt the current alignment.
+ *
+ * @param input
+ * The bitbuffer that is being read
+ * @throws CTFException
+ * Happens when there is an out of bounds exception
+ */
+ protected final void alignRead(BitBuffer input) throws CTFException {
+ long mask = getAlignment() - 1;
+ /*
+ * The alignment is a power of 2
+ */
+ long pos = input.position();
+ if ((pos & mask) == 0) {
+ return;
+ }
+ pos = (pos + mask) & ~mask;
+ input.position(pos);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+/**
+ * A CTF definition
+ *
+ * A definition is like an object of a declaration class. It fills the
+ * declaration with values. <br>
+ * An example: <br>
+ * int i = 0; <br>
+ * <b>int</b> is the declaration.<br>
+ * <b>i</b> is the definition.<br>
+ * <b>0</b> is the value assigned to the definition, not the declaration.<br>
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public abstract class Definition implements IDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final String fFieldName;
+
+ /** The complete path of this field */
+ private final @NonNull ILexicalScope fPath;
+
+ private final IDefinitionScope fDefinitionScope;
+
+ @NonNull
+ private final IDeclaration fDeclaration;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the event declaration
+ * @param definitionScope
+ * the definition is in a scope, (normally a struct) what is it?
+ * @param fieldName
+ * the name of the definition. (it is a field in the parent
+ * scope)
+ */
+ public Definition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope, @NonNull String fieldName) {
+ this(declaration, definitionScope, fieldName, declaration.getPath(definitionScope, fieldName));
+ }
+
+ /**
+ * Constructor This one takes the scope and thus speeds up definition
+ * creation
+ *
+ *
+ * @param declaration
+ * the event declaration
+ *
+ * @param definitionScope
+ * the definition is in a scope, (normally a struct) what is it?
+ *
+ * @param fieldName
+ * the name of the defintions. it is a field in the parent scope.
+ *
+ * @param scope
+ * the scope
+ * @since 1.0
+ */
+ public Definition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull ILexicalScope scope) {
+ fDeclaration = declaration;
+ fDefinitionScope = definitionScope;
+ fFieldName = fieldName;
+ fPath = scope;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the field name in its container.
+ *
+ * @return The field name
+ */
+ protected String getFieldName() {
+ return fFieldName;
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ILexicalScope getScopePath() {
+ return fPath;
+ }
+
+ /**
+ * Get the definition scope in which this definition is found.
+ *
+ * The complete path of a definition is thus the path of the definition
+ * scope DOT the name of the definition (name of the field in its container)
+ *
+ * @return The definition scope
+ */
+ protected IDefinitionScope getDefinitionScope() {
+ return fDefinitionScope;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public IDeclaration getDeclaration() {
+ return fDeclaration;
+ }
+
+ @Override
+ public String toString() {
+ return fPath.getPath() + '[' + Integer.toHexString(hashCode()) + ']';
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * CTF encoding types
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+@NonNullByDefault
+public enum Encoding {
+ /** UTF-8 encoding */
+ UTF8,
+ /** Ascii encoding */
+ ASCII,
+ /** No encoding, maybe not even text */
+ NONE
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF enum declaration.
+ *
+ * The definition of a enum point basic data type. It will take the data from a
+ * trace and store it (and make it fit) as an integer and a string.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class EnumDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final EnumTable fTable = new EnumTable();
+ private final IntegerDeclaration fContainerType;
+ private final Set<String> fLabels = new HashSet<>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * constructor
+ *
+ * @param containerType
+ * the enum is an int, this is the type that the data is
+ * contained in. If you have 1000 possible values, you need at
+ * least a 10 bit enum. If you store 2 values in a 128 bit int,
+ * you are wasting space.
+ */
+ public EnumDeclaration(IntegerDeclaration containerType) {
+ fContainerType = containerType;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ *
+ * @return The container type
+ */
+ public IntegerDeclaration getContainerType() {
+ return fContainerType;
+ }
+
+ @Override
+ public long getAlignment() {
+ return this.getContainerType().getAlignment();
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return fContainerType.getMaximumSize();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public EnumDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ IntegerDefinition value = getContainerType().createDefinition(definitionScope, fieldName, input);
+ return new EnumDefinition(this, definitionScope, fieldName, value);
+ }
+
+ /**
+ * Add a value. Do not overlap, this is <em><strong>not</strong></em> an
+ * interval tree.
+ *
+ * @param low
+ * lowest value that this int can be to have label as a return
+ * string
+ * @param high
+ * highest value that this int can be to have label as a return
+ * string
+ * @param label
+ * the name of the value.
+ * @return was the value be added? true == success
+ */
+ public boolean add(long low, long high, @Nullable String label) {
+ fLabels.add(label);
+ return fTable.add(low, high, label);
+ }
+
+ /**
+ * Check if the label for a value (enum a{day=0,night=1} would return "day"
+ * for query(0)
+ *
+ * @param value
+ * the value to lookup
+ * @return the label of that value, can be null
+ */
+ public @Nullable String query(long value) {
+ return fTable.query(value);
+ }
+
+ /**
+ * Gets a set of labels of the enum
+ *
+ * @return A set of labels of the enum, can be empty but not null
+ */
+ public Set<String> getLabels() {
+ return Collections.unmodifiableSet(fLabels);
+ }
+
+ /*
+ * Maps integer range -> string. A simple list for now, but feel free to
+ * optimize it. Babeltrace suggests an interval tree.
+ */
+ private class EnumTable {
+
+ private final List<LabelAndRange> ranges = new LinkedList<>();
+
+ public EnumTable() {
+ }
+
+ public synchronized boolean add(long low, long high, @Nullable String label) {
+ LabelAndRange newRange = new LabelAndRange(low, high, label);
+
+ for (LabelAndRange r : ranges) {
+ if (r.intersects(newRange)) {
+ return false;
+ }
+ }
+
+ ranges.add(newRange);
+
+ return true;
+ }
+
+ /**
+ * Return the first label that matches a value
+ *
+ * @param value
+ * the value to query
+ * @return the label corresponding to that value
+ */
+ public synchronized @Nullable String query(long value) {
+ for (LabelAndRange r : ranges) {
+ if (r.intersects(value)) {
+ return r.getLabel();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public synchronized int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ for (LabelAndRange range : ranges) {
+ result = prime * result + range.hashCode();
+ }
+ return result;
+ }
+
+ @Override
+ public synchronized boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EnumTable other = (EnumTable) obj;
+ if (ranges.size() != other.ranges.size()) {
+ return false;
+ }
+ for (int i = 0; i < ranges.size(); i++) {
+ if (!ranges.get(i).equals(other.ranges.get(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ }
+
+ private static class LabelAndRange {
+
+ private final long low, high;
+ private final @Nullable String fLabel;
+
+ /**
+ * Get the label
+ *
+ * @return the label
+ */
+ public @Nullable String getLabel() {
+ return fLabel;
+ }
+
+ public LabelAndRange(long low, long high, @Nullable String str) {
+ this.low = low;
+ this.high = high;
+ this.fLabel = str;
+ }
+
+ public boolean intersects(long i) {
+ return (i >= this.low) && (i <= this.high);
+ }
+
+ public boolean intersects(LabelAndRange other) {
+ return this.intersects(other.low)
+ || this.intersects(other.high);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ final String label = fLabel;
+ result = prime * result + ((label == null) ? 0 : label.hashCode());
+ result = prime * result + (int) (high ^ (high >>> 32));
+ result = prime * result + (int) (low ^ (low >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ LabelAndRange other = (LabelAndRange) obj;
+ final String label = fLabel;
+ if (label == null) {
+ if (other.fLabel != null) {
+ return false;
+ }
+ } else if (!label.equals(other.fLabel)) {
+ return false;
+ }
+ if (high != other.high) {
+ return false;
+ }
+ if (low != other.low) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ StringBuilder sb = new StringBuilder();
+ sb.append("[declaration] enum["); //$NON-NLS-1$
+ for (String label : fLabels) {
+ sb.append("label:").append(label).append(' '); //$NON-NLS-1$
+ }
+ sb.append("type:").append(fContainerType.toString()); //$NON-NLS-1$
+ sb.append(']');
+ String string = sb.toString();
+ if (string == null) {
+ throw new IllegalStateException();
+ }
+ return string;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = prime + fContainerType.hashCode();
+ for (String label : fLabels) {
+ result = prime * result + label.hashCode();
+ }
+ result = prime * result + fTable.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EnumDeclaration other = (EnumDeclaration) obj;
+ if (!fContainerType.equals(other.fContainerType)) {
+ return false;
+ }
+ if (fLabels.size() != other.fLabels.size()) {
+ return false;
+ }
+ if (!fLabels.containsAll(other.fLabels)) {
+ return false;
+ }
+ if (!fTable.equals(other.fTable)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EnumDeclaration other = (EnumDeclaration) obj;
+ if (!fContainerType.isBinaryEquivalent(other.fContainerType)) {
+ return false;
+ }
+ if (fLabels.size() != other.fLabels.size()) {
+ return false;
+ }
+ if (!fLabels.containsAll(other.fLabels)) {
+ return false;
+ }
+ if (!fTable.equals(other.fTable)) {
+ return false;
+ }
+ return true;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF enum definition.
+ *
+ * The definition of a enum point basic data type. It will take the data from a
+ * trace and store it (and make it fit) as an integer and a string.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class EnumDefinition extends SimpleDatatypeDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final long fIntegerValue;
+
+ private final String fValue;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param intValue
+ * the value of the enum
+ */
+ public EnumDefinition(@NonNull EnumDeclaration declaration,
+ IDefinitionScope definitionScope, @NonNull String fieldName, IntegerDefinition intValue) {
+ super(declaration, definitionScope, fieldName);
+
+ fIntegerValue = intValue.getValue();
+ fValue = declaration.query(fIntegerValue);
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the value of the enum in string format so
+ * "Enum a{DAY="0", NIGHT="1"}; will return "DAY"
+ *
+ * @return the value of the enum.
+ */
+ public String getValue() {
+ return fValue;
+ }
+
+ @Override
+ public String getStringValue() {
+ return getValue();
+ }
+
+ /**
+ * Gets the value of the enum in string format so
+ * "Enum a{DAY="0", NIGHT="1"}; will return 0
+ *
+ * @return the value of the enum.
+ */
+ @Override
+ public Long getIntegerValue() {
+ return fIntegerValue;
+ }
+
+ @Override
+ public EnumDeclaration getDeclaration() {
+ return (EnumDeclaration) super.getDeclaration();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String toString() {
+ return "{ value = " + getValue() + //$NON-NLS-1$
+ ", container = " + fIntegerValue + //$NON-NLS-1$
+ " }"; //$NON-NLS-1$
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF float declaration.
+ *
+ * The declaration of a floating point basic data type.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class FloatDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final int fMantissa;
+ private final int fExponent;
+ private final ByteOrder fByteOrder;
+ private final long fAlignement;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param exponent
+ * The exponent size in bits
+ * @param mantissa
+ * The mantissa size in bits (+1 for sign) (see CTF spec)
+ * @param byteOrder
+ * The byte order
+ * @param alignment
+ * The alignment. Should be ≥ 1
+ */
+ public FloatDeclaration(int exponent, int mantissa, @Nullable ByteOrder byteOrder,
+ long alignment) {
+ fMantissa = mantissa;
+ fExponent = exponent;
+ ByteOrder byteOrder2 = (byteOrder == null) ? ByteOrder.nativeOrder() : byteOrder;
+ if (byteOrder2 == null) {
+ throw new IllegalStateException("ByteOrder cannot be null"); //$NON-NLS-1$
+ }
+ fByteOrder = byteOrder2;
+ fAlignement = Math.max(alignment, 1);
+
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return the mant
+ */
+ public int getMantissa() {
+ return fMantissa;
+ }
+
+ /**
+ * @return the exp
+ */
+ public int getExponent() {
+ return fExponent;
+ }
+
+ /**
+ * @return the byteOrder
+ */
+ public ByteOrder getByteOrder() {
+ return fByteOrder;
+ }
+
+ @Override
+ public long getAlignment() {
+ return fAlignement;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return fMantissa + fExponent + 1;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public FloatDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
+ String fieldName, BitBuffer input) throws CTFException {
+ ByteOrder byteOrder = input.getByteOrder();
+ input.setByteOrder(fByteOrder);
+ double value = read(input);
+ input.setByteOrder(byteOrder);
+ return new FloatDefinition(this, definitionScope, fieldName, value);
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
+ }
+
+ private double read(BitBuffer input) throws CTFException {
+ /* Offset the buffer position wrt the current alignment */
+ alignRead(input);
+ final int exp = getExponent();
+ final int mant = getMantissa();
+ double value = Double.NaN;
+ if ((exp + mant) == 32) {
+ value = readRawFloat32(input, mant, exp);
+ } else if ((exp + mant) == 64) {
+ value = readRawFloat64(input, mant, exp);
+ }
+ return value;
+ }
+
+ private static double readRawFloat32(BitBuffer input, final int manBits,
+ final int expBits) throws CTFException {
+ long temp = input.get(32, false);
+ return createFloat(temp, manBits - 1, expBits);
+ }
+
+ private static double readRawFloat64(BitBuffer input, final int manBits,
+ final int expBits) throws CTFException {
+ long temp = input.get(64, false);
+ return createFloat(temp, manBits - 1, expBits);
+ }
+
+ /**
+ * Create a float from the raw value, Mathematicians beware.
+ *
+ * @param rawValue
+ * The raw value( up to 64 bits)
+ * @param manBits
+ * number of bits in the mantissa
+ * @param expBits
+ * number of bits in the exponent
+ */
+ private static double createFloat(long rawValue, final int manBits,
+ final int expBits) {
+ long manShift = 1L << (manBits);
+ long manMask = manShift - 1;
+ long expMask = (1L << expBits) - 1;
+
+ int exp = (int) ((rawValue >> (manBits)) & expMask) + 1;
+ long man = (rawValue & manMask);
+ final int offsetExponent = exp - (1 << (expBits - 1));
+ double expPow = Math.pow(2.0, offsetExponent);
+ double ret = man * 1.0f;
+ ret /= manShift;
+ ret += 1.0;
+ ret *= expPow;
+ return ret;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (fAlignement ^ (fAlignement >>> 32));
+ result = prime * result + fByteOrder.toString().hashCode(); // don't evaluate object but string
+ result = prime * result + fExponent;
+ result = prime * result + fMantissa;
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ FloatDeclaration other = (FloatDeclaration) obj;
+ if (fAlignement != other.fAlignement) {
+ return false;
+ }
+ if (!fByteOrder.equals(other.fByteOrder)) {
+ return false;
+ }
+ if (fExponent != other.fExponent) {
+ return false;
+ }
+ if (fMantissa != other.fMantissa) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
+ return equals(obj);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF float definition.
+ *
+ * The definition of a floating point basic data type. It will take the data
+ * from a trace and store it (and make it fit) as a double.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class FloatDefinition extends Definition {
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final double fValue;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param value
+ * field value
+ */
+ public FloatDefinition(@NonNull FloatDeclaration declaration,
+ IDefinitionScope definitionScope, @NonNull String fieldName, double value) {
+ super(declaration, definitionScope, fieldName);
+ fValue = value;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * The value of a float stored, fit into a double. This should be extended
+ * for exotic floats if this is necessary.
+ *
+ * @return the value of the float field fit into a double.
+ */
+ public double getValue() {
+ return fValue;
+ }
+
+ @Override
+ public FloatDeclaration getDeclaration() {
+ return (FloatDeclaration) super.getDeclaration();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String toString() {
+ return String.valueOf(fValue);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.util.List;
+
+/**
+ * Interface for data definitions containing heterogenous definitions
+ * (subfields)
+ *
+ * @author Matthew Khouzam
+ */
+public interface ICompositeDefinition extends IDefinition {
+
+ /**
+ * Gets the definition of the field
+ *
+ * @param fieldName
+ * the fieldname
+ * @return The definitions of all the fields
+ */
+ Definition getDefinition(String fieldName);
+
+ /**
+ * Gets an array of the field names
+ *
+ * @return the field names array
+ */
+ List<String> getFieldNames();
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+/**
+ * A CTF data type declaration.
+ *
+ * An example: <br>
+ * int i = 0; <br>
+ * <b>int</b> is the declaration.<br>
+ * <b>i</b> is the definition.<br>
+ * <b>0</b> is the value assigned to the definition, not the declaration.<br>
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public interface IDeclaration {
+
+ /**
+ * Create a definition from this declaration
+ *
+ * @param definitionScope
+ * the definition scope, the parent where the definition will be
+ * placed
+ * @param fieldName
+ * the name of the definition
+ * @param input
+ * a bitbuffer to read from
+ * @return a reference to the definition
+ * @throws CTFException
+ * error in reading
+ */
+ Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException;
+
+ /**
+ * Get the path of a definition
+ *
+ * @param definitionScope
+ * the scope of the definition
+ * @param fieldName
+ * the name of the definition
+ * @return the path of the definition
+ * @since 1.0
+ */
+ @NonNull ILexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName);
+
+ /**
+ * The minimum alignment. if the field is 32 bits, the definition will pad
+ * all the data up to (position%32==0)
+ *
+ * @return the alignment in bits
+ */
+ long getAlignment();
+
+ /**
+ * The MAXIMUM size of this declaration (in bits).
+ *
+ * @return the maximum size
+ */
+ int getMaximumSize();
+
+ @Override
+ int hashCode();
+
+ @Override
+ boolean equals(Object other);
+
+ /**
+ * Are the two declarations equivalent on a binary level. eg: an 8 bit
+ * little endian and big endian int.
+ *
+ * @param other
+ * the other {@link IDeclaration}
+ * @return true if the binary CTF stream will generate the same value with
+ * the two streams
+ */
+ boolean isBinaryEquivalent(IDeclaration other);
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+/**
+ * Interface for data definitions. A definition is when a value is given to a
+ * declaration
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public interface IDefinition {
+
+ /**
+ * Get the complete path of this field.
+ *
+ * @return The path
+ * @since 1.0
+ */
+ ILexicalScope getScopePath();
+
+ /**
+ * Get the declaration of this definition
+ *
+ * @return the declaration of a datatype
+ */
+ IDeclaration getDeclaration();
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * Event header declaration abstract class
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public interface IEventHeaderDeclaration extends IDeclaration {
+ /**
+ * The id of an event
+ */
+ String ID = "id"; //$NON-NLS-1$
+ /**
+ * The name of a timestamp field
+ */
+ String TIMESTAMP = "timestamp"; //$NON-NLS-1$
+ /**
+ * Extended header
+ */
+ String EXTENDED = "extended"; //$NON-NLS-1$
+ /**
+ * Compact header (not to be confused with compact vs large)
+ */
+ String COMPACT = "compact"; //$NON-NLS-1$
+ /**
+ * Name of the variant according to the spec
+ */
+ String VARIANT_NAME = "v"; //$NON-NLS-1$
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+/**
+ * Common interface for simple CTF data types (which do not contain sub-fields).
+ *
+ * @author Matthew Khouzam
+ */
+public interface ISimpleDatatypeDeclaration {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Marc-Andre Laperle - Add min/maximum for validation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.math.BigInteger;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF integer declaration.
+ *
+ * The declaration of a integer basic data type.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+@NonNullByDefault
+public final class IntegerDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Helpers
+ // ------------------------------------------------------------------------
+
+ private static final int SIZE_64 = 64;
+ private static final int SIZE_32 = 32;
+ private static final int SIZE_27 = 27;
+ private static final int SIZE_16 = 16;
+ private static final int SIZE_8 = 8;
+ private static final int SIZE_5 = 5;
+ private static final int BYTE_ALIGN = 8;
+ private static final int BASE_10 = 10;
+ /**
+ * unsigned int 32 bits big endian
+ */
+ public static final IntegerDeclaration UINT_32B_DECL = new IntegerDeclaration(32, false, ByteOrder.BIG_ENDIAN);
+ /**
+ * unsigned int 32 bits little endian
+ */
+ public static final IntegerDeclaration UINT_32L_DECL = new IntegerDeclaration(32, false, ByteOrder.LITTLE_ENDIAN);
+ /**
+ * signed int 32 bits big endian
+ */
+ public static final IntegerDeclaration INT_32B_DECL = new IntegerDeclaration(32, true, ByteOrder.BIG_ENDIAN);
+ /**
+ * signed int 32 bits little endian
+ */
+ public static final IntegerDeclaration INT_32L_DECL = new IntegerDeclaration(32, true, ByteOrder.LITTLE_ENDIAN);
+ /**
+ * unsigned int 32 bits big endian
+ */
+ public static final IntegerDeclaration UINT_64B_DECL = new IntegerDeclaration(64, false, ByteOrder.BIG_ENDIAN);
+ /**
+ * unsigned int 64 bits little endian
+ */
+ public static final IntegerDeclaration UINT_64L_DECL = new IntegerDeclaration(64, false, ByteOrder.LITTLE_ENDIAN);
+ /**
+ * signed int 64 bits big endian
+ */
+ public static final IntegerDeclaration INT_64B_DECL = new IntegerDeclaration(64, true, ByteOrder.BIG_ENDIAN);
+ /**
+ * signed int 64 bits little endian
+ */
+ public static final IntegerDeclaration INT_64L_DECL = new IntegerDeclaration(64, true, ByteOrder.LITTLE_ENDIAN);
+ /**
+ * unsigned 8 bit int endianness doesn't matter since it's 8 bits (byte)
+ */
+ public static final IntegerDeclaration UINT_8_DECL = new IntegerDeclaration(8, false, ByteOrder.BIG_ENDIAN);
+ /**
+ * signed 8 bit int endianness doesn't matter since it's 8 bits (char)
+ */
+ public static final IntegerDeclaration INT_8_DECL = new IntegerDeclaration(8, true, ByteOrder.BIG_ENDIAN);
+ /**
+ * Unsigned 5 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_5B_DECL = new IntegerDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
+ /**
+ * Unsigned 5 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_5L_DECL = new IntegerDeclaration(5, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
+ /**
+ * Unsigned 5 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_27B_DECL = new IntegerDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
+ /**
+ * Unsigned 5 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_27L_DECL = new IntegerDeclaration(27, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
+ /**
+ * Unsigned 16 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_16B_DECL = new IntegerDeclaration(16, false, ByteOrder.BIG_ENDIAN);
+ /**
+ * Unsigned 16 bit int, used for event headers
+ */
+ public static final IntegerDeclaration UINT_16L_DECL = new IntegerDeclaration(16, false, ByteOrder.LITTLE_ENDIAN);
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final int fLength;
+ private final boolean fSigned;
+ private final int fBase;
+ private final ByteOrder fByteOrder;
+ private final Encoding fEncoding;
+ private final long fAlignment;
+ private final String fClock;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Factory, some common types cached
+ *
+ * @param len
+ * The length in bits
+ * @param signed
+ * Is the integer signed? false == unsigned
+ * @param base
+ * The base (10-16 are most common)
+ * @param byteOrder
+ * Big-endian little-endian or other
+ * @param encoding
+ * ascii, utf8 or none.
+ * @param clock
+ * The clock path, can be null
+ * @param alignment
+ * The minimum alignment. Should be >= 1
+ * @return the integer declaration
+ */
+ public static IntegerDeclaration createDeclaration(int len, boolean signed, int base,
+ @Nullable ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
+ if (encoding.equals(Encoding.NONE) && (clock.equals("")) && base == BASE_10) { //$NON-NLS-1$
+ if (alignment == BYTE_ALIGN) {
+ switch (len) {
+ case SIZE_8:
+ return signed ? INT_8_DECL : UINT_8_DECL;
+ case SIZE_16:
+ if (!signed) {
+ if (isBigEndian(byteOrder)) {
+ return UINT_16B_DECL;
+ }
+ return UINT_16L_DECL;
+ }
+ break;
+ case SIZE_32:
+ if (signed) {
+ if (isBigEndian(byteOrder)) {
+ return INT_32B_DECL;
+ }
+ return INT_32L_DECL;
+ }
+ if (isBigEndian(byteOrder)) {
+ return UINT_32B_DECL;
+ }
+ return UINT_32L_DECL;
+ case SIZE_64:
+ if (signed) {
+ if (isBigEndian(byteOrder)) {
+ return INT_64B_DECL;
+ }
+ return INT_64L_DECL;
+ }
+ if (isBigEndian(byteOrder)) {
+ return UINT_64B_DECL;
+ }
+ return UINT_64L_DECL;
+
+ default:
+
+ }
+
+ } else if (alignment == 1) {
+ switch (len) {
+ case SIZE_5:
+ if (!signed) {
+ if (isBigEndian(byteOrder)) {
+ return UINT_5B_DECL;
+ }
+ return UINT_5L_DECL;
+ }
+ break;
+ case SIZE_27:
+ if (!signed) {
+ if (isBigEndian(byteOrder)) {
+ return UINT_27B_DECL;
+ }
+ return UINT_27L_DECL;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return new IntegerDeclaration(len, signed, base, byteOrder, encoding, clock, alignment);
+ }
+
+ private static boolean isBigEndian(@Nullable ByteOrder byteOrder) {
+ return (byteOrder != null) && byteOrder.equals(ByteOrder.BIG_ENDIAN);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param len
+ * The length in bits
+ * @param signed
+ * Is the integer signed? false == unsigned
+ * @param base
+ * The base (10-16 are most common)
+ * @param byteOrder
+ * Big-endian little-endian or other
+ * @param encoding
+ * ascii, utf8 or none.
+ * @param clock
+ * The clock path, can be null
+ * @param alignment
+ * The minimum alignment. Should be ≥ 1
+ */
+ private IntegerDeclaration(int len, boolean signed, int base,
+ @Nullable ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
+ fLength = len;
+ fSigned = signed;
+ fBase = base;
+
+ fByteOrder = (byteOrder == null ? checkNotNull(ByteOrder.nativeOrder()) : byteOrder);
+
+ fEncoding = encoding;
+ fClock = clock;
+ fAlignment = Math.max(alignment, 1);
+ }
+
+ private IntegerDeclaration(int len, boolean signed, @Nullable ByteOrder byteOrder) {
+ this(len, signed, BASE_10, byteOrder, Encoding.NONE, "", BYTE_ALIGN); //$NON-NLS-1$
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Is the integer signed?
+ *
+ * @return the is the integer signed
+ */
+ public boolean isSigned() {
+ return fSigned;
+ }
+
+ /**
+ * Get the integer base commonly decimal or hex
+ *
+ * @return the integer base
+ */
+ public int getBase() {
+ return fBase;
+ }
+
+ /**
+ * Get the byte order
+ *
+ * @return the byte order
+ */
+ public ByteOrder getByteOrder() {
+ return fByteOrder;
+ }
+
+ /**
+ * Get encoding, chars are 8 bit ints
+ *
+ * @return the encoding
+ */
+ public Encoding getEncoding() {
+ return fEncoding;
+ }
+
+ /**
+ * Is the integer a character (8 bits and encoded?)
+ *
+ * @return is the integer a char
+ */
+ public boolean isCharacter() {
+ return (fLength == SIZE_8) && (fEncoding != Encoding.NONE);
+ }
+
+ /**
+ * Is the integer an unsigned byte (8 bits and no sign)?
+ *
+ * @return is the integer an unsigned byte
+ */
+ public boolean isUnsignedByte() {
+ return (fLength == SIZE_8) && (!fSigned);
+ }
+
+ /**
+ * Get the length in bits for this integer
+ *
+ * @return the length of the integer
+ */
+ public int getLength() {
+ return fLength;
+ }
+
+ @Override
+ public long getAlignment() {
+ return fAlignment;
+ }
+
+ /**
+ * The integer's clock, since timestamps are stored in ints
+ *
+ * @return the integer's clock, can be null. (most often it is)
+ */
+ public String getClock() {
+ return fClock;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return fLength;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public IntegerDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
+ String fieldName, BitBuffer input) throws CTFException {
+ ByteOrder byteOrder = input.getByteOrder();
+ input.setByteOrder(fByteOrder);
+ long value = read(input);
+ input.setByteOrder(byteOrder);
+ return new IntegerDefinition(this, definitionScope, fieldName, value);
+ }
+
+ @Override
+ public String toString() {
+ return "[declaration] integer[length:" + fLength + (fSigned ? " " : " un") + "signed" + " base:" + fBase + " byteOrder:" + fByteOrder + " encoding:" + fEncoding + " alignment:" + fAlignment + " clock:" + fClock + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
+ }
+
+ /**
+ * Get the maximum value for this integer declaration.
+ *
+ * @return The maximum value for this integer declaration
+ */
+ public BigInteger getMaxValue() {
+ /*
+ * Compute the number of bits able to represent an unsigned number,
+ * ignoring sign bit.
+ */
+ int significantBits = fLength - (fSigned ? 1 : 0);
+ /*
+ * For a given N significant bits, compute the maximal value which is (1
+ * << N) - 1.
+ */
+ return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).subtract(BigInteger.ONE));
+ }
+
+ /**
+ * Get the minimum value for this integer declaration.
+ *
+ * @return The minimum value for this integer declaration
+ */
+ public BigInteger getMinValue() {
+ if (!fSigned) {
+ return checkNotNull(BigInteger.ZERO);
+ }
+
+ /*
+ * Compute the number of bits able to represent an unsigned number,
+ * without the sign bit.
+ */
+ int significantBits = fLength - 1;
+ /*
+ * For a given N significant bits, compute the minimal value which is -
+ * (1 << N).
+ */
+ return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).negate());
+ }
+
+ private long read(BitBuffer input) throws CTFException {
+ /* Offset the buffer position wrt the current alignment */
+ alignRead(input);
+
+ boolean signed = isSigned();
+ int length = getLength();
+ long bits = 0;
+
+ /*
+ * Is the endianness of this field the same as the endianness of the
+ * input buffer? If not, then temporarily set the buffer's endianness to
+ * this field's just to read the data
+ */
+ ByteOrder previousByteOrder = input.getByteOrder();
+ if ((getByteOrder() != input.getByteOrder())) {
+ input.setByteOrder(getByteOrder());
+ }
+
+ if (length > SIZE_64) {
+ throw new CTFException("Cannot read an integer with over 64 bits. Length given: " + length); //$NON-NLS-1$
+ }
+
+ bits = input.get(length, signed);
+
+ /*
+ * Put the input buffer's endianness back to original if it was changed
+ */
+ if (previousByteOrder != input.getByteOrder()) {
+ input.setByteOrder(previousByteOrder);
+ }
+
+ return bits;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (fAlignment ^ (fAlignment >>> 32));
+ result = prime * result + fBase;
+ result = prime * result + fByteOrder.toString().hashCode();
+ result = prime * result + fClock.hashCode();
+ result = prime * result + fEncoding.hashCode();
+ result = prime * result + fLength;
+ result = prime * result + (fSigned ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ IntegerDeclaration other = (IntegerDeclaration) obj;
+ if (!isBinaryEquivalent(other)) {
+ return false;
+ }
+ if (!fByteOrder.equals(other.fByteOrder)) {
+ return false;
+ }
+ if (!fClock.equals(other.fClock)) {
+ return false;
+ }
+ if (fEncoding != other.fEncoding) {
+ return false;
+ }
+ if (fBase != other.fBase) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ IntegerDeclaration other = (IntegerDeclaration) obj;
+ return isBinaryEquivalent(other);
+ }
+
+ private boolean isBinaryEquivalent(IntegerDeclaration other) {
+ if (fAlignment != other.fAlignment) {
+ return false;
+ }
+ if (fLength != other.fLength) {
+ return false;
+ }
+ if (fSigned != other.fSigned) {
+ return false;
+ }
+ // no need for base
+ // no need for encoding
+ // no need for clock
+ // byte inversion is ok on byte order if the element is one byte long
+ if ((fLength != BYTE_ALIGN) && !fByteOrder.equals(other.fByteOrder)) {
+ return false;
+ }
+ return true;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.math.BigInteger;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF integer definition.
+ *
+ * The definition of a integer basic data type. It will take the data from a
+ * trace and store it (and make it fit) as a long.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class IntegerDefinition extends SimpleDatatypeDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final int INT_BASE_10 = 10;
+ private static final int INT_BASE_16 = 16;
+ private static final int INT_BASE_8 = 8;
+ private static final int INT_BASE_2 = 2;
+ private final long fValue;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param value
+ * integer value
+ */
+ public IntegerDefinition(@NonNull IntegerDeclaration declaration,
+ IDefinitionScope definitionScope, @NonNull String fieldName, long value) {
+ super(declaration, definitionScope, fieldName);
+ fValue = value;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the value of the integer
+ *
+ * @return the value of the integer (in long)
+ */
+ public long getValue() {
+ return fValue;
+ }
+
+ @Override
+ public IntegerDeclaration getDeclaration() {
+ return (IntegerDeclaration) super.getDeclaration();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public Long getIntegerValue() {
+ return getValue();
+ }
+
+ @Override
+ public String getStringValue() {
+ return this.toString();
+ }
+
+ @Override
+ public String toString() {
+ if (getDeclaration().isCharacter()) {
+ char c = (char) fValue;
+ return Character.toString(c);
+ }
+ return formatNumber(fValue, getDeclaration().getBase(), getDeclaration().isSigned());
+ }
+
+ /**
+ * Print a numeric value as a string in a given base
+ *
+ * @param value
+ * The value to print as string
+ * @param base
+ * The base for this value
+ * @param signed
+ * Is the value signed or not
+ * @return formatted number string
+ */
+ public static String formatNumber(long value, int base, boolean signed) {
+ String s;
+ /* Format the number correctly according to the integer's base */
+ switch (base) {
+ case INT_BASE_2:
+ s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
+ break;
+ case INT_BASE_8:
+ s = "0" + Long.toOctalString(value); //$NON-NLS-1$
+ break;
+ case INT_BASE_16:
+ s = "0x" + Long.toHexString(value); //$NON-NLS-1$
+ break;
+ case INT_BASE_10:
+ default:
+ /* For non-standard base, we'll just print it as a decimal number */
+ if (!signed && value < 0) {
+ /*
+ * Since there are no 'unsigned long', handle this case with
+ * BigInteger
+ */
+ BigInteger bigInteger = BigInteger.valueOf(value);
+ /*
+ * we add 2^64 to the negative number to get the real unsigned
+ * value
+ */
+ bigInteger = bigInteger.add(BigInteger.valueOf(1).shiftLeft(64));
+ s = bigInteger.toString();
+ } else {
+ s = Long.toString(value);
+ }
+ break;
+ }
+ return s;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+/**
+ * Scoped defintion. a defintion where you can lookup various datatypes
+ *
+ * TODO: replace by default methods and an interface when java 8 is upon us
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public abstract class ScopedDefinition extends Definition implements IDefinitionScope {
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the event declaration
+ * @param definitionScope
+ * the definition is in a scope, (normally a struct) what is it?
+ * @param fieldName
+ * the name of the definition. (it is a field in the parent
+ * scope)
+ */
+ public ScopedDefinition(IDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName) {
+ super(declaration, definitionScope, fieldName);
+ }
+
+ /**
+ * Constructor This one takes the scope and thus speeds up definition
+ * creation
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param scope
+ * the lexical scope
+ * @since 1.0
+ */
+ public ScopedDefinition(StructDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName, ILexicalScope scope) {
+ super(declaration, definitionScope, fieldName, scope);
+ }
+
+ /**
+ * Lookup an array in a struct. If the name returns a non-array (like an
+ * int) then the method returns null
+ *
+ * @param name
+ * the name of the array
+ * @return the array or null.
+ */
+ public @Nullable AbstractArrayDefinition lookupArrayDefinition(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (AbstractArrayDefinition) ((def instanceof AbstractArrayDefinition) ? def : null);
+ }
+
+
+ /**
+ * Lookup an enum in a struct. If the name returns a non-enum (like an int)
+ * then the method returns null
+ *
+ * @param name
+ * the name of the enum
+ * @return the enum or null if a definition is not found or it does not
+ * match the desired datatype.
+ */
+ @Nullable
+ public EnumDefinition lookupEnum(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (EnumDefinition) ((def instanceof EnumDefinition) ? def : null);
+ }
+
+ /**
+ * Lookup an integer in a struct. If the name returns a non-integer (like an
+ * float) then the method returns null
+ *
+ * @param name
+ * the name of the integer
+ * @return the integer or null if a definition is not found or it does not
+ * match the desired datatype.
+ */
+ @Nullable
+ public IntegerDefinition lookupInteger(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (IntegerDefinition) ((def instanceof IntegerDefinition) ? def : null);
+ }
+
+ /**
+ * Lookup a string in a struct. If the name returns a non-string (like an
+ * int) then the method returns null
+ *
+ * @param name
+ * the name of the string
+ * @return the string or null if a definition is not found or it does not
+ * match the desired datatype.
+ */
+ @Nullable
+ public StringDefinition lookupString(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (StringDefinition) ((def instanceof StringDefinition) ? def : null);
+ }
+
+ /**
+ * Lookup a struct in a struct. If the name returns a non-struct (like an
+ * int) then the method returns null
+ *
+ * @param name
+ * the name of the struct
+ * @return the struct or null if a definition is not found or it does not
+ * match the desired datatype.
+ */
+ @Nullable
+ public StructDefinition lookupStruct(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (StructDefinition) ((def instanceof StructDefinition) ? def : null);
+ }
+
+ /**
+ * Lookup a variant in a struct. If the name returns a non-variant (like an
+ * int) then the method returns null
+ *
+ * @param name
+ * the name of the variant
+ * @return the variant or null if a definition is not found or it does not
+ * match the desired datatype.
+ */
+ @Nullable
+ public VariantDefinition lookupVariant(String name) {
+ IDefinition def = lookupDefinition(name);
+ return (VariantDefinition) ((def instanceof VariantDefinition) ? def : null);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * Simple Datatype definition is a datatype that allows the addition of
+ * getIntegerValue and getStringValue to a class.
+ *
+ * @author Matthew Khouzam
+ */
+public abstract class SimpleDatatypeDefinition extends Definition {
+
+ /**
+ * Create a new SimpleDatatypeDefinition
+ *
+ * @param declaration
+ * definition's declaration
+ * @param definitionScope
+ * The scope of this definition
+ * @param fieldName
+ * The name of the field matching this definition in the parent
+ * scope
+ */
+ public SimpleDatatypeDefinition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope,
+ @NonNull String fieldName) {
+ super(declaration, definitionScope, fieldName);
+ }
+
+ /**
+ * Gets the value in integer form
+ *
+ * @return the integer in a Long, can be null
+ */
+ public Long getIntegerValue() {
+ return null;
+ }
+
+ /**
+ * Gets the value in string form
+ *
+ * @return the integer in a String, can be null
+ */
+ public String getStringValue() {
+ return null;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF string declaration.
+ *
+ * Strings are an array of bytes of variable size and are terminated by a '\0'
+ * "NULL" character. Their encoding is described in the TSDL meta-data. In
+ * absence of encoding attribute information, the default encoding is UTF-8.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+@NonNullByDefault
+public class StringDeclaration extends Declaration {
+
+ private static final StringDeclaration STRING_DEC_UTF8 = new StringDeclaration(Encoding.UTF8);
+ private static final StringDeclaration STRING_DEC_ASCII = new StringDeclaration(Encoding.ASCII);
+ private static final StringDeclaration STRING_DEC_NO_ENC = new StringDeclaration(Encoding.NONE);
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final int BITS_PER_BYTE = Byte.SIZE;
+ private final Encoding fEncoding;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Generate an encoded string declaration
+ *
+ * @param encoding
+ * the encoding, utf8 or ascii
+ */
+ private StringDeclaration(Encoding encoding) {
+ fEncoding = encoding;
+ }
+
+ /**
+ * Create a StringDeclaration with the default UTF-8 encoding
+ *
+ * @return a {@link StringDeclaration} with UTF-8 encoding
+ */
+ public static StringDeclaration getStringDeclaration() {
+ return STRING_DEC_UTF8;
+ }
+
+ /**
+ * Create a StringDeclaration
+ *
+ * @param encoding
+ * the {@link Encoding} can be Encoding.UTF8, Encoding.ASCII or
+ * other
+ * @return a {@link StringDeclaration}
+ * @throws IllegalArgumentException
+ * if the encoding is not recognized.
+ */
+ public static StringDeclaration getStringDeclaration(Encoding encoding) {
+ switch (encoding) {
+ case ASCII:
+ return STRING_DEC_ASCII;
+ case NONE:
+ return STRING_DEC_NO_ENC;
+ case UTF8:
+ return STRING_DEC_UTF8;
+ default:
+ throw new IllegalArgumentException("Unrecognized encoding: " + encoding); //$NON-NLS-1$
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ *
+ * @return the character encoding.
+ */
+ public Encoding getEncoding() {
+ return fEncoding;
+ }
+
+ @Override
+ public long getAlignment() {
+ // See ctf 4.2.5: Strings are always aligned on byte size.
+ return BITS_PER_BYTE;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ /*
+ * Every definition can have a different size, so we do not scope this.
+ * Minimum size is one byte (8 bits) though.
+ */
+ return 8;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public StringDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
+ String fieldName, BitBuffer input) throws CTFException {
+ String value = read(input);
+ return new StringDefinition(this, definitionScope, fieldName, value);
+ }
+
+ private String read(BitBuffer input) throws CTFException {
+ /* Offset the buffer position wrt the current alignment */
+ alignRead(input);
+
+ StringBuilder sb = new StringBuilder();
+ char c = (char) input.get(BITS_PER_BYTE, false);
+ while (c != 0) {
+ sb.append(c);
+ c = (char) input.get(BITS_PER_BYTE, false);
+ }
+ return NonNullUtils.checkNotNull(sb.toString());
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ return "[declaration] string[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = prime;
+ switch (fEncoding) {
+ case ASCII:
+ result += 1;
+ break;
+ case NONE:
+ result += 2;
+ break;
+ case UTF8:
+ result += 3;
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ StringDeclaration other = (StringDeclaration) obj;
+ if (fEncoding != other.fEncoding) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
+ return equals(other);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF string definition (similar to a C null-terminated byte array).
+ *
+ * Strings are an array of bytes of variable size and are terminated by a '\0'
+ * "NULL" character. Their encoding is described in the TSDL meta-data. In
+ * absence of encoding attribute information, the default encoding is UTF-8.
+ *
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class StringDefinition extends Definition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final String fString;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param value
+ * The String value
+ */
+ public StringDefinition(@NonNull StringDeclaration declaration,
+ IDefinitionScope definitionScope, @NonNull String fieldName, String value) {
+ super(declaration, definitionScope, fieldName);
+ fString = value;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public StringDeclaration getDeclaration() {
+ return (StringDeclaration) super.getDeclaration();
+ }
+
+ /**
+ * Gets the string (value)
+ *
+ * @return the string
+ */
+ public String getValue() {
+ return fString;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String toString() {
+ return '\"' + getValue() + '\"';
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+/**
+ * A CTF structure declaration.
+ *
+ * A structure is similar to a C structure, it is a compound data type that
+ * contains other datatypes in fields. they are stored in an hashmap and indexed
+ * by names which are strings.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public class StructDeclaration extends Declaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /** linked list of field names. So fieldName->fieldValue */
+ private final @NonNull Map<String, IDeclaration> fFieldMap = new LinkedHashMap<>();
+
+ /** maximum bit alignment */
+ private long fMaxAlign;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The struct declaration, add fields later
+ *
+ * @param align
+ * the minimum alignment of the struct. (if a struct is 8bit
+ * aligned and has a 32 bit aligned field, the struct becomes 32
+ * bit aligned.
+ */
+ public StructDeclaration(long align) {
+ fMaxAlign = Math.max(align, 1);
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get current alignment
+ *
+ * @return the alignment of the struct and all its fields
+ */
+ public long getMaxAlign() {
+ return fMaxAlign;
+ }
+
+ /**
+ * Query if the struct has a given field
+ *
+ * @param name
+ * the name of the field, scopeless please
+ * @return does the field exist?
+ */
+ public boolean hasField(String name) {
+ return fFieldMap.containsKey(name);
+ }
+
+ /**
+ * Get the fields of the struct as a map.
+ *
+ * @return a Map of the fields (key is the name)
+ */
+ public Map<String, IDeclaration> getFields() {
+ return fFieldMap;
+ }
+
+ /**
+ * Get the field declaration corresponding to a field name.
+ *
+ * @param fieldName
+ * The field name
+ * @return The declaration of the field, or null if there is no such field.
+ */
+ @Nullable
+ public IDeclaration getField(String fieldName) {
+ return fFieldMap.get(fieldName);
+ }
+
+ /**
+ * Gets the field list. Very important since the map of fields does not
+ * retain the order of the fields.
+ *
+ * @return the field list.
+ */
+ public Iterable<String> getFieldsList() {
+ return fFieldMap.keySet();
+ }
+
+ @Override
+ public long getAlignment() {
+ return this.fMaxAlign;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ int maxSize = 0;
+ for (IDeclaration field : fFieldMap.values()) {
+ maxSize += field.getMaximumSize();
+ }
+ return Math.min(maxSize, Integer.MAX_VALUE);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public StructDefinition createDefinition(IDefinitionScope definitionScope,
+ String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ final Definition[] myFields = new Definition[fFieldMap.size()];
+ StructDefinition structDefinition = new StructDefinition(this, definitionScope, fieldName, myFields);
+ fillStruct(input, myFields, structDefinition);
+ return structDefinition;
+ }
+
+ /**
+ * Create a definition from this declaration. This is a faster constructor
+ * as it has a lexical scope and this does not need to look it up.
+ *
+ * @param definitionScope
+ * the definition scope, the parent where the definition will be
+ * placed
+ * @param fieldScope
+ * the scope of the definition
+ * @param input
+ * a bitbuffer to read from
+ * @return a reference to the definition
+ * @throws CTFException
+ * error in reading
+ * @since 1.0
+ */
+ public StructDefinition createDefinition(IDefinitionScope definitionScope,
+ ILexicalScope fieldScope, @NonNull BitBuffer input) throws CTFException {
+ alignRead(input);
+ final Definition[] myFields = new Definition[fFieldMap.size()];
+
+ StructDefinition structDefinition = new StructDefinition(this,definitionScope,
+ fieldScope, fieldScope.getName(), checkNotNull(fFieldMap.keySet()), myFields);
+ fillStruct(input, myFields, structDefinition);
+ return structDefinition;
+ }
+
+ /**
+ * Add a field to the struct
+ *
+ * @param name
+ * the name of the field, scopeless
+ * @param declaration
+ * the declaration of the field
+ */
+ public void addField(String name, IDeclaration declaration) {
+ fFieldMap.put(name, declaration);
+ fMaxAlign = Math.max(fMaxAlign, declaration.getAlignment());
+ }
+
+ private void fillStruct(@NonNull BitBuffer input, final Definition[] myFields, StructDefinition structDefinition) throws CTFException {
+ Iterator<Map.Entry<String, IDeclaration>> iter = fFieldMap.entrySet().iterator();
+ for (int i = 0; i < fFieldMap.size(); i++) {
+ Map.Entry<String, IDeclaration> entry = iter.next();
+ /* We should not have inserted null keys... */
+ String key = checkNotNull(entry.getKey());
+ myFields[i] = entry.getValue().createDefinition(structDefinition, key, input);
+ }
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ StringBuilder sb = new StringBuilder();
+ sb.append("[declaration] struct["); //$NON-NLS-1$
+ for (Entry<String, IDeclaration> field : fFieldMap.entrySet()) {
+ sb.append(field.getKey()).append(':').append(field.getValue());
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ for (Entry<String, IDeclaration> field : fFieldMap.entrySet()) {
+ result = prime * result + field.getKey().hashCode();
+ result = prime * result + field.getValue().hashCode();
+ }
+ result = (prime * result) + (int) (fMaxAlign ^ (fMaxAlign >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof StructDeclaration)) {
+ return false;
+ }
+ StructDeclaration other = (StructDeclaration) obj;
+ if (fFieldMap.size() != other.fFieldMap.size()) {
+ return false;
+ }
+
+ List<String> localFieldNames = new ArrayList<>();
+ localFieldNames.addAll(fFieldMap.keySet());
+
+ List<IDeclaration> localDecs = new ArrayList<>();
+ localDecs.addAll(fFieldMap.values());
+
+ List<String> otherFieldNames = new ArrayList<>();
+ otherFieldNames.addAll(other.fFieldMap.keySet());
+
+ List<IDeclaration> otherDecs = new ArrayList<>();
+ otherDecs.addAll(other.fFieldMap.values());
+
+ //check fields in order
+ for (int i = 0; i < fFieldMap.size(); i++) {
+ if ((!localFieldNames.get(i).equals(otherFieldNames.get(i))) ||
+ (!otherDecs.get(i).equals(localDecs.get(i)))) {
+ return false;
+ }
+ }
+
+ if (fMaxAlign != other.fMaxAlign) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof StructDeclaration)) {
+ return false;
+ }
+ StructDeclaration other = (StructDeclaration) obj;
+ if (fFieldMap.size() != other.fFieldMap.size()) {
+ return false;
+ }
+ List<IDeclaration> localDecs = new ArrayList<>();
+ localDecs.addAll(fFieldMap.values());
+ List<IDeclaration> otherDecs = new ArrayList<>();
+ otherDecs.addAll(other.fFieldMap.values());
+ for (int i = 0; i < fFieldMap.size(); i++) {
+ if (!otherDecs.get(i).isBinaryEquivalent(localDecs.get(i))) {
+ return false;
+ }
+ }
+
+ if (fMaxAlign != other.fMaxAlign) {
+ return false;
+ }
+ return true;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+
+/**
+ * A CTF structure definition (similar to a C structure).
+ *
+ * A structure is similar to a C structure, it is a compound data type that
+ * contains other datatypes in fields. they are stored in an hashmap and indexed
+ * by names which are strings.
+ *
+ * TODO: move me to internal
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class StructDefinition extends ScopedDefinition implements ICompositeDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final ImmutableList<String> fFieldNames;
+ private final Definition[] fDefinitions;
+ private Map<String, Definition> fDefinitionsMap = null;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param structFieldName
+ * the field name
+ * @param definitions
+ * the definitions
+ * @since 1.0
+ */
+ public StructDefinition(@NonNull StructDeclaration declaration,
+ IDefinitionScope definitionScope,
+ @NonNull String structFieldName,
+ Definition[] definitions) {
+ super(declaration, definitionScope, structFieldName);
+ fFieldNames = ImmutableList.copyOf(declaration.getFieldsList());
+ fDefinitions = definitions;
+ if (fFieldNames.isEmpty()) {
+ fDefinitionsMap = Collections.EMPTY_MAP;
+ }
+ }
+
+ /**
+ * Constructor This one takes the scope and thus speeds up definition
+ * creation
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param scope
+ * the scope of this variable
+ * @param structFieldName
+ * the field name
+ * @param fieldNames
+ * the list of fields
+ * @param definitions
+ * the definitions
+ * @since 1.0
+ */
+ public StructDefinition(@NonNull StructDeclaration declaration,
+ IDefinitionScope definitionScope, @NonNull ILexicalScope scope,
+ @NonNull String structFieldName, @NonNull Iterable<String> fieldNames, Definition[] definitions) {
+ super(declaration, definitionScope, structFieldName, scope);
+ fFieldNames = ImmutableList.copyOf(fieldNames);
+ fDefinitions = definitions;
+ if (fFieldNames.isEmpty()) {
+ fDefinitionsMap = Collections.EMPTY_MAP;
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public Definition getDefinition(String fieldName) {
+ if (fDefinitionsMap == null) {
+ /* Build the definitions map */
+ Builder<String, Definition> mapBuilder = new ImmutableMap.Builder<>();
+ for (int i = 0; i < fFieldNames.size(); i++) {
+ if (fDefinitions[i] != null) {
+ mapBuilder.put(fFieldNames.get(i), fDefinitions[i]);
+ }
+ }
+ fDefinitionsMap = mapBuilder.build();
+ }
+ return fDefinitionsMap.get(fieldName);
+ }
+
+ @Override
+ public List<String> getFieldNames() {
+ return fFieldNames;
+ }
+
+ @Override
+ public StructDeclaration getDeclaration() {
+ return (StructDeclaration) super.getDeclaration();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public Definition lookupDefinition(String lookupPath) {
+ /*
+ * The fields are created in order of appearance, so if a variant or
+ * sequence refers to a field that is after it, the field's definition
+ * will not be there yet in the hashmap.
+ */
+ int val = fFieldNames.indexOf(lookupPath);
+ if (val != -1) {
+ return fDefinitions[val];
+ }
+ String lookupUnderscored = "_" + lookupPath; //$NON-NLS-1$
+ val = fFieldNames.indexOf(lookupUnderscored);
+ if (val != -1) {
+ return fDefinitions[val];
+ }
+ return null;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("{ "); //$NON-NLS-1$
+
+ if (fFieldNames != null) {
+ List<String> fields = new LinkedList<>();
+ for (String field : fFieldNames) {
+ String appendee = field + " = " + lookupDefinition(field).toString(); //$NON-NLS-1$
+ fields.add(appendee);
+ }
+ Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
+ builder.append(joiner.join(fields));
+ }
+
+ builder.append(" }"); //$NON-NLS-1$
+
+ return builder.toString();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF C variant declaration.
+ *
+ * A variant is similar to a C union, only taking the minimum size of the types,
+ * it is a compound data type that contains other datatypes in fields. they are
+ * stored in an hashmap and indexed by names which are strings.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public class VariantDeclaration extends Declaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private String fTag = null;
+ private static final long ALIGNMENT = 1;
+ private final Map<String, IDeclaration> fFields = Collections.synchronizedMap(new HashMap<String, IDeclaration>());
+ private IDeclaration fDeclarationToPopulate;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ */
+ public VariantDeclaration() {
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * @return Does the variant have a tag
+ */
+ public boolean isTagged() {
+ return fTag != null;
+ }
+
+ /**
+ * Lookup if a field exists in the variant
+ *
+ * @param fieldTag
+ * the field tag name
+ * @return true = field tag exists
+ */
+ public boolean hasField(String fieldTag) {
+ return fFields.containsKey(fieldTag);
+ }
+
+ /**
+ * Sets the tag in a variant
+ *
+ * @param tag
+ * the tag
+ */
+ public void setTag(String tag) {
+ fTag = tag;
+ }
+
+ /**
+ * Gets current variant tag
+ *
+ * @return the variant tag.
+ */
+ public String getTag() {
+ return fTag;
+ }
+
+ /**
+ * Gets the fields of the variant
+ *
+ * @return the fields of the variant
+ */
+ public Map<String, IDeclaration> getFields() {
+ return this.fFields;
+ }
+
+ @Override
+ public long getAlignment() {
+ return ALIGNMENT;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public VariantDefinition createDefinition(IDefinitionScope definitionScope,
+ String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ IDefinition def = definitionScope.lookupDefinition(fTag);
+ EnumDefinition tagDef = (EnumDefinition) ((def instanceof EnumDefinition) ? def : null);
+ if (tagDef == null) {
+ throw new CTFException("Tag is not defined " + fTag); //$NON-NLS-1$
+ }
+ String varFieldName = tagDef.getStringValue();
+ fDeclarationToPopulate = fFields.get(varFieldName);
+ if (fDeclarationToPopulate == null) {
+ throw new CTFException("Unknown enum selector for variant " + //$NON-NLS-1$
+ definitionScope.getScopePath().getPath());
+ }
+ Definition fieldValue = fDeclarationToPopulate.createDefinition(definitionScope, fieldName, input);
+ return new VariantDefinition(this, definitionScope, varFieldName, fieldName, fieldValue);
+ }
+
+ /**
+ * Add a field to this CTF Variant
+ *
+ * @param fieldTag
+ * The tag of the new field
+ * @param declaration
+ * The Declaration of this new field
+ */
+ public void addField(String fieldTag, IDeclaration declaration) {
+ fFields.put(fieldTag, declaration);
+ }
+
+ @Override
+ public int getMaximumSize() {
+ Collection<IDeclaration> values = fFields.values();
+ int maxSize = 0;
+ for (IDeclaration field : values) {
+ maxSize = Math.max(maxSize, field.getMaximumSize());
+ }
+ return maxSize;
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ StringBuilder sb = new StringBuilder();
+ sb.append("[declaration] variant["); //$NON-NLS-1$
+ for (Entry<String, IDeclaration> field : fFields.entrySet()) {
+ sb.append(field.getKey()).append(':').append(field.getValue());
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fDeclarationToPopulate == null) ? 0 : fDeclarationToPopulate.hashCode());
+ if (fFields == null) {
+ result = prime * result;
+ } else {
+ for (Entry<String, IDeclaration> field : fFields.entrySet()) {
+ result = prime * result + field.getValue().hashCode();
+ }
+ }
+ result = prime * result + ((fTag == null) ? 0 : fTag.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ VariantDeclaration other = (VariantDeclaration) obj;
+
+ if (!equalsNullable(fDeclarationToPopulate, other.fDeclarationToPopulate)) {
+ return false;
+ }
+ // do not check the order of the fields
+ if (!equalsNullable(fFields, other.fFields)) {
+ return false;
+ }
+ if (!equalsNullable(fTag, other.fTag)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ VariantDeclaration other = (VariantDeclaration) obj;
+ if (fFields == null) {
+ if (other.fFields != null) {
+ return false;
+ }
+ } else {
+ if (fFields.size() != other.fFields.size()) {
+ return false;
+ }
+ for (Entry<String, IDeclaration> field : fFields.entrySet()) {
+ if (!other.fFields.containsKey(field.getKey())) {
+ return false;
+ }
+ IDeclaration field2 = other.fFields.get(field.getKey());
+ if (!field2.isBinaryEquivalent(field.getValue())) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+
+/**
+ * A CTF variant definition (similar to a C union).
+ *
+ * A variant is similar to a C union, only taking the minimum size of the types,
+ * it is a compound data type that contains other datatypes in fields. they are
+ * stored in an hashmap and indexed by names which are strings.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class VariantDefinition extends ScopedDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final Definition fDefinition;
+ private final String fCurrentField;
+ private final String fFieldName;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param selectedField
+ * the selected field
+ * @param fieldName
+ * the field name
+ * @param fieldValue
+ * the field value
+ */
+ public VariantDefinition(@NonNull VariantDeclaration declaration,
+ IDefinitionScope definitionScope, String selectedField, @NonNull String fieldName, Definition fieldValue) {
+ super(declaration, definitionScope, fieldName);
+
+ fFieldName = fieldName;
+ fCurrentField = selectedField;
+ fDefinition = fieldValue;
+
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public VariantDeclaration getDeclaration() {
+ return (VariantDeclaration) super.getDeclaration();
+ }
+
+ /**
+ * Get the current field name
+ *
+ * @return the current field name
+ */
+ public String getCurrentFieldName() {
+ return fCurrentField;
+ }
+
+ /**
+ * Get the current field
+ *
+ * @return the current field
+ */
+ public Definition getCurrentField() {
+ return fDefinition;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public IDefinition lookupDefinition(String lookupPath) {
+ if (lookupPath == null) {
+ return null;
+ }
+ if (lookupPath.equals(fFieldName)) {
+ return fDefinition;
+ }
+ return getDefinitionScope().lookupDefinition(lookupPath);
+ }
+
+ @Override
+ public String toString() {
+ return "{ " + getCurrentFieldName() + //$NON-NLS-1$
+ " = " + getCurrentField() + //$NON-NLS-1$
+ " }"; //$NON-NLS-1$
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+
+/**
+ * An exception just for trace readers and writers
+ *
+ * @since 1.0
+ */
+public class CTFIOException extends CTFException {
+
+ /**
+ * Unique ID
+ */
+ private static final long serialVersionUID = -2216400542574921838L;
+
+ /**
+ * Constructor with an attached message.
+ *
+ * @param message
+ * The message attached to this exception
+ */
+ public CTFIOException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor with an attached message.
+ *
+ * @param e
+ * The exception attached to this exception
+ */
+ public CTFIOException(Exception e) {
+ super(e);
+ }
+
+ /**
+ * Constructor with an attached message and exception.
+ *
+ * @param message
+ * The message attached to this exception
+ * @param e
+ * The encapsulated exception
+ * @since 1.0
+ */
+ public CTFIOException(String message, Exception e) {
+ super(message, e);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.trace;
+
+/**
+ * A response to a request
+ *
+ * @author Matthew Khouzam
+ */
+public enum CTFResponse {
+ /**
+ * The operation was successful
+ */
+ OK,
+ /**
+ * The operation cannot be yet completed
+ */
+ WAIT,
+ /**
+ * The operation was finished
+ */
+ FINISH,
+ /**
+ * The operation failed
+ */
+ ERROR
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+
+/**
+ * <b><u>Stream</u></b>
+ * <p>
+ * Represents a stream in a trace.
+ */
+public class CTFStream {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The numerical ID of the stream
+ */
+ private long fId = 0;
+
+ /**
+ * Declarations of the stream-specific structures
+ */
+ private StructDeclaration fPacketContextDecl = null;
+ private IDeclaration fEventHeaderDecl = null;
+ private StructDeclaration fEventContextDecl = null;
+
+ /**
+ * The trace to which the stream belongs
+ */
+ private CTFTrace fTrace = null;
+
+ /**
+ * Maps event ids to events
+ */
+ private final ArrayList<IEventDeclaration> fEvents = new ArrayList<>();
+
+ private boolean fEventUnsetId = false;
+ private boolean fStreamIdSet = false;
+
+ /**
+ * The inputs associated to this stream
+ */
+ private final Set<CTFStreamInput> fInputs = new HashSet<>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a Stream that belongs to a Trace
+ *
+ * @param trace
+ * The trace to which belongs this stream.
+ */
+ public CTFStream(CTFTrace trace) {
+ fTrace = trace;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Sets the id of a stream
+ *
+ * @param id
+ * the id of a stream
+ */
+ public void setId(long id) {
+ fId = id;
+ fStreamIdSet = true;
+ }
+
+ /**
+ * Gets the id of a stream
+ *
+ * @return id the id of a stream
+ * @since 1.0
+ */
+ public long getId() {
+ return fId;
+ }
+
+ /**
+ * Is the id of a stream set
+ *
+ * @return If the ID is set or not
+ */
+ public boolean isIdSet() {
+ return fStreamIdSet;
+ }
+
+ /**
+ *
+ * @return is the event header set (timestamp and stuff) (see Ctf Spec)
+ */
+ public boolean isEventHeaderSet() {
+ return fEventHeaderDecl != null;
+ }
+
+ /**
+ *
+ * @return is the event context set (pid and stuff) (see Ctf Spec)
+ */
+ public boolean isEventContextSet() {
+ return fEventContextDecl != null;
+ }
+
+ /**
+ *
+ * @return Is the packet context set (see Ctf Spec)
+ */
+ public boolean isPacketContextSet() {
+ return fPacketContextDecl != null;
+ }
+
+ /**
+ * Sets the event header
+ *
+ * @param eventHeader
+ * the current event header for all events in this stream
+ */
+ public void setEventHeader(StructDeclaration eventHeader) {
+ fEventHeaderDecl = eventHeader;
+ }
+
+ /**
+ * Sets the event header, this typically has the id and the timestamp
+ *
+ * @param eventHeader
+ * the current event header for all events in this stream
+ */
+ public void setEventHeader(IEventHeaderDeclaration eventHeader) {
+ fEventHeaderDecl = eventHeader;
+ }
+
+ /**
+ *
+ * @param eventContext
+ * the context for all events in this stream
+ */
+ public void setEventContext(StructDeclaration eventContext) {
+ fEventContextDecl = eventContext;
+ }
+
+ /**
+ *
+ * @param packetContext
+ * the packet context for all packets in this stream
+ */
+ public void setPacketContext(StructDeclaration packetContext) {
+ fPacketContextDecl = packetContext;
+ }
+
+ /**
+ * Gets the event header declaration
+ *
+ * @return the event header declaration in declaration form
+ */
+ public IDeclaration getEventHeaderDeclaration() {
+ return fEventHeaderDecl;
+ }
+
+ /**
+ *
+ * @return the event context declaration in structdeclaration form
+ */
+ public StructDeclaration getEventContextDecl() {
+ return fEventContextDecl;
+ }
+
+ /**
+ *
+ * @return the packet context declaration in structdeclaration form
+ */
+ public StructDeclaration getPacketContextDecl() {
+ return fPacketContextDecl;
+ }
+
+ /**
+ *
+ * @return the set of all stream inputs for this stream
+ */
+ public Set<CTFStreamInput> getStreamInputs() {
+ return fInputs;
+ }
+
+ /**
+ *
+ * @return the parent trace
+ */
+ public CTFTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Get all the event declarations in this stream.
+ *
+ * @return The event declarations for this stream
+ */
+ public @NonNull Collection<IEventDeclaration> getEventDeclarations() {
+ List<IEventDeclaration> retVal = new ArrayList<>(fEvents);
+ retVal.removeAll(Collections.<IEventDeclaration> singletonList(null));
+ return retVal;
+ }
+
+ /**
+ * Get the event declaration for a given ID.
+ *
+ * @param eventId
+ * The ID, can be {@link EventDeclaration#UNSET_EVENT_ID}, or any
+ * positive value
+ * @return The event declaration with the given ID for this stream, or
+ * 'null' if there are no declaration with this ID
+ * @throws IllegalArgumentException
+ * If the passed ID is invalid
+ */
+ public @Nullable IEventDeclaration getEventDeclaration(int eventId) {
+ int eventIndex = (eventId == IEventDeclaration.UNSET_EVENT_ID) ? 0 : eventId;
+ if (eventIndex < 0) {
+ /* Any negative value other than UNSET_EVENT_ID is invalid */
+ throw new IllegalArgumentException("Event ID cannot be negative."); //$NON-NLS-1$
+ }
+ if (eventIndex >= fEvents.size()) {
+ /* This ID could be valid, but there are no declarations with it */
+ return null;
+ }
+ return fEvents.get(eventIndex);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Adds an event to the event list.
+ *
+ * An event in a stream can omit its id if it is the only event in this
+ * stream. An event for which no id has been specified has a null id. It is
+ * thus not possible to add an event with the null key if the map is not
+ * empty. It is also not possible to add an event to the map if the null key
+ * is present in the map.
+ *
+ * @param event
+ * The event to add
+ * @throws ParseException
+ * If there was a problem reading the event or adding it to the
+ * stream
+ */
+ public void addEvent(IEventDeclaration event) throws ParseException {
+ if (fEventUnsetId) {
+ throw new ParseException("Event without id with multiple events in a stream"); //$NON-NLS-1$
+ }
+ int id = ((EventDeclaration) event).id();
+
+ /*
+ * If there is an event without id (the null key), it must be the only
+ * one
+ */
+ if (id == IEventDeclaration.UNSET_EVENT_ID) {
+ if (!fEvents.isEmpty()) {
+ throw new ParseException("Event without id with multiple events in a stream"); //$NON-NLS-1$
+ }
+ fEventUnsetId = true;
+ fEvents.add(event);
+ } else {
+ /* Check if an event with the same ID already exists */
+ if (fEvents.size() > id && fEvents.get(id) != null) {
+ throw new ParseException("Event id already exists"); //$NON-NLS-1$
+ }
+ ensureSize(fEvents, id);
+ /* Put the event in the list */
+ fEvents.set(id, event);
+ }
+ }
+
+ /**
+ * Add a list of event declarations to this stream. There must be no overlap
+ * between the two lists of event declarations. This will merge the two
+ * lists and preserve the indexes of both lists.
+ *
+ * @param events
+ * list of the events to add
+ * @throws CTFException
+ * if the list already contains data
+ */
+ public void addEvents(Collection<IEventDeclaration> events) throws CTFException {
+ if (fEventUnsetId) {
+ throw new CTFException("Cannot add to a stream with an unidentified event"); //$NON-NLS-1$
+ }
+ if (fEvents.isEmpty()) {
+ fEvents.addAll(events);
+ return;
+ }
+ for (IEventDeclaration event : events) {
+ if (event != null) {
+ int index = event.getId().intValue();
+ ensureSize(fEvents, index);
+ if (fEvents.get(index) != null) {
+ throw new CTFException("Both lists have an event defined at position " + index); //$NON-NLS-1$
+ }
+ fEvents.set(index, event);
+ }
+ }
+ }
+
+ private static void ensureSize(ArrayList<? extends Object> list, int index) {
+ list.ensureCapacity(index);
+ while (list.size() <= index) {
+ list.add(null);
+ }
+ }
+
+ /**
+ * Add an input to this Stream
+ *
+ * @param input
+ * The StreamInput to add.
+ */
+ public void addInput(CTFStreamInput input) {
+ fInputs.add(input);
+ }
+
+ @Override
+ public String toString() {
+ return "Stream [id=" + fId + ", packetContextDecl=" + fPacketContextDecl //$NON-NLS-1$ //$NON-NLS-2$
+ + ", eventHeaderDecl=" + fEventHeaderDecl //$NON-NLS-1$
+ + ", eventContextDecl=" + fEventContextDecl + ", trace=" + fTrace //$NON-NLS-1$ //$NON-NLS-2$
+ + ", events=" + fEvents + ", inputs=" + fInputs + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.file.StandardOpenOption;
+import java.util.UUID;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
+import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
+
+/**
+ * <b><u>StreamInput</u></b>
+ * <p>
+ * Represents a trace file that belongs to a certain stream.
+ */
+@NonNullByDefault
+public class CTFStreamInput implements IDefinitionScope {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final int MAP_SIZE = 4096;
+
+ /**
+ * The associated Stream
+ */
+ private final CTFStream fStream;
+
+ /**
+ * Information on the file (used for debugging)
+ */
+ private final File fFile;
+
+ /**
+ * The packet index of this input
+ */
+ private final StreamInputPacketIndex fIndex;
+
+ private long fTimestampEnd;
+
+ /**
+ * Definition of trace packet header
+ */
+ private final StructDeclaration fTracePacketHeaderDecl;
+
+ /**
+ * Definition of trace stream packet context
+ */
+ private final StructDeclaration fStreamPacketContextDecl;
+
+ /**
+ * Total number of lost events in this stream
+ */
+ private long fLostSoFar = 0;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a StreamInput.
+ *
+ * @param stream
+ * The stream to which this StreamInput belongs to.
+ * @param file
+ * Information about the trace file (for debugging purposes).
+ */
+ public CTFStreamInput(CTFStream stream, File file) {
+ fStream = stream;
+ fFile = file;
+ fIndex = new StreamInputPacketIndex();
+ /*
+ * Create the definitions we need to read the packet headers + contexts
+ */
+ StructDeclaration packetHeader = getStream().getTrace().getPacketHeader();
+ if (packetHeader != null) {
+ fTracePacketHeaderDecl = packetHeader;
+ } else {
+ fTracePacketHeaderDecl = new StructDeclaration(1);
+ }
+ StructDeclaration packetContextDecl = getStream().getPacketContextDecl();
+ if (packetContextDecl != null) {
+ fStreamPacketContextDecl = packetContextDecl;
+ } else {
+ fStreamPacketContextDecl = new StructDeclaration(1);
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the stream the streamInput wrapper is wrapping
+ *
+ * @return the stream the streamInput wrapper is wrapping
+ */
+ public CTFStream getStream() {
+ return fStream;
+ }
+
+ /**
+ * The common streamInput Index
+ *
+ * @return the stream input Index
+ */
+ StreamInputPacketIndex getIndex() {
+ return fIndex;
+ }
+
+ /**
+ * Gets the filename of the streamInput file.
+ *
+ * @return the filename of the streaminput file.
+ */
+ public String getFilename() {
+ String name = fFile.getName();
+ if (name == null) {
+ throw new IllegalStateException("File cannot have a null name"); //$NON-NLS-1$
+ }
+ return name;
+ }
+
+ /**
+ * Gets the last read timestamp of a stream. (this is not necessarily the
+ * last time in the stream.)
+ *
+ * @return the last read timestamp
+ */
+ public long getTimestampEnd() {
+ return fTimestampEnd;
+ }
+
+ /**
+ * Sets the last read timestamp of a stream. (this is not necessarily the
+ * last time in the stream.)
+ *
+ * @param timestampEnd
+ * the last read timestamp
+ */
+ public void setTimestampEnd(long timestampEnd) {
+ fTimestampEnd = timestampEnd;
+ }
+
+ /**
+ * Useless for streaminputs
+ */
+ @Override
+ public LexicalScope getScopePath() {
+ return ILexicalScope.STREAM;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public @Nullable Definition lookupDefinition(@Nullable String lookupPath) {
+ /* TODO: lookup in different dynamic scopes is not supported yet. */
+ return null;
+ }
+
+ /**
+ * Create the index for this trace file.
+ */
+ public void setupIndex() {
+
+ /*
+ * The BitBuffer to extract data from the StreamInput
+ */
+ BitBuffer bitBuffer = new BitBuffer();
+ bitBuffer.setByteOrder(getStream().getTrace().getByteOrder());
+
+ }
+
+ /**
+ * Adds the next packet header index entry to the index of a stream input.
+ *
+ * <strong>This method is slow and can corrupt data if not used
+ * properly</strong>
+ *
+ * @return true if there are more packets to add
+ * @throws CTFException
+ * If there was a problem reading the packed header
+ */
+ public boolean addPacketHeaderIndex() throws CTFException {
+ long currentPosBits = 0L;
+ if (!fIndex.isEmpty()) {
+ ICTFPacketDescriptor pos = fIndex.lastElement();
+ if (pos == null) {
+ throw new IllegalStateException("Index contains null packet entries"); //$NON-NLS-1$
+ }
+ currentPosBits = pos.getOffsetBits() + pos.getPacketSizeBits();
+ }
+ if (currentPosBits < getStreamSizeBits()) {
+ fIndex.append(createPacketIndexEntry(currentPosBits));
+ return true;
+ }
+ return false;
+ }
+
+ private long getStreamSizeBits() {
+ return fFile.length() * Byte.SIZE;
+ }
+
+ private ICTFPacketDescriptor createPacketIndexEntry(long dataOffsetbits)
+ throws CTFException {
+
+ try (FileChannel fc = FileChannel.open(fFile.toPath(), StandardOpenOption.READ)) {
+ if (fc == null) {
+ throw new IOException("Failed to create FileChannel"); //$NON-NLS-1$
+ }
+ BitBuffer bitBuffer = createBitBufferForPacketHeader(fc, dataOffsetbits);
+ /*
+ * Read the trace packet header if it exists.
+ */
+ parseTracePacketHeader(bitBuffer);
+
+ /*
+ * Read the stream packet context if it exists.
+ */
+ long size = fc.size();
+ ICTFPacketDescriptor packetIndex = parsePacketContext(dataOffsetbits, size, bitBuffer);
+
+ /* Basic validation */
+ if (packetIndex.getContentSizeBits() > packetIndex.getPacketSizeBits()) {
+ throw new CTFException("Content size > packet size"); //$NON-NLS-1$
+ }
+
+ if (packetIndex.getPacketSizeBits() > ((size * Byte.SIZE - packetIndex.getOffsetBits()))) {
+ throw new CTFException("Not enough data remaining in the file for the size of this packet"); //$NON-NLS-1$
+ }
+ return packetIndex;
+ } catch (IOException e) {
+ throw new CTFException("Failed to create packet index entry", e); //$NON-NLS-1$
+ }
+ }
+
+ private BitBuffer createBitBufferForPacketHeader(FileChannel fc, long dataOffsetbits) throws CTFException, IOException {
+ /*
+ * create a packet bit buffer to read the packet header
+ */
+ int maximumSize = fStreamPacketContextDecl.getMaximumSize() + fTracePacketHeaderDecl.getMaximumSize();
+ BitBuffer bitBuffer = new BitBuffer(createPacketBitBuffer(fc, dataOffsetbits/Byte.SIZE, maximumSize));
+ bitBuffer.setByteOrder(getStream().getTrace().getByteOrder());
+ return bitBuffer;
+ }
+
+ private static ByteBuffer getByteBufferAt(FileChannel fc, long position, long size) throws CTFException, IOException {
+ ByteBuffer map = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, position, size);
+ if (map == null) {
+ throw new CTFException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$
+ }
+ return map;
+ }
+
+ private static ByteBuffer createPacketBitBuffer(FileChannel fc,
+ long packetOffsetBytes, long maxSize) throws CTFException, IOException {
+ /*
+ * If there is less data remaining than what we want to map, reduce the
+ * map size.
+ */
+ long remain = fc.size() - packetOffsetBytes;
+ /*
+ * Initial size, it is the minimum of the the file size and the maximum
+ * possible size of the
+ */
+ long mapSize = Math.min(remain, MAP_SIZE);
+ if (maxSize < mapSize) {
+ mapSize = maxSize;
+ }
+
+ /*
+ * Map the packet.
+ */
+ try {
+ return getByteBufferAt(fc, packetOffsetBytes, mapSize);
+ } catch (IllegalArgumentException | IOException e) {
+ throw new CTFException(e);
+ }
+ }
+
+ private StructDefinition parseTracePacketHeader(
+ BitBuffer bitBuffer) throws CTFException {
+
+ StructDefinition tracePacketHeaderDef = fTracePacketHeaderDecl.createDefinition(fStream.getTrace(), ILexicalScope.TRACE_PACKET_HEADER, bitBuffer);
+
+ /*
+ * Check the CTF magic number
+ */
+ IntegerDefinition magicDef = (IntegerDefinition) tracePacketHeaderDef
+ .lookupDefinition("magic"); //$NON-NLS-1$
+ if (magicDef != null) {
+ int magic = (int) magicDef.getValue();
+ if (magic != Utils.CTF_MAGIC) {
+ throw new CTFException(
+ "CTF magic mismatch " + Integer.toHexString(magic) + " vs " + Integer.toHexString(Utils.CTF_MAGIC)); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ }
+
+ /*
+ * Check the trace UUID
+ */
+ AbstractArrayDefinition uuidDef =
+ (AbstractArrayDefinition) tracePacketHeaderDef.lookupDefinition("uuid"); //$NON-NLS-1$
+ if (uuidDef != null) {
+ UUID uuid = Utils.getUUIDfromDefinition(uuidDef);
+
+ if (!getStream().getTrace().getUUID().equals(uuid)) {
+ throw new CTFException("UUID mismatch"); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Check that the stream id did not change
+ */
+ IntegerDefinition streamIDDef = (IntegerDefinition) tracePacketHeaderDef
+ .lookupDefinition("stream_id"); //$NON-NLS-1$
+ if (streamIDDef != null) {
+ long streamID = streamIDDef.getValue();
+
+ if (streamID != getStream().getId()) {
+ throw new CTFException("Stream ID changing within a StreamInput"); //$NON-NLS-1$
+ }
+ }
+ return tracePacketHeaderDef;
+ }
+
+ private ICTFPacketDescriptor parsePacketContext(long dataOffsetBits, long fileSizeBytes,
+ BitBuffer bitBuffer) throws CTFException {
+ ICTFPacketDescriptor packetIndex;
+ StructDefinition streamPacketContextDef = fStreamPacketContextDecl.createDefinition(this, ILexicalScope.STREAM_PACKET_CONTEXT, bitBuffer);
+ packetIndex = new StreamInputPacketIndexEntry(dataOffsetBits, streamPacketContextDef, fileSizeBytes, fLostSoFar);
+ fLostSoFar = packetIndex.getLostEvents() + fLostSoFar;
+ setTimestampEnd(packetIndex.getTimestampEnd());
+ return packetIndex;
+ }
+
+ /**
+ * Get the file
+ *
+ * @return the file
+ * @since 1.0
+ */
+ public File getFile() {
+ return fFile;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result) + fFile.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CTFStreamInput)) {
+ return false;
+ }
+ CTFStreamInput other = (CTFStreamInput) obj;
+ if (!fFile.equals(other.fFile)) {
+ return false;
+ }
+ return true;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel.MapMode;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.SimpleDatatypeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderDefinition;
+
+/**
+ * CTF trace packet reader. Reads the events of a packet of a trace file.
+ *
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseable {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final int BITS_PER_BYTE = Byte.SIZE;
+
+ /** BitBuffer used to read the trace file. */
+ @Nullable
+ private BitBuffer fBitBuffer;
+
+ /** StreamInputReader that uses this StreamInputPacketReader. */
+ private final CTFStreamInputReader fStreamInputReader;
+
+ /** Trace packet header. */
+ private final StructDeclaration fTracePacketHeaderDecl;
+
+ /** Stream packet context definition. */
+ private final StructDeclaration fStreamPacketContextDecl;
+
+ /** Stream event header definition. */
+ private final IDeclaration fStreamEventHeaderDecl;
+
+ /** Stream event context definition. */
+ private final StructDeclaration fStreamEventContextDecl;
+
+ private ICompositeDefinition fCurrentTracePacketHeaderDef;
+ private ICompositeDefinition fCurrentStreamEventHeaderDef;
+ private ICompositeDefinition fCurrentStreamPacketContextDef;
+ /** Reference to the index entry of the current packet. */
+ private ICTFPacketDescriptor fCurrentPacket = null;
+
+ /**
+ * Last timestamp recorded.
+ *
+ * Needed to calculate the complete timestamp values for the events with
+ * compact headers.
+ */
+ private long fLastTimestamp = 0;
+
+ /** CPU id of current packet. */
+ private int fCurrentCpu = 0;
+
+ private int fLostEventsInThisPacket;
+
+ private long fLostEventsDuration;
+
+ private boolean fHasLost = false;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a StreamInputPacketReader.
+ *
+ * @param streamInputReader
+ * The StreamInputReader to which this packet reader belongs to.
+ */
+ public CTFStreamInputPacketReader(CTFStreamInputReader streamInputReader) {
+ fStreamInputReader = streamInputReader;
+
+ /* Set the BitBuffer's byte order. */
+ ByteBuffer allocateDirect = ByteBuffer.allocateDirect(0);
+ if (allocateDirect == null) {
+ throw new IllegalStateException("Unable to allocate 0 bytes!"); //$NON-NLS-1$
+ }
+ fBitBuffer = new BitBuffer(allocateDirect);
+
+ final CTFStream currentStream = streamInputReader.getStreamInput().getStream();
+ fTracePacketHeaderDecl = currentStream.getTrace().getPacketHeader();
+ fStreamPacketContextDecl = currentStream.getPacketContextDecl();
+ fStreamEventHeaderDecl = currentStream.getEventHeaderDeclaration();
+ fStreamEventContextDecl = currentStream.getEventContextDecl();
+ }
+
+ /**
+ * Get the event context defintiion
+ *
+ * @param input
+ * the bitbuffer to read from
+ * @return an context definition, can be null
+ * @throws CTFException
+ * out of bounds exception or such
+ */
+ public StructDefinition getEventContextDefinition(@NonNull BitBuffer input) throws CTFException {
+ return fStreamEventContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_EVENT_CONTEXT, input);
+ }
+
+ /**
+ * Get the packet context defintiion
+ *
+ * @param input
+ * the bitbuffer to read from
+ * @return an context definition, can be null
+ * @throws CTFException
+ * out of bounds exception or such
+ */
+ public StructDefinition getStreamPacketContextDefinition(@NonNull BitBuffer input) throws CTFException {
+ return fStreamPacketContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_PACKET_CONTEXT, input);
+ }
+
+ /**
+ * Get the event header defintiion
+ *
+ * @param input
+ * the bitbuffer to read from
+ * @return an header definition, can be null
+ * @throws CTFException
+ * out of bounds exception or such
+ */
+ public StructDefinition getTracePacketHeaderDefinition(@NonNull BitBuffer input) throws CTFException {
+ return fTracePacketHeaderDecl.createDefinition(fStreamInputReader.getStreamInput().getStream().getTrace(), ILexicalScope.TRACE_PACKET_HEADER, input);
+ }
+
+ /**
+ * Dispose the StreamInputPacketReader
+ */
+ @Override
+ public void close() {
+ fBitBuffer = null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the current packet
+ *
+ * @return the current packet
+ */
+ ICTFPacketDescriptor getCurrentPacket() {
+ return fCurrentPacket;
+ }
+
+ /**
+ * Gets the CPU (core) number
+ *
+ * @return the CPU (core) number
+ */
+ public int getCPU() {
+ return fCurrentCpu;
+ }
+
+ @Override
+ public LexicalScope getScopePath() {
+ return ILexicalScope.PACKET;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @NonNull
+ private ByteBuffer getByteBufferAt(long position, long size) throws CTFException, IOException {
+ ByteBuffer map = SafeMappedByteBuffer.map(fStreamInputReader.getFc(), MapMode.READ_ONLY, position, size);
+ if (map == null) {
+ throw new CTFIOException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$
+ }
+ return map;
+ }
+
+ /**
+ * Changes the current packet to the given one.
+ *
+ * @param currentPacket
+ * The index entry of the packet to switch to.
+ * @throws CTFException
+ * If we get an error reading the packet
+ * @since 1.0
+ */
+ public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException {
+ ICTFPacketDescriptor prevPacket = null;
+ fCurrentPacket = currentPacket;
+
+ if (fCurrentPacket != null) {
+ /*
+ * Change the map of the BitBuffer.
+ */
+ ByteBuffer bb = null;
+ try {
+ bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE);
+ } catch (IOException e) {
+ throw new CTFIOException(e.getMessage(), e);
+ }
+
+ BitBuffer bitBuffer = new BitBuffer(bb);
+ fBitBuffer = bitBuffer;
+ /*
+ * Read trace packet header.
+ */
+ if (fTracePacketHeaderDecl != null) {
+ fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer);
+ }
+
+ /*
+ * Read stream packet context.
+ */
+ if (fStreamPacketContextDecl != null) {
+ fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer);
+
+ /* Read CPU ID */
+ if (getCurrentPacket().getTarget() != null) {
+ fCurrentCpu = (int) getCurrentPacket().getTargetId();
+ }
+
+ /* Read number of lost events */
+ fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents();
+ if (fLostEventsInThisPacket != 0) {
+ fHasLost = true;
+ /*
+ * Compute the duration of the lost event time range. If the
+ * current packet is the first packet, duration will be set
+ * to 1.
+ */
+ long lostEventsStartTime;
+ int index = fStreamInputReader.getStreamInput().getIndex().indexOf(currentPacket);
+ if (index == 0) {
+ lostEventsStartTime = currentPacket.getTimestampBegin() + 1;
+ } else {
+ prevPacket = fStreamInputReader.getStreamInput().getIndex().getElement(index - 1);
+ lostEventsStartTime = prevPacket.getTimestampEnd();
+ }
+ fLostEventsDuration = Math.abs(lostEventsStartTime - currentPacket.getTimestampBegin());
+ }
+ }
+
+ /*
+ * Use the timestamp begin of the packet as the reference for the
+ * timestamp reconstitution.
+ */
+ fLastTimestamp = currentPacket.getTimestampBegin();
+ } else {
+ fBitBuffer = null;
+ fLastTimestamp = 0;
+ }
+ }
+
+ /**
+ * Returns whether it is possible to read any more events from this packet.
+ *
+ * @return True if it is possible to read any more events from this packet.
+ */
+ public boolean hasMoreEvents() {
+ BitBuffer bitBuffer = fBitBuffer;
+ ICTFPacketDescriptor currentPacket = fCurrentPacket;
+ if (currentPacket != null && bitBuffer != null) {
+ return fHasLost || (bitBuffer.position() < currentPacket.getContentSizeBits());
+ }
+ return false;
+ }
+
+ /**
+ * Reads the next event of the packet into the right event definition.
+ *
+ * @return The event definition containing the event data that was just
+ * read.
+ * @throws CTFException
+ * If there was a problem reading the trace
+ */
+ public EventDefinition readNextEvent() throws CTFException {
+ /* Default values for those fields */
+ // compromise since we cannot have 64 bit addressing of arrays yet.
+ int eventID = (int) IEventDeclaration.UNSET_EVENT_ID;
+ long timestamp = 0;
+ if (fHasLost) {
+ fHasLost = false;
+ IEventDeclaration lostEventDeclaration = LostEventDeclaration.INSTANCE;
+ StructDeclaration lostFields = lostEventDeclaration.getFields();
+ // this is a hard coded map, we know it's not null
+ IntegerDeclaration lostFieldsDecl = (IntegerDeclaration) lostFields.getField(CTFStrings.LOST_EVENTS_FIELD);
+ if (lostFieldsDecl == null)
+ {
+ throw new IllegalStateException("Lost events count not declared!"); //$NON-NLS-1$
+ }
+ IntegerDeclaration lostEventsDurationDecl = (IntegerDeclaration) lostFields.getField(CTFStrings.LOST_EVENTS_DURATION);
+ if (lostEventsDurationDecl == null) {
+ throw new IllegalStateException("Lost events duration not declared!"); //$NON-NLS-1$
+ }
+ IntegerDefinition lostDurationDef = new IntegerDefinition(lostFieldsDecl, null, CTFStrings.LOST_EVENTS_DURATION, fLostEventsDuration);
+ IntegerDefinition lostCountDef = new IntegerDefinition(lostEventsDurationDecl, null, CTFStrings.LOST_EVENTS_FIELD, fLostEventsInThisPacket);
+ IntegerDefinition[] fields = new IntegerDefinition[] { lostCountDef, lostDurationDef };
+ return new EventDefinition(
+ lostEventDeclaration,
+ fStreamInputReader,
+ fLastTimestamp,
+ null,
+ null,
+ null,
+ new StructDefinition(
+ lostFields,
+ this, "fields", //$NON-NLS-1$
+ fields
+ ));
+
+ }
+
+ final BitBuffer currentBitBuffer = fBitBuffer;
+ if (currentBitBuffer == null) {
+ return null;
+ }
+ final long posStart = currentBitBuffer.position();
+ /* Read the stream event header. */
+ if (fStreamEventHeaderDecl != null) {
+ if (fStreamEventHeaderDecl instanceof IEventHeaderDeclaration) {
+ fCurrentStreamEventHeaderDef = (ICompositeDefinition) fStreamEventHeaderDecl.createDefinition(null, "", currentBitBuffer); //$NON-NLS-1$
+ EventHeaderDefinition ehd = (EventHeaderDefinition) fCurrentStreamEventHeaderDef;
+ eventID = ehd.getId();
+ timestamp = calculateTimestamp(ehd.getTimestamp(), ehd.getTimestampLength());
+ } else {
+ fCurrentStreamEventHeaderDef = ((StructDeclaration) fStreamEventHeaderDecl).createDefinition(null, ILexicalScope.EVENT_HEADER, currentBitBuffer);
+ StructDefinition StructEventHeaderDef = (StructDefinition) fCurrentStreamEventHeaderDef;
+ /* Check for the event id. */
+ IDefinition idDef = StructEventHeaderDef.lookupDefinition("id"); //$NON-NLS-1$
+ SimpleDatatypeDefinition simpleIdDef = null;
+ if (idDef instanceof SimpleDatatypeDefinition) {
+ simpleIdDef = ((SimpleDatatypeDefinition) idDef);
+ } else if (idDef != null) {
+ throw new CTFIOException("Id defintion not an integer, enum or float definiton in event header."); //$NON-NLS-1$
+ }
+
+ /*
+ * Get the timestamp from the event header (may be overridden
+ * later on)
+ */
+ IntegerDefinition timestampDef = StructEventHeaderDef.lookupInteger("timestamp"); //$NON-NLS-1$
+
+ /* Check for the variant v. */
+ IDefinition variantDef = StructEventHeaderDef.lookupDefinition("v"); //$NON-NLS-1$
+ if (variantDef instanceof VariantDefinition) {
+
+ /* Get the variant current field */
+ StructDefinition variantCurrentField = (StructDefinition) ((VariantDefinition) variantDef).getCurrentField();
+
+ /*
+ * Try to get the id field in the current field of the
+ * variant. If it is present, it overrides the previously
+ * read event id.
+ */
+ IDefinition vIdDef = variantCurrentField.lookupDefinition("id"); //$NON-NLS-1$
+ if (vIdDef instanceof IntegerDefinition) {
+ simpleIdDef = (SimpleDatatypeDefinition) vIdDef;
+ }
+
+ /*
+ * Get the timestamp. This would overwrite any previous
+ * timestamp definition
+ */
+ timestampDef = variantCurrentField.lookupInteger("timestamp"); //$NON-NLS-1$
+ }
+ if (simpleIdDef != null) {
+ eventID = simpleIdDef.getIntegerValue().intValue();
+ }
+ if (timestampDef != null) {
+ timestamp = calculateTimestamp(timestampDef);
+ } // else timestamp remains 0
+ }
+ }
+ /* Get the right event definition using the event id. */
+ IEventDeclaration eventDeclaration = fStreamInputReader.getStreamInput().getStream().getEventDeclaration(eventID);
+ if (eventDeclaration == null) {
+ throw new CTFIOException("Incorrect event id : " + eventID); //$NON-NLS-1$
+ }
+ EventDefinition eventDef = eventDeclaration.createDefinition(fStreamInputReader, currentBitBuffer, timestamp);
+
+ /*
+ * Set the event timestamp using the timestamp calculated by
+ * updateTimestamp.
+ */
+
+ if (posStart == currentBitBuffer.position()) {
+ throw new CTFIOException("Empty event not allowed, event: " + eventDef.getDeclaration().getName()); //$NON-NLS-1$
+ }
+
+ return eventDef;
+ }
+
+ /**
+ * Calculates the timestamp value of the event, possibly using the timestamp
+ * from the last event.
+ *
+ * @param timestampDef
+ * Integer definition of the timestamp.
+ * @return The calculated timestamp value.
+ */
+ private long calculateTimestamp(IntegerDefinition timestampDef) {
+ int len = timestampDef.getDeclaration().getLength();
+ final long value = timestampDef.getValue();
+
+ return calculateTimestamp(value, len);
+ }
+
+ private long calculateTimestamp(final long value, int len) {
+ long newval;
+ long majorasbitmask;
+ /*
+ * If the timestamp length is 64 bits, it is a full timestamp.
+ */
+ if (len == Long.SIZE) {
+ fLastTimestamp = value;
+ return fLastTimestamp;
+ }
+
+ /*
+ * Bit mask to keep / remove all old / new bits.
+ */
+ majorasbitmask = (1L << len) - 1;
+
+ /*
+ * If the new value is smaller than the corresponding bits of the last
+ * timestamp, we assume an overflow of the compact representation.
+ */
+ newval = value;
+ if (newval < (fLastTimestamp & majorasbitmask)) {
+ newval = newval + (1L << len);
+ }
+
+ /* Keep only the high bits of the old value */
+ fLastTimestamp = fLastTimestamp & ~majorasbitmask;
+
+ /* Then add the low bits of the new value */
+ fLastTimestamp = fLastTimestamp + newval;
+
+ return fLastTimestamp;
+ }
+
+ @Override
+ public Definition lookupDefinition(String lookupPath) {
+ if (lookupPath.equals(ILexicalScope.STREAM_PACKET_CONTEXT.getPath())) {
+ return (Definition) fCurrentStreamPacketContextDef;
+ }
+ if (lookupPath.equals(ILexicalScope.TRACE_PACKET_HEADER.getPath())) {
+ return (Definition) fCurrentTracePacketHeaderDef;
+ }
+ return null;
+ }
+
+
+ /**
+ * Get stream event header
+ *
+ * @return the stream event header
+ */
+ public ICompositeDefinition getStreamEventHeaderDefinition() {
+ return fCurrentStreamEventHeaderDef;
+ }
+
+ /**
+ * Get the current packet event header
+ *
+ * @return the current packet event header
+ */
+ public StructDefinition getCurrentPacketEventHeader() {
+ if (fCurrentTracePacketHeaderDef instanceof StructDefinition) {
+ return (StructDefinition) fCurrentTracePacketHeaderDef;
+ }
+ return null;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.nio.file.StandardOpenOption;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A CTF trace event reader. Reads the events of a trace file.
+ *
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public class CTFStreamInputReader implements AutoCloseable {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The StreamInput we are reading.
+ */
+ private final @NonNull File fFile;
+
+ private final @NonNull CTFStreamInput fStreamInput;
+
+ private final FileChannel fFileChannel;
+
+ /**
+ * The packet reader used to read packets from this trace file.
+ */
+ private final CTFStreamInputPacketReader fPacketReader;
+
+ /**
+ * Iterator on the packet index
+ */
+ private int fPacketIndex;
+
+ /**
+ * Reference to the current event of this trace file (iow, the last on that
+ * was read, the next one to be returned)
+ */
+ private EventDefinition fCurrentEvent = null;
+
+ private int fId;
+
+ private CTFTraceReader fParent;
+
+ /**
+ * Live trace reading
+ */
+ private boolean fLive = false;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+ /**
+ * Constructs a StreamInputReader that reads a StreamInput.
+ *
+ * @param streamInput
+ * The StreamInput to read.
+ * @throws CTFException
+ * If the file cannot be opened
+ */
+ public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFException {
+ if (streamInput == null) {
+ throw new IllegalArgumentException("stream cannot be null"); //$NON-NLS-1$
+ }
+ fStreamInput = streamInput;
+ fFile = fStreamInput.getFile();
+ try {
+ fFileChannel = FileChannel.open(fFile.toPath(), StandardOpenOption.READ);
+ } catch (IOException e) {
+ throw new CTFIOException(e);
+ }
+ fPacketReader = new CTFStreamInputPacketReader(this);
+ /*
+ * Get the iterator on the packet index.
+ */
+ fPacketIndex = 0;
+ /*
+ * Make first packet the current one.
+ */
+ goToNextPacket();
+ }
+
+ /**
+ * Dispose the StreamInputReader, closes the file channel and its packet
+ * reader
+ *
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ @Override
+ public void close() throws IOException {
+ fFileChannel.close();
+ fPacketReader.close();
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the current event in this stream
+ *
+ * @return the current event in the stream, null if the stream is
+ * finished/empty/malformed
+ */
+ public EventDefinition getCurrentEvent() {
+ return fCurrentEvent;
+ }
+
+ /**
+ * Gets the byte order for a trace
+ *
+ * @return the trace byte order
+ */
+ public ByteOrder getByteOrder() {
+ return fStreamInput.getStream().getTrace().getByteOrder();
+ }
+
+ /**
+ * Gets the name of the stream (it's an id and a number)
+ *
+ * @return gets the stream name (it's a number)
+ */
+ public int getName() {
+ return fId;
+ }
+
+ /**
+ * Sets the name of the stream
+ *
+ * @param name
+ * the name of the stream, (it's a number)
+ */
+ public void setName(int name) {
+ fId = name;
+ }
+
+ /**
+ * Gets the CPU of a stream. It's the same as the one in /proc or running
+ * the asm CPUID instruction
+ *
+ * @return The CPU id (a number)
+ */
+ public int getCPU() {
+ return fPacketReader.getCPU();
+ }
+
+ /**
+ * Gets the filename of the stream being read
+ *
+ * @return The filename of the stream being read
+ */
+ public String getFilename() {
+ return fStreamInput.getFilename();
+ }
+
+ /*
+ * for internal use only
+ */
+ CTFStreamInput getStreamInput() {
+ return fStreamInput;
+ }
+
+ /**
+ * Gets the event definition set for this StreamInput
+ *
+ * @return Unmodifiable set with the event definitions
+ */
+ public Iterable<IEventDeclaration> getEventDeclarations() {
+ return ImmutableList.copyOf(fStreamInput.getStream().getEventDeclarations());
+ }
+
+ /**
+ * Set the trace to live mode
+ *
+ * @param live
+ * whether the trace is read live or not
+ */
+ public void setLive(boolean live) {
+ fLive = live;
+ }
+
+ /**
+ * Get if the trace is to read live or not
+ *
+ * @return whether the trace is live or not
+ */
+ public boolean isLive() {
+ return fLive;
+ }
+
+ /**
+ * Get the event context of the stream
+ *
+ * @return the event context declaration of the stream
+ */
+ public StructDeclaration getStreamEventContextDecl() {
+ return getStreamInput().getStream().getEventContextDecl();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+ /**
+ * Reads the next event in the current event variable.
+ *
+ * @return If an event has been successfully read.
+ * @throws CTFException
+ * if an error occurs
+ */
+ public CTFResponse readNextEvent() throws CTFException {
+
+ /*
+ * Change packet if needed
+ */
+ if (!fPacketReader.hasMoreEvents()) {
+ final ICTFPacketDescriptor prevPacket = fPacketReader
+ .getCurrentPacket();
+ if (prevPacket != null || fLive) {
+ goToNextPacket();
+ }
+
+ }
+
+ /*
+ * If an event is available, read it.
+ */
+ if (fPacketReader.hasMoreEvents()) {
+ setCurrentEvent(fPacketReader.readNextEvent());
+ return CTFResponse.OK;
+ }
+ this.setCurrentEvent(null);
+ return fLive ? CTFResponse.WAIT : CTFResponse.FINISH;
+ }
+
+ /**
+ * Change the current packet of the packet reader to the next one.
+ *
+ * @throws CTFException
+ * if an error occurs
+ */
+ private void goToNextPacket() throws CTFException {
+ fPacketIndex++;
+ // did we already index the packet?
+ if (getPacketSize() >= (fPacketIndex + 1)) {
+ fPacketReader.setCurrentPacket(getPacket());
+ } else {
+ // go to the next packet if there is one, index it at the same time
+ if (fStreamInput.addPacketHeaderIndex()) {
+ fPacketIndex = getPacketSize() - 1;
+ fPacketReader.setCurrentPacket(getPacket());
+ } else {
+ // out of packets
+ fPacketReader.setCurrentPacket(null);
+ }
+ }
+ }
+
+ /**
+ * @return
+ */
+ private int getPacketSize() {
+ return fStreamInput.getIndex().size();
+ }
+
+ /**
+ * Changes the location of the trace file reader so that the current event
+ * is the first event with a timestamp greater or equal the given timestamp.
+ *
+ * @param timestamp
+ * The timestamp to seek to.
+ * @return The offset compared to the current position
+ * @throws CTFException
+ * if an error occurs
+ */
+ public long seek(long timestamp) throws CTFException {
+ long offset = 0;
+
+ gotoPacket(timestamp);
+
+ /*
+ * index up to the desired timestamp.
+ */
+ while ((fPacketReader.getCurrentPacket() != null)
+ && (fPacketReader.getCurrentPacket().getTimestampEnd() < timestamp)) {
+ try {
+ fStreamInput.addPacketHeaderIndex();
+ goToNextPacket();
+ } catch (CTFException e) {
+ // do nothing here
+ Activator.log(e.getMessage());
+ }
+ }
+ if (fPacketReader.getCurrentPacket() == null) {
+ gotoPacket(timestamp);
+ }
+
+ /*
+ * Advance until either of these conditions are met:
+ *
+ * - reached the end of the trace file (the given timestamp is after the
+ * last event)
+ *
+ * - found the first event with a timestamp greater or equal the given
+ * timestamp.
+ */
+ readNextEvent();
+ boolean done = (this.getCurrentEvent() == null);
+ while (!done && (this.getCurrentEvent().getTimestamp() < timestamp)) {
+ readNextEvent();
+ done = (this.getCurrentEvent() == null);
+ offset++;
+ }
+ return offset;
+ }
+
+ /**
+ * @param timestamp
+ * the time to seek
+ * @throws CTFException
+ * if an error occurs
+ */
+ private void gotoPacket(long timestamp) throws CTFException {
+ fPacketIndex = fStreamInput.getIndex().search(timestamp)
+ .previousIndex();
+ /*
+ * Switch to this packet.
+ */
+ goToNextPacket();
+ }
+
+ /**
+ * Seeks the last event of a stream and returns it.
+ *
+ * @throws CTFException
+ * if an error occurs
+ */
+ public void goToLastEvent() throws CTFException {
+
+ /*
+ * Go to the beginning of the trace
+ */
+ seek(0);
+
+ /*
+ * Check that there is at least one event
+ */
+ if ((fStreamInput.getIndex().isEmpty()) || (!fPacketReader.hasMoreEvents())) {
+ /*
+ * This means the trace is empty. abort.
+ */
+ return;
+ }
+
+ fPacketIndex = fStreamInput.getIndex().size() - 1;
+ /*
+ * Go to last indexed packet
+ */
+ fPacketReader.setCurrentPacket(getPacket());
+
+ /*
+ * Keep going until you cannot
+ */
+ while (fPacketReader.getCurrentPacket() != null) {
+ goToNextPacket();
+ }
+
+ final int lastPacketIndex = fStreamInput.getIndex().size() - 1;
+ /*
+ * Go to the last packet that contains events.
+ */
+ for (int pos = lastPacketIndex; pos > 0; pos--) {
+ fPacketIndex = pos;
+ fPacketReader.setCurrentPacket(getPacket());
+
+ if (fPacketReader.hasMoreEvents()) {
+ break;
+ }
+ }
+
+ /*
+ * Go until the end of that packet
+ */
+ EventDefinition prevEvent = null;
+ while (fCurrentEvent != null) {
+ prevEvent = fCurrentEvent;
+ this.readNextEvent();
+ }
+ /*
+ * Go back to the previous event
+ */
+ this.setCurrentEvent(prevEvent);
+ }
+
+ /**
+ * @return the parent
+ */
+ public CTFTraceReader getParent() {
+ return fParent;
+ }
+
+ /**
+ * @param parent
+ * the parent to set
+ */
+ public void setParent(CTFTraceReader parent) {
+ fParent = parent;
+ }
+
+ /**
+ * Sets the current event in a stream input reader
+ *
+ * @param currentEvent
+ * the event to set
+ */
+ public void setCurrentEvent(EventDefinition currentEvent) {
+ fCurrentEvent = currentEvent;
+ }
+
+ /**
+ * @return the packetIndexIt
+ */
+ private int getPacketIndex() {
+ return fPacketIndex;
+ }
+
+ private ICTFPacketDescriptor getPacket() {
+ return fStreamInput.getIndex().getElement(getPacketIndex());
+ }
+
+ /**
+ * Get the file channel wrapped by this reader
+ *
+ * @return the file channel
+ */
+ FileChannel getFc() {
+ return fFileChannel;
+ }
+
+ /**
+ * @return the packetReader
+ */
+ public CTFStreamInputPacketReader getPacketReader() {
+ return fPacketReader;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result) + fId;
+ result = (prime * result)
+ + fFile.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CTFStreamInputReader)) {
+ return false;
+ }
+ CTFStreamInputReader other = (CTFStreamInputReader) obj;
+ if (fId != other.fId) {
+ return false;
+ }
+ return fFile.equals(other.fFile);
+ }
+
+ @Override
+ public String toString() {
+ // this helps debugging
+ return fId + ' ' + fCurrentEvent.toString();
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
+
+/**
+ * A CTF Stream output writer. Reads the packets of a given CTFStreamInput and
+ * writes packets that are within a given time range to output stream file.
+ *
+ * @author Bernd Hufmann
+ * @since 1.0
+ */
+public class CTFStreamOutputWriter {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+ // Stream input when copying stream from an input
+ // It is @Nullable for future implementations that doesn't use an input
+ // stream
+ @Nullable
+ private final CTFStreamInput fStreamInput;
+ @NonNull
+ private final CTFStreamPacketOutputWriter fStreamPacketOutputWriter;
+ @NonNull
+ private final File fOutFile;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a StreamInput.
+ *
+ * @param streamInput
+ * The stream to which this StreamInput belongs to.
+ * @param file
+ * The output trace directory.
+ * @throws CTFException
+ * If a reading or writing error occurs
+ */
+ public CTFStreamOutputWriter(@NonNull CTFStreamInput streamInput, @NonNull File file) throws CTFException {
+ fStreamInput = streamInput;
+ String inFileName = streamInput.getFile().getName();
+ Path outFilePath = FileSystems.getDefault().getPath(file.getAbsolutePath(), inFileName);
+
+ try {
+ fOutFile = checkNotNull(Files.createFile(outFilePath).toFile());
+ } catch (IOException e) {
+ throw new CTFIOException("Output file can't be created: " + outFilePath, e); //$NON-NLS-1$
+ }
+
+ fStreamPacketOutputWriter = new CTFStreamPacketOutputWriter();
+ }
+
+ /**
+ * Copies packets from the relevant input this input stream to a
+ * corresponding output stream based on a given time range. The following
+ * condition has to be met so that a packet is written to the output stream:
+ *
+ * startTime <= packet.getTimestampBegin() <= endTime
+ *
+ * @param startTime
+ * the start time for packets to be written
+ * @param endTime
+ * the end time for packets to be written
+ * @throws CTFException
+ * if a reading or writing error occurs
+ * @since 1.0
+ */
+ public void copyPackets(long startTime, long endTime) throws CTFException {
+ CTFStreamInput streamInput = fStreamInput;
+ if (streamInput == null) {
+ throw new CTFIOException("StreamInput is null. Can't copy packets"); //$NON-NLS-1$
+ }
+
+ try (FileChannel fc = checkNotNull(FileChannel.open(fOutFile.toPath(), StandardOpenOption.WRITE))) {
+ StreamInputPacketIndex index = streamInput.getIndex();
+ int count = 0;
+ try (FileChannel source = FileChannel.open(streamInput.getFile().toPath(), StandardOpenOption.READ)) {
+ for (int i = 0; i < index.size(); i++) {
+ ICTFPacketDescriptor entry = index.getElement(i);
+ if ((entry.getTimestampBegin() >= startTime) && (entry.getTimestampBegin() <= endTime)) {
+ ByteBuffer buffer = SafeMappedByteBuffer.map(source, MapMode.READ_ONLY, entry.getOffsetBytes(), entry.getPacketSizeBits() / Byte.SIZE);
+ fStreamPacketOutputWriter.writePacket(buffer, fc);
+ count++;
+ }
+ }
+ }
+
+ if (count == 0 && fOutFile.exists()) {
+ boolean deleteResult = fOutFile.delete();
+ if (!deleteResult) {
+ throw new CTFIOException("Could not delete " + fOutFile.getAbsolutePath()); //$NON-NLS-1$
+ }
+ }
+ } catch (IOException e) {
+ throw new CTFIOException("Error copying packets: " + e.toString(), e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Get the stream file to write.
+ *
+ * @return the stream file to write
+ */
+ public File getOutFile() {
+ return fOutFile;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+/**
+ * CTF trace packet writer.
+ *
+ * @author Bernd Hufmann
+ * @since 1.0
+ */
+public class CTFStreamPacketOutputWriter {
+
+ /**
+ * Writes a stream packet to the output file channel based on the packet
+ * descriptor information.
+ *
+ * @param byteBuffer
+ * a byte buffer with packet to write
+ * @param fc
+ * a file channel
+ * @throws IOException
+ * if a reading or writing error occurs
+ */
+ public void writePacket(ByteBuffer byteBuffer, FileChannel fc) throws IOException {
+ fc.write(byteBuffer);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Initial API and implementation
+ * Simon Delisle - Replace LinkedList by TreeSet in callsitesByName attribute
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.file.StandardOpenOption;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+import org.eclipse.tracecompass.ctf.core.event.CTFClock;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
+import org.eclipse.tracecompass.internal.ctf.core.event.CTFCallsiteComparator;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
+
+/**
+ * A CTF trace on the file system.
+ *
+ * Represents a trace on the filesystem. It is responsible of parsing the
+ * metadata, creating declarations data structures, indexing the event packets
+ * (in other words, all the work that can be shared between readers), but the
+ * actual reading of events is left to TraceReader.
+ *
+ * @author Matthew Khouzam
+ * @version $Revision: 1.0 $
+ */
+public class CTFTrace implements IDefinitionScope {
+
+ @Override
+ public String toString() {
+ /* Only for debugging, shouldn't be externalized */
+ return "CTFTrace [path=" + fPath + ", major=" + fMajor + ", minor=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + fMinor + ", uuid=" + fUuid + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * The trace directory on the filesystem.
+ */
+ private final File fPath;
+
+ /**
+ * Major CTF version number
+ */
+ private Long fMajor;
+
+ /**
+ * Minor CTF version number
+ */
+ private Long fMinor;
+
+ /**
+ * Trace UUID
+ */
+ private UUID fUuid;
+
+ /**
+ * Trace byte order
+ */
+ private ByteOrder fByteOrder;
+
+ /**
+ * Packet header structure declaration
+ */
+ private StructDeclaration fPacketHeaderDecl = null;
+
+ /**
+ * The clock of the trace
+ */
+ private CTFClock fSingleClock = null;
+
+ /**
+ * Packet header structure definition
+ *
+ * This is only used when opening the trace files, to read the first packet
+ * header and see if they are valid trace files.
+ */
+ private StructDefinition fPacketHeaderDef;
+
+ /**
+ * Collection of streams contained in the trace.
+ */
+ private final Map<Long, CTFStream> fStreams = new HashMap<>();
+
+ /**
+ * Collection of environment variables set by the tracer
+ */
+ private final Map<String, String> fEnvironment = new HashMap<>();
+
+ /**
+ * Collection of all the clocks in a system.
+ */
+ private final Map<String, CTFClock> fClocks = new HashMap<>();
+
+ /** Handlers for the metadata files */
+ private static final FileFilter METADATA_FILE_FILTER = new MetadataFileFilter();
+ private static final Comparator<File> METADATA_COMPARATOR = new MetadataComparator();
+
+ /** Callsite helpers */
+ private CTFCallsiteComparator fCtfCallsiteComparator = new CTFCallsiteComparator();
+
+ private Map<String, TreeSet<CTFCallsite>> fCallsitesByName = new HashMap<>();
+
+ /** Callsite helpers */
+ private TreeSet<CTFCallsite> fCallsitesByIP = new TreeSet<>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Trace constructor.
+ *
+ * @param path
+ * Filesystem path of the trace directory
+ * @throws CTFException
+ * If no CTF trace was found at the path
+ */
+ public CTFTrace(String path) throws CTFException {
+ this(new File(path));
+ }
+
+ /**
+ * Trace constructor.
+ *
+ * @param path
+ * Filesystem path of the trace directory.
+ * @throws CTFException
+ * If no CTF trace was found at the path
+ */
+ public CTFTrace(File path) throws CTFException {
+ fPath = path;
+ final Metadata metadata = new Metadata(this);
+
+ /* Set up the internal containers for this trace */
+ if (!fPath.exists()) {
+ throw new CTFException("Trace (" + path.getPath() + ") doesn't exist. Deleted or moved?"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ if (!fPath.isDirectory()) {
+ throw new CTFException("Path must be a valid directory"); //$NON-NLS-1$
+ }
+
+ /* Open and parse the metadata file */
+ metadata.parseFile();
+
+ init(path);
+ }
+
+ /**
+ * Streamed constructor
+ */
+ public CTFTrace() {
+ fPath = null;
+ }
+
+ private void init(File path) throws CTFException {
+
+ /* Open all the trace files */
+
+ /* List files not called metadata and not hidden. */
+ File[] files = path.listFiles(METADATA_FILE_FILTER);
+ Arrays.sort(files, METADATA_COMPARATOR);
+
+ /* Try to open each file */
+ for (File streamFile : files) {
+ openStreamInput(streamFile);
+ }
+
+ /* Create their index */
+ for (CTFStream stream : getStreams()) {
+ Set<CTFStreamInput> inputs = stream.getStreamInputs();
+ for (CTFStreamInput s : inputs) {
+ addStream(s);
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets an event declaration list for a given streamID
+ *
+ * @param streamId
+ * The ID of the stream from which to read
+ * @return The list of event declarations
+ */
+ public Collection<IEventDeclaration> getEventDeclarations(Long streamId) {
+ return fStreams.get(streamId).getEventDeclarations();
+ }
+
+ /**
+ * Method getStream gets the stream for a given id
+ *
+ * @param id
+ * Long the id of the stream
+ * @return Stream the stream that we need
+ */
+ public CTFStream getStream(Long id) {
+ if (id == null) {
+ return fStreams.get(0L);
+ }
+ return fStreams.get(id);
+ }
+
+ /**
+ * Method nbStreams gets the number of available streams
+ *
+ * @return int the number of streams
+ */
+ public int nbStreams() {
+ return fStreams.size();
+ }
+
+ /**
+ * Method setMajor sets the major version of the trace (DO NOT USE)
+ *
+ * @param major
+ * long the major version
+ */
+ public void setMajor(long major) {
+ fMajor = major;
+ }
+
+ /**
+ * Method setMinor sets the minor version of the trace (DO NOT USE)
+ *
+ * @param minor
+ * long the minor version
+ */
+ public void setMinor(long minor) {
+ fMinor = minor;
+ }
+
+ /**
+ * Method setUUID sets the UUID of a trace
+ *
+ * @param uuid
+ * UUID
+ */
+ public void setUUID(UUID uuid) {
+ fUuid = uuid;
+ }
+
+ /**
+ * Method setByteOrder sets the byte order
+ *
+ * @param byteOrder
+ * ByteOrder of the trace, can be little-endian or big-endian
+ */
+ public void setByteOrder(ByteOrder byteOrder) {
+ fByteOrder = byteOrder;
+ }
+
+ /**
+ * Method setPacketHeader sets the packet header of a trace (DO NOT USE)
+ *
+ * @param packetHeader
+ * StructDeclaration the header in structdeclaration form
+ */
+ public void setPacketHeader(StructDeclaration packetHeader) {
+ fPacketHeaderDecl = packetHeader;
+ }
+
+ /**
+ * Method majorIsSet is the major version number set?
+ *
+ * @return boolean is the major set?
+ */
+ public boolean majorIsSet() {
+ return fMajor != null;
+ }
+
+ /**
+ * Method minorIsSet. is the minor version number set?
+ *
+ * @return boolean is the minor set?
+ */
+ public boolean minorIsSet() {
+ return fMinor != null;
+ }
+
+ /**
+ * Method UUIDIsSet is the UUID set?
+ *
+ * @return boolean is the UUID set?
+ */
+ public boolean uuidIsSet() {
+ return fUuid != null;
+ }
+
+ /**
+ * Method byteOrderIsSet is the byteorder set?
+ *
+ * @return boolean is the byteorder set?
+ */
+ public boolean byteOrderIsSet() {
+ return fByteOrder != null;
+ }
+
+ /**
+ * Method packetHeaderIsSet is the packet header set?
+ *
+ * @return boolean is the packet header set?
+ */
+ public boolean packetHeaderIsSet() {
+ return fPacketHeaderDecl != null;
+ }
+
+ /**
+ * Method getUUID gets the trace UUID
+ *
+ * @return UUID gets the trace UUID
+ */
+ public UUID getUUID() {
+ return fUuid;
+ }
+
+ /**
+ * Method getMajor gets the trace major version
+ *
+ * @return long gets the trace major version
+ */
+ public long getMajor() {
+ return fMajor;
+ }
+
+ /**
+ * Method getMinor gets the trace minor version
+ *
+ * @return long gets the trace minor version
+ */
+ public long getMinor() {
+ return fMinor;
+ }
+
+ /**
+ * Method getByteOrder gets the trace byte order
+ *
+ * @return ByteOrder gets the trace byte order
+ */
+ public final ByteOrder getByteOrder() {
+ return fByteOrder;
+ }
+
+ /**
+ * Method getPacketHeader gets the trace packet header
+ *
+ * @return StructDeclaration gets the trace packet header
+ */
+ public StructDeclaration getPacketHeader() {
+ return fPacketHeaderDecl;
+ }
+
+ /**
+ * Method getTraceDirectory gets the trace directory
+ *
+ * @return File the path in "File" format.
+ */
+ public File getTraceDirectory() {
+ return fPath;
+ }
+
+ /**
+ * Get all the streams as an iterable.
+ *
+ * @return Iterable<Stream> an iterable over streams.
+ */
+ public Iterable<CTFStream> getStreams() {
+ return fStreams.values();
+ }
+
+ /**
+ * Method getPath gets the path of the trace directory
+ *
+ * @return String the path of the trace directory, in string format.
+ * @see java.io.File#getPath()
+ */
+ public String getPath() {
+ return (fPath != null) ? fPath.getPath() : ""; //$NON-NLS-1$
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ private void addStream(CTFStreamInput s) {
+
+ /*
+ * add the stream
+ */
+ CTFStream stream = s.getStream();
+ fStreams.put(stream.getId(), stream);
+
+ /*
+ * index the trace
+ */
+ s.setupIndex();
+ }
+
+ /**
+ * Tries to open the given file, reads the first packet header of the file
+ * and check its validity. This will add a file to a stream as a streaminput
+ *
+ * @param streamFile
+ * A trace file in the trace directory.
+ * @param index
+ * Which index in the class' streamFileChannel array this file
+ * must use
+ * @throws CTFException
+ * if there is a file error
+ */
+ private CTFStream openStreamInput(File streamFile) throws CTFException {
+ ByteBuffer byteBuffer;
+ BitBuffer streamBitBuffer;
+ CTFStream stream;
+
+ if (!streamFile.canRead()) {
+ throw new CTFException("Unreadable file : " //$NON-NLS-1$
+ + streamFile.getPath());
+ }
+
+ try (FileChannel fc = FileChannel.open(streamFile.toPath(), StandardOpenOption.READ)) {
+ /* Map one memory page of 4 kiB */
+ byteBuffer = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, 0, (int) Math.min(fc.size(), 4096L));
+ if (byteBuffer == null) {
+ throw new IllegalStateException("Failed to allocate memory"); //$NON-NLS-1$
+ }
+ /* Create a BitBuffer with this mapping and the trace byte order */
+ streamBitBuffer = new BitBuffer(byteBuffer, this.getByteOrder());
+
+ if (fPacketHeaderDecl != null) {
+ /* Read the packet header */
+ fPacketHeaderDef = fPacketHeaderDecl.createDefinition(this, ILexicalScope.PACKET_HEADER, streamBitBuffer);
+ }
+ } catch (IOException e) {
+ /* Shouldn't happen at this stage if every other check passed */
+ throw new CTFException(e);
+ }
+ if (fPacketHeaderDef != null) {
+ validateMagicNumber(fPacketHeaderDef);
+
+ validateUUID(fPacketHeaderDef);
+
+ /* Read the stream ID */
+ IDefinition streamIDDef = fPacketHeaderDef.lookupDefinition("stream_id"); //$NON-NLS-1$
+
+ if (streamIDDef instanceof IntegerDefinition) {
+ /* This doubles as a null check */
+ long streamID = ((IntegerDefinition) streamIDDef).getValue();
+ stream = fStreams.get(streamID);
+ } else {
+ /* No stream_id in the packet header */
+ stream = getStream(null);
+ }
+
+ } else {
+ /* No packet header, we suppose there is only one stream */
+ stream = getStream(null);
+ }
+
+ if (stream == null) {
+ throw new CTFException("Unexpected end of stream"); //$NON-NLS-1$
+ }
+
+ /*
+ * Create the stream input and add a reference to the streamInput in the
+ * stream.
+ */
+ stream.addInput(new CTFStreamInput(stream, streamFile));
+
+ return stream;
+ }
+
+ private void validateUUID(StructDefinition packetHeaderDef) throws CTFException {
+ IDefinition lookupDefinition = packetHeaderDef.lookupDefinition("uuid"); //$NON-NLS-1$
+ AbstractArrayDefinition uuidDef = (AbstractArrayDefinition) lookupDefinition;
+ if (uuidDef != null) {
+ UUID otheruuid = Utils.getUUIDfromDefinition(uuidDef);
+ if (!fUuid.equals(otheruuid)) {
+ throw new CTFException("UUID mismatch"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private static void validateMagicNumber(StructDefinition packetHeaderDef) throws CTFException {
+ IntegerDefinition magicDef = (IntegerDefinition) packetHeaderDef.lookupDefinition(CTFStrings.MAGIC);
+ if (magicDef != null) {
+ int magic = (int) magicDef.getValue();
+ if (magic != Utils.CTF_MAGIC) {
+ throw new CTFException("CTF magic mismatch"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // IDefinitionScope
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public ILexicalScope getScopePath() {
+ return ILexicalScope.TRACE;
+ }
+
+ /**
+ * Looks up a definition from packet
+ *
+ * @param lookupPath
+ * String
+ * @return Definition
+ * @see org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope#lookupDefinition(String)
+ */
+ @Override
+ public Definition lookupDefinition(String lookupPath) {
+ if (lookupPath.equals(ILexicalScope.TRACE_PACKET_HEADER.getPath())) {
+ return fPacketHeaderDef;
+ }
+ return null;
+ }
+
+ // ------------------------------------------------------------------------
+ // Live trace reading
+ // ------------------------------------------------------------------------
+
+ /**
+ * Add a new stream file to support new streams while the trace is being
+ * read.
+ *
+ * @param streamFile
+ * the file of the stream
+ * @throws CTFException
+ * A stream had an issue being read
+ */
+ public void addStreamFile(File streamFile) throws CTFException {
+ openStreamInput(streamFile);
+ }
+
+ /**
+ * Registers a new stream to the trace.
+ *
+ * @param stream
+ * A stream object.
+ * @throws ParseException
+ * If there was some problem reading the metadata
+ */
+ public void addStream(CTFStream stream) throws ParseException {
+ /*
+ * If there is already a stream without id (the null key), it must be
+ * the only one
+ */
+ if (fStreams.get(null) != null) {
+ throw new ParseException("Stream without id with multiple streams"); //$NON-NLS-1$
+ }
+
+ /*
+ * If the stream we try to add has no key set, it must be the only one.
+ * Thus, if the streams container is not empty, it is not valid.
+ */
+ if ((!stream.isIdSet()) && (!fStreams.isEmpty())) {
+ throw new ParseException("Stream without id with multiple streams"); //$NON-NLS-1$
+ }
+
+ /*
+ * If a stream with the same ID already exists, it is not valid.
+ */
+ CTFStream existingStream = fStreams.get(stream.getId());
+ if (existingStream != null) {
+ throw new ParseException("Stream id already exists"); //$NON-NLS-1$
+ }
+
+ /* This stream is valid and has a unique id. */
+ fStreams.put(stream.getId(), stream);
+ }
+
+ /**
+ * Gets the Environment variables from the trace metadata (See CTF spec)
+ *
+ * @return The environment variables in the form of an unmodifiable map
+ * (key, value)
+ */
+ public Map<String, String> getEnvironment() {
+ return Collections.unmodifiableMap(fEnvironment);
+ }
+
+ /**
+ * Add a variable to the environment variables
+ *
+ * @param varName
+ * the name of the variable
+ * @param varValue
+ * the value of the variable
+ */
+ public void addEnvironmentVar(String varName, String varValue) {
+ fEnvironment.put(varName, varValue);
+ }
+
+ /**
+ * Add a clock to the clock list
+ *
+ * @param nameValue
+ * the name of the clock (full name with scope)
+ * @param ctfClock
+ * the clock
+ */
+ public void addClock(String nameValue, CTFClock ctfClock) {
+ fClocks.put(nameValue, ctfClock);
+ }
+
+ /**
+ * gets the clock with a specific name
+ *
+ * @param name
+ * the name of the clock.
+ * @return the clock
+ */
+ public CTFClock getClock(String name) {
+ return fClocks.get(name);
+ }
+
+ /**
+ * gets the clock if there is only one. (this is 100% of the use cases as of
+ * June 2012)
+ *
+ * @return the clock
+ */
+ public final CTFClock getClock() {
+ if (fSingleClock != null && fClocks.size() == 1) {
+ return fSingleClock;
+ }
+ if (fClocks.size() == 1) {
+ fSingleClock = fClocks.get(fClocks.keySet().iterator().next());
+ return fSingleClock;
+ }
+ return null;
+ }
+
+ /**
+ * gets the time offset of a clock with respect to UTC in nanoseconds
+ *
+ * @return the time offset of a clock with respect to UTC in nanoseconds
+ */
+ public final long getOffset() {
+ if (getClock() == null) {
+ return 0;
+ }
+ return fSingleClock.getClockOffset();
+ }
+
+ /**
+ * gets the time offset of a clock with respect to UTC in nanoseconds
+ *
+ * @return the time offset of a clock with respect to UTC in nanoseconds
+ */
+ private double getTimeScale() {
+ if (getClock() == null) {
+ return 1.0;
+ }
+ return fSingleClock.getClockScale();
+ }
+
+ /**
+ * Gets the current first packet start time
+ *
+ * @return the current start time
+ */
+ public long getCurrentStartTime() {
+ long currentStart = Long.MAX_VALUE;
+ for (CTFStream stream : fStreams.values()) {
+ for (CTFStreamInput si : stream.getStreamInputs()) {
+ currentStart = Math.min(currentStart, si.getIndex().getElement(0).getTimestampBegin());
+ }
+ }
+ return timestampCyclesToNanos(currentStart);
+ }
+
+ /**
+ * Gets the current last packet end time
+ *
+ * @return the current end time
+ */
+ public long getCurrentEndTime() {
+ long currentEnd = Long.MIN_VALUE;
+ for (CTFStream stream : fStreams.values()) {
+ for (CTFStreamInput si : stream.getStreamInputs()) {
+ currentEnd = Math.max(currentEnd, si.getTimestampEnd());
+ }
+ }
+ return timestampCyclesToNanos(currentEnd);
+ }
+
+ /**
+ * Does the trace need to time scale?
+ *
+ * @return if the trace is in ns or cycles.
+ */
+ private boolean clockNeedsScale() {
+ if (getClock() == null) {
+ return false;
+ }
+ return fSingleClock.isClockScaled();
+ }
+
+ /**
+ * the inverse clock for returning to a scale.
+ *
+ * @return 1.0 / scale
+ */
+ private double getInverseTimeScale() {
+ if (getClock() == null) {
+ return 1.0;
+ }
+ return fSingleClock.getClockAntiScale();
+ }
+
+ /**
+ * @param cycles
+ * clock cycles since boot
+ * @return time in nanoseconds UTC offset
+ */
+ public long timestampCyclesToNanos(long cycles) {
+ long retVal = cycles + getOffset();
+ /*
+ * this fix is since quite often the offset will be > than 53 bits and
+ * therefore the conversion will be lossy
+ */
+ if (clockNeedsScale()) {
+ retVal = (long) (retVal * getTimeScale());
+ }
+ return retVal;
+ }
+
+ /**
+ * @param nanos
+ * time in nanoseconds UTC offset
+ * @return clock cycles since boot.
+ */
+ public long timestampNanoToCycles(long nanos) {
+ long retVal;
+ /*
+ * this fix is since quite often the offset will be > than 53 bits and
+ * therefore the conversion will be lossy
+ */
+ if (clockNeedsScale()) {
+ retVal = (long) (nanos * getInverseTimeScale());
+ } else {
+ retVal = nanos;
+ }
+ return retVal - getOffset();
+ }
+
+ /**
+ * Adds a callsite
+ *
+ * @param eventName
+ * the event name of the callsite
+ * @param funcName
+ * the name of the callsite function
+ * @param ip
+ * the ip of the callsite
+ * @param fileName
+ * the filename of the callsite
+ * @param lineNumber
+ * the line number of the callsite
+ */
+ public void addCallsite(String eventName, String funcName, long ip,
+ String fileName, long lineNumber) {
+ final CTFCallsite cs = new CTFCallsite(eventName, funcName, ip,
+ fileName, lineNumber);
+ TreeSet<CTFCallsite> csl = fCallsitesByName.get(eventName);
+ if (csl == null) {
+ csl = new TreeSet<>(fCtfCallsiteComparator);
+ fCallsitesByName.put(eventName, csl);
+ }
+
+ csl.add(cs);
+
+ fCallsitesByIP.add(cs);
+ }
+
+ /**
+ * Gets the set of callsites associated to an event name. O(1)
+ *
+ * @param eventName
+ * the event name
+ * @return the callsite set can be empty
+ */
+ public TreeSet<CTFCallsite> getCallsiteCandidates(String eventName) {
+ TreeSet<CTFCallsite> retVal = fCallsitesByName.get(eventName);
+ if (retVal == null) {
+ retVal = new TreeSet<>(fCtfCallsiteComparator);
+ }
+ return retVal;
+ }
+
+ /**
+ * The I'm feeling lucky of getCallsiteCandidates O(1)
+ *
+ * @param eventName
+ * the event name
+ * @return the first callsite that has that event name, can be null
+ */
+ public CTFCallsite getCallsite(String eventName) {
+ TreeSet<CTFCallsite> callsites = fCallsitesByName.get(eventName);
+ if (callsites != null) {
+ return callsites.first();
+ }
+ return null;
+ }
+
+ /**
+ * Gets a callsite from the instruction pointer O(log(n))
+ *
+ * @param ip
+ * the instruction pointer to lookup
+ * @return the callsite just before that IP in the list remember the IP is
+ * backwards on X86, can be null if no callsite is before the IP.
+ */
+ public CTFCallsite getCallsite(long ip) {
+ CTFCallsite cs = new CTFCallsite(null, null, ip, null, 0L);
+ return fCallsitesByIP.ceiling(cs);
+ }
+
+ /**
+ * Gets a callsite using the event name and instruction pointer O(log(n))
+ *
+ * @param eventName
+ * the name of the event
+ * @param ip
+ * the instruction pointer
+ * @return the closest matching callsite, can be null
+ */
+ public CTFCallsite getCallsite(String eventName, long ip) {
+ final TreeSet<CTFCallsite> candidates = fCallsitesByName.get(eventName);
+ if (candidates == null) {
+ return null;
+ }
+ final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1);
+ final CTFCallsite callsite = candidates.ceiling(dummyCs);
+ if (callsite == null) {
+ return candidates.floor(dummyCs);
+ }
+ return callsite;
+ }
+
+ /**
+ * Add a new stream
+ *
+ * @param id
+ * the ID of the stream
+ * @param streamFile
+ * new file in the stream
+ * @throws CTFException
+ * The file must exist
+ */
+ public void addStream(long id, File streamFile) throws CTFException {
+ CTFStream stream = null;
+ final File file = streamFile;
+ if (file == null) {
+ throw new CTFException("cannot create a stream with no file"); //$NON-NLS-1$
+ }
+ if (fStreams.containsKey(id)) {
+ stream = fStreams.get(id);
+ } else {
+ stream = new CTFStream(this);
+ fStreams.put(id, stream);
+ }
+ stream.addInput(new CTFStreamInput(stream, file));
+ }
+}
+
+class MetadataFileFilter implements FileFilter {
+
+ @Override
+ public boolean accept(File pathname) {
+ if (pathname.isDirectory()) {
+ return false;
+ }
+ if (pathname.isHidden()) {
+ return false;
+ }
+ if (pathname.getName().equals("metadata")) { //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+
+}
+
+class MetadataComparator implements Comparator<File>, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int compare(File o1, File o2) {
+ return o1.getName().compareTo(o2.getName());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Set;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
+import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputReaderTimestampComparator;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSet.Builder;
+
+/**
+ * A CTF trace reader. Reads the events of a trace.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ */
+public class CTFTraceReader implements AutoCloseable {
+
+ private static final int LINE_LENGTH = 60;
+
+ private static final int MIN_PRIO_SIZE = 16;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The trace to read from.
+ */
+ private final CTFTrace fTrace;
+
+ /**
+ * Vector of all the trace file readers.
+ */
+ private final List<CTFStreamInputReader> fStreamInputReaders =
+ Collections.synchronizedList(new ArrayList<CTFStreamInputReader>());
+
+ /**
+ * Priority queue to order the trace file readers by timestamp.
+ */
+ private PriorityQueue<CTFStreamInputReader> fPrio;
+
+ /**
+ * Array to count the number of event per trace file.
+ */
+ private long[] fEventCountPerTraceFile;
+
+ /**
+ * Timestamp of the first event in the trace
+ */
+ private long fStartTime;
+
+ /**
+ * Timestamp of the last event read so far
+ */
+ private long fEndTime;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a TraceReader to read a trace.
+ *
+ * @param trace
+ * The trace to read from.
+ * @throws CTFException
+ * if an error occurs
+ */
+ public CTFTraceReader(CTFTrace trace) throws CTFException {
+ fTrace = trace;
+ fStreamInputReaders.clear();
+
+ /**
+ * Create the trace file readers.
+ */
+ createStreamInputReaders();
+
+ /**
+ * Populate the timestamp-based priority queue.
+ */
+ populateStreamInputReaderHeap();
+
+ /**
+ * Get the start Time of this trace bear in mind that the trace could be
+ * empty.
+ */
+ fStartTime = 0;
+ if (hasMoreEvents()) {
+ fStartTime = getTopStream().getCurrentEvent().getTimestamp();
+ setEndTime(fStartTime);
+ }
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @return The new CTFTraceReader
+ * @throws CTFException
+ * if an error occurs
+ */
+ public CTFTraceReader copyFrom() throws CTFException {
+ CTFTraceReader newReader = null;
+
+ newReader = new CTFTraceReader(fTrace);
+ newReader.fStartTime = fStartTime;
+ newReader.setEndTime(fEndTime);
+ return newReader;
+ }
+
+ /**
+ * Dispose the CTFTraceReader
+ */
+ @Override
+ public void close() {
+ synchronized (fStreamInputReaders) {
+ for (CTFStreamInputReader reader : fStreamInputReaders) {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ Activator.logError(e.getMessage(), e);
+ }
+ }
+ }
+ fStreamInputReaders.clear();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the start time of this trace (== timestamp of the first event)
+ *
+ * @return the trace start time
+ */
+ public long getStartTime() {
+ return fStartTime;
+ }
+
+ /**
+ * Set the trace's end time
+ *
+ * @param endTime
+ * The end time to use
+ */
+ protected final void setEndTime(long endTime) {
+ fEndTime = endTime;
+ }
+
+ /**
+ * Get the priority queue of this trace reader.
+ *
+ * @return The priority queue of input readers
+ */
+ protected PriorityQueue<CTFStreamInputReader> getPrio() {
+ return fPrio;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates one trace file reader per trace file contained in the trace.
+ *
+ * @throws CTFException
+ * if an error occurs
+ */
+ private void createStreamInputReaders() throws CTFException {
+ /*
+ * For each stream.
+ */
+ for (CTFStream stream : fTrace.getStreams()) {
+ Set<CTFStreamInput> streamInputs = stream.getStreamInputs();
+
+ /*
+ * For each trace file of the stream.
+ */
+ for (CTFStreamInput streamInput : streamInputs) {
+
+ /*
+ * Create a reader and add it to the group.
+ */
+ fStreamInputReaders.add(new CTFStreamInputReader(streamInput));
+ }
+ }
+
+ /*
+ * Create the array to count the number of event per trace file.
+ */
+ fEventCountPerTraceFile = new long[fStreamInputReaders.size()];
+ }
+
+ /**
+ * Update the priority queue to make it match the parent trace
+ *
+ * @throws CTFException
+ * An error occured
+ */
+ public void update() throws CTFException {
+ Set<CTFStreamInputReader> readers = new HashSet<>();
+ for (CTFStream stream : fTrace.getStreams()) {
+ Set<CTFStreamInput> streamInputs = stream.getStreamInputs();
+ for (CTFStreamInput streamInput : streamInputs) {
+ /*
+ * Create a reader.
+ */
+ CTFStreamInputReader streamInputReader = new CTFStreamInputReader(
+ streamInput);
+
+ /*
+ * Add it to the group.
+ */
+ if (!fStreamInputReaders.contains(streamInputReader)) {
+ streamInputReader.readNextEvent();
+ fStreamInputReaders.add(streamInputReader);
+ readers.add(streamInputReader);
+ }
+ }
+ }
+ long[] temp = fEventCountPerTraceFile;
+ fEventCountPerTraceFile = new long[readers.size() + temp.length];
+ for (CTFStreamInputReader reader : readers) {
+ fPrio.add(reader);
+ }
+ for (int i = 0; i < temp.length; i++) {
+ fEventCountPerTraceFile[i] = temp[i];
+ }
+ }
+
+ /**
+ * Gets an iterable of the stream input readers, useful for foreaches
+ *
+ * @return the iterable of the stream input readers
+ */
+ public Iterable<IEventDeclaration> getEventDeclarations() {
+ ImmutableSet.Builder<IEventDeclaration> builder = new Builder<>();
+ for (CTFStreamInputReader sir : fStreamInputReaders) {
+ builder.addAll(sir.getEventDeclarations());
+ }
+ return builder.build();
+ }
+
+ /**
+ * Initializes the priority queue used to choose the trace file with the
+ * lower next event timestamp.
+ *
+ * @throws CTFException
+ * if an error occurs
+ */
+ private void populateStreamInputReaderHeap() throws CTFException {
+ if (fStreamInputReaders.isEmpty()) {
+ fPrio = new PriorityQueue<>(MIN_PRIO_SIZE,
+ new StreamInputReaderTimestampComparator());
+ return;
+ }
+
+ /*
+ * Create the priority queue with a size twice as bigger as the number
+ * of reader in order to avoid constant resizing.
+ */
+ fPrio = new PriorityQueue<>(
+ Math.max(fStreamInputReaders.size() * 2, MIN_PRIO_SIZE),
+ new StreamInputReaderTimestampComparator());
+
+ int pos = 0;
+
+ for (CTFStreamInputReader reader : fStreamInputReaders) {
+ /*
+ * Add each trace file reader in the priority queue, if we are able
+ * to read an event from it.
+ */
+ reader.setParent(this);
+ CTFResponse readNextEvent = reader.readNextEvent();
+ if (readNextEvent == CTFResponse.OK || readNextEvent == CTFResponse.WAIT) {
+ fPrio.add(reader);
+
+ fEventCountPerTraceFile[pos] = 0;
+ reader.setName(pos);
+
+ pos++;
+ }
+ }
+ }
+
+ /**
+ * Get the current event, which is the current event of the trace file
+ * reader with the lowest timestamp.
+ *
+ * @return An event definition, or null of the trace reader reached the end
+ * of the trace.
+ */
+ public EventDefinition getCurrentEventDef() {
+ CTFStreamInputReader top = getTopStream();
+ return (top != null) ? top.getCurrentEvent() : null;
+ }
+
+ /**
+ * Go to the next event.
+ *
+ * @return True if an event was read.
+ * @throws CTFException
+ * if an error occurs
+ */
+ public boolean advance() throws CTFException {
+ /*
+ * Remove the reader from the top of the priority queue.
+ */
+ CTFStreamInputReader top = fPrio.poll();
+
+ /*
+ * If the queue was empty.
+ */
+ if (top == null) {
+ return false;
+ }
+ /*
+ * Read the next event of this reader.
+ */
+ switch (top.readNextEvent()) {
+ case OK: {
+ /*
+ * Add it back in the queue.
+ */
+ fPrio.add(top);
+ final long topEnd = fTrace.timestampCyclesToNanos(top.getCurrentEvent().getTimestamp());
+ setEndTime(Math.max(topEnd, getEndTime()));
+ fEventCountPerTraceFile[top.getName()]++;
+
+ if (top.getCurrentEvent() != null) {
+ fEndTime = Math.max(top.getCurrentEvent().getTimestamp(),
+ fEndTime);
+ }
+ break;
+ }
+ case WAIT: {
+ fPrio.add(top);
+ break;
+ }
+ case FINISH:
+ break;
+ case ERROR:
+ default:
+ // something bad happend
+ }
+ /*
+ * If there is no reader in the queue, it means the trace reader reached
+ * the end of the trace.
+ */
+ return hasMoreEvents();
+ }
+
+ /**
+ * Go to the last event in the trace.
+ *
+ * @throws CTFException
+ * if an error occurs
+ */
+ public void goToLastEvent() throws CTFException {
+ seek(getEndTime());
+ while (fPrio.size() > 1) {
+ advance();
+ }
+ }
+
+ /**
+ * Seeks to a given timestamp. It will seek to the nearest event greater or
+ * equal to timestamp. If a trace is [10 20 30 40] and you are looking for
+ * 19, it will give you 20. If you want 20, you will get 20, if you want 21,
+ * you will get 30. The value -inf will seek to the first element and the
+ * value +inf will seek to the end of the file (past the last event).
+ *
+ * @param timestamp
+ * the timestamp to seek to
+ * @return true if there are events above or equal the seek timestamp, false
+ * if seek at the end of the trace (no valid event).
+ * @throws CTFException
+ * if an error occurs
+ */
+ public boolean seek(long timestamp) throws CTFException {
+ /*
+ * Remove all the trace readers from the priority queue
+ */
+ fPrio.clear();
+ for (CTFStreamInputReader streamInputReader : fStreamInputReaders) {
+ /*
+ * Seek the trace reader.
+ */
+ streamInputReader.seek(timestamp);
+
+ /*
+ * Add it to the priority queue if there is a current event.
+ */
+ if (streamInputReader.getCurrentEvent() != null) {
+ fPrio.add(streamInputReader);
+ }
+ }
+ return hasMoreEvents();
+ }
+
+ /**
+ * Gets the stream with the oldest event
+ *
+ * @return the stream with the oldest event
+ */
+ public CTFStreamInputReader getTopStream() {
+ return fPrio.peek();
+ }
+
+ /**
+ * Does the trace have more events?
+ *
+ * @return true if yes.
+ */
+ public final boolean hasMoreEvents() {
+ return fPrio.size() > 0;
+ }
+
+ /**
+ * Prints the event count stats.
+ */
+ public void printStats() {
+ printStats(LINE_LENGTH);
+ }
+
+ /**
+ * Prints the event count stats.
+ *
+ * @param width
+ * Width of the display.
+ */
+ public void printStats(int width) {
+ int numEvents = 0;
+ if (width == 0) {
+ return;
+ }
+
+ for (long i : fEventCountPerTraceFile) {
+ numEvents += i;
+ }
+
+ for (int j = 0; j < fEventCountPerTraceFile.length; j++) {
+ CTFStreamInputReader se = fStreamInputReaders.get(j);
+
+ long len = (width * fEventCountPerTraceFile[se.getName()])
+ / numEvents;
+
+ StringBuilder sb = new StringBuilder(se.getFilename());
+ sb.append("\t["); //$NON-NLS-1$
+
+ for (int i = 0; i < len; i++) {
+ sb.append('+');
+ }
+
+ for (long i = len; i < width; i++) {
+ sb.append(' ');
+ }
+
+ sb.append("]\t" + fEventCountPerTraceFile[se.getName()] + " Events"); //$NON-NLS-1$//$NON-NLS-2$
+ Activator.log(sb.toString());
+ }
+ }
+
+ /**
+ * Gets the last event timestamp that was read. This is NOT necessarily the
+ * last event in a trace, just the last one read so far.
+ *
+ * @return the last event
+ */
+ public long getEndTime() {
+ return fEndTime;
+ }
+
+ /**
+ * Sets a trace to be live or not
+ *
+ * @param live
+ * whether the trace is live
+ */
+ public void setLive(boolean live) {
+ for (CTFStreamInputReader s : fPrio) {
+ s.setLive(live);
+ }
+ }
+
+ /**
+ * Get if the trace is to read live or not
+ *
+ * @return whether the trace is live or not
+ */
+ public boolean isLive() {
+ return getTopStream().isLive();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result) + (int) (fStartTime ^ (fStartTime >>> 32));
+ result = (prime * result) + fStreamInputReaders.hashCode();
+ result = (prime * result) + ((fTrace == null) ? 0 : fTrace.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CTFTraceReader)) {
+ return false;
+ }
+ CTFTraceReader other = (CTFTraceReader) obj;
+ if (!fStreamInputReaders.equals(other.fStreamInputReaders)) {
+ return false;
+ }
+ if (fTrace == null) {
+ if (other.fTrace != null) {
+ return false;
+ }
+ } else if (!fTrace.equals(other.fTrace)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ /* Only for debugging, shouldn't be externalized */
+ return "CTFTraceReader [trace=" + fTrace + ']'; //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the parent trace
+ *
+ * @return the parent trace
+ */
+ public CTFTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * This will read the entire trace and populate all the indexes. The reader
+ * will then be reset to the first event in the trace.
+ *
+ * Do not call in the fast path.
+ *
+ * @throws CTFException
+ * A trace reading error occurred
+ * @since 1.0
+ */
+ public void populateIndex() throws CTFException {
+ for (CTFStreamInputReader sir : fPrio) {
+ sir.goToLastEvent();
+ }
+ seek(0);
+
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+
+/**
+ * A CTF trace reader. Reads the events of a trace.
+ *
+ * @author Bernd Hufmann
+ * @since 1.0
+ */
+public class CTFTraceWriter {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The trace to read from.
+ */
+ @Nullable private final CTFTrace fInTrace;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a TraceReader to read a trace.
+ *
+ * @param trace
+ * The trace to read from.
+ * @throws CTFException
+ * if an error occurs
+ */
+ public CTFTraceWriter(@NonNull CTFTrace trace) throws CTFException {
+ fInTrace = trace;
+ try (CTFTraceReader fTraceReader = new CTFTraceReader(fInTrace)) {
+ fTraceReader.populateIndex();
+ }
+ }
+
+ /**
+ * Copies packets from the relevant input to the output trace based
+ * on a given time range. The following condition has to be met so that
+ * a packet is written to the output trace:
+ *
+ * startTime <= packet.getTimestampBegin() <= endTime
+ *
+ * @param startTime
+ * start time of packets to be included in output trace
+ * @param endTime
+ * end time of packets to be included in the output trace
+ * @param newTracePath
+ * the path of the new trace to be written
+ * @throws CTFException
+ * If a reading or writing error occurs
+ */
+ public void copyPackets(long startTime, long endTime, String newTracePath) throws CTFException {
+ CTFTrace trace = fInTrace;
+ if (trace != null) {
+ long adjustedStart = startTime - trace.getClock().getClockOffset();
+ long adjustedEnd = endTime - trace.getClock().getClockOffset();
+ File out = new File(newTracePath);
+ if (out.exists()) {
+ throw new CTFIOException("Trace segment cannot be created since trace already exists: " + newTracePath); //$NON-NLS-1$
+ }
+
+ // create new directory
+ boolean isSuccess = out.mkdir();
+ if (!isSuccess) {
+ throw new CTFIOException("Creating trace directory failed: " + newTracePath); //$NON-NLS-1$
+ }
+
+ // copy metadata
+ Metadata metadata = new Metadata(fInTrace);
+ try {
+ metadata.copyTo(out);
+ } catch (IOException e) {
+ throw new CTFIOException("Error copying metadata: " + e.toString(), e); //$NON-NLS-1$
+ }
+
+ // Copy packets
+ for (CTFStream stream : trace.getStreams()) {
+ Set<CTFStreamInput> inputs = stream.getStreamInputs();
+ for (CTFStreamInput s : inputs) {
+ CTFStreamOutputWriter streamOutputwriter = new CTFStreamOutputWriter(checkNotNull(s), out);
+ streamOutputwriter.copyPackets(adjustedStart, adjustedEnd);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.ctf.core.trace;
+
+/**
+ * CTF Packet descriptor, can come from a packet header or an index file, this
+ * will show certain information about the packet such as the size and
+ * timerange.
+ *
+ * @since 1.0
+ */
+public interface ICTFPacketDescriptor {
+
+ /**
+ * Returns whether the packet includes (inclusively) the given timestamp in
+ * the begin-end timestamp range.
+ *
+ * @param ts
+ * The timestamp to check.
+ * @return True if the packet includes the timestamp.
+ */
+ boolean includes(long ts);
+
+ /**
+ * Gets the offset of a packet within a stream in bits
+ *
+ * @return the offset bits
+ */
+ long getOffsetBits();
+
+ /**
+ * Gets the size of the packet in bits. If you have a 1mb packet that is 499kb
+ * used and the header is 1kb, this will return 1mb
+ *
+ * @return the packetSizeBits
+ */
+ long getPacketSizeBits();
+
+ /**
+ * Get the content size of the packet in bits. If you have a 1mb packet that is 499kb
+ * used and the header is 1kb, this will return 500kb (used data + header
+ *
+ * @return the contentSizeBits
+ */
+ long getContentSizeBits();
+
+ /**
+ * Gets the beginning timestamp of the packet, all events within the packet will have timestamps after or at this time
+ *
+ * @return the timestampBegin
+ */
+ long getTimestampBegin();
+
+ /**
+ * Gets the ending timestamp of the packet, all events within the packet will have timestamps before or at this time
+ *
+ * @return the timestampEnd
+ */
+ long getTimestampEnd();
+
+ /**
+ * Gets the number of lost events in this packet
+ *
+ * @return the lostEvents in this packet
+ */
+ long getLostEvents();
+
+ /**
+ * Retrieve the value of an existing attribute
+ *
+ * @param field
+ * The name of the attribute
+ * @return The value that was stored, or null if it wasn't found
+ */
+ Object lookupAttribute(String field);
+
+ /**
+ * Get the target of the packet (what device generated this packet)
+ *
+ * @return The target that is being traced
+ */
+ String getTarget();
+
+ /**
+ * Get the id of the target of the packet (a number helper)
+ *
+ * @return The ID of the target
+ */
+ long getTargetId();
+
+ /**
+ * Get the offset of the packet in bytes within the stream
+ *
+ * @return The offset of the packet in bytes
+ */
+ long getOffsetBytes();
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Matthew Khouzam - Update for live trace reading support
+ * Bernd Hufmann - Add method to copy metadata file
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.core.trace;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.util.UUID;
+
+import org.antlr.runtime.ANTLRReaderStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.tree.CommonTree;
+import org.antlr.runtime.tree.RewriteCardinalityException;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.parser.CTFLexer;
+import org.eclipse.tracecompass.ctf.parser.CTFParser;
+import org.eclipse.tracecompass.ctf.parser.CTFParser.parse_return;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.IOStructGen;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.CtfAntlrException;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
+
+/**
+ * The CTF trace metadata TSDL file
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public class Metadata {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+ private static final String TEXT_ONLY_METADATA_HEADER_PREFIX = "/* CTF"; //$NON-NLS-1$
+
+ private static final int PREVALIDATION_SIZE = 8;
+
+ private static final int BITS_PER_BYTE = Byte.SIZE;
+
+ /**
+ * Name of the metadata file in the trace directory
+ */
+ private static final String METADATA_FILENAME = "metadata"; //$NON-NLS-1$
+
+ /**
+ * Size of the metadata packet header, in bytes, computed by hand.
+ */
+ private static final int METADATA_PACKET_HEADER_SIZE = 37;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * Byte order as detected when reading the TSDL magic number.
+ */
+ private ByteOrder detectedByteOrder = null;
+
+ /**
+ * The trace file to which belongs this metadata file.
+ */
+ private final CTFTrace trace;
+
+ private IOStructGen fTreeParser;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs a Metadata object.
+ *
+ * @param trace
+ * The trace to which belongs this metadata file.
+ */
+ public Metadata(CTFTrace trace) {
+ this.trace = trace;
+ }
+
+ /**
+ * For network streaming
+ */
+ public Metadata() {
+ trace = new CTFTrace();
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the ByteOrder that was detected while parsing the metadata.
+ *
+ * @return The byte order.
+ */
+ public ByteOrder getDetectedByteOrder() {
+ return detectedByteOrder;
+ }
+
+ /**
+ * Gets the parent trace
+ *
+ * @return the parent trace
+ */
+ public CTFTrace getTrace() {
+ return trace;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Parse the metadata file.
+ *
+ * @throws CTFException
+ * If there was a problem parsing the metadata
+ */
+ public void parseFile() throws CTFException {
+
+ /*
+ * Reader. It will contain a StringReader if we are using packet-based
+ * metadata and it will contain a FileReader if we have text-based
+ * metadata.
+ */
+
+ try (FileInputStream fis = new FileInputStream(getMetadataPath());
+ FileChannel metadataFileChannel = fis.getChannel();
+ /* Check if metadata is packet-based, if not it is text based */
+ Reader metadataTextInput =
+ (isPacketBased(metadataFileChannel) ?
+ readBinaryMetaData(metadataFileChannel) :
+ new FileReader(getMetadataPath()));) {
+
+ readMetaDataText(metadataTextInput);
+
+ } catch (FileNotFoundException e) {
+ throw new CTFException("Cannot find metadata file!", e); //$NON-NLS-1$
+ } catch (IOException | ParseException e) {
+ throw new CTFException(e);
+ } catch (RecognitionException | RewriteCardinalityException e) {
+ throw new CtfAntlrException(e);
+ }
+ }
+
+ private Reader readBinaryMetaData(FileChannel metadataFileChannel) throws CTFException {
+ /* Create StringBuffer to receive metadata text */
+ StringBuffer metadataText = new StringBuffer();
+
+ /*
+ * Read metadata packet one by one, appending the text to the
+ * StringBuffer
+ */
+ MetadataPacketHeader packetHeader = readMetadataPacket(
+ metadataFileChannel, metadataText);
+ while (packetHeader != null) {
+ packetHeader = readMetadataPacket(metadataFileChannel,
+ metadataText);
+ }
+
+ /* Wrap the metadata string with a StringReader */
+ return new StringReader(metadataText.toString());
+ }
+
+ /**
+ * Executes a weak validation of the metadata. It checks if a file with
+ * name metadata exists and if one of the following conditions are met:
+ * - For text-only metadata, the file starts with "/* CTF" (without the quotes)
+ * - For packet-based metadata, the file starts with correct magic number
+ *
+ * @param path
+ * path to CTF trace directory
+ * @return <code>true</code> if pre-validation is ok else <code>false</code>
+ * @throws CTFException
+ * file channel cannot be created
+ * @since 1.0
+ */
+ public static boolean preValidate(String path) throws CTFException {
+ String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME;
+ File metadataFile = new File(metadataPath);
+ if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) {
+ try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) {
+ ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE);
+ bb.clear();
+ fc.read(bb);
+ bb.flip();
+ if (bb.getInt(0) == Utils.TSDL_MAGIC) {
+ return true;
+ }
+ bb.order(ByteOrder.LITTLE_ENDIAN);
+ if (bb.getInt(0) == Utils.TSDL_MAGIC) {
+ return true;
+ }
+ bb.position(0);
+ Charset forName = Charset.forName("ASCII"); //$NON-NLS-1$
+ byte bytes[] = new byte[PREVALIDATION_SIZE];
+ bb.get(bytes);
+ String text = new String(bytes, forName);
+ return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX);
+ } catch (IOException e) {
+ throw new CTFException(e.getMessage(), e);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Read the metadata from a formatted TSDL string
+ *
+ * @param data
+ * the data to read
+ * @throws CTFException
+ * this exception wraps a ParseException, IOException or
+ * CtfAntlrException, three exceptions that can be obtained from
+ * parsing a TSDL file
+ */
+ public void parseText(String data) throws CTFException {
+ Reader metadataTextInput = new StringReader(data);
+ try {
+ readMetaDataText(metadataTextInput);
+ } catch (IOException | ParseException e) {
+ throw new CTFException(e);
+ } catch (RecognitionException | RewriteCardinalityException e) {
+ throw new CtfAntlrException(e);
+ }
+
+ }
+
+ private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException {
+ CommonTree tree = createAST(metadataTextInput);
+
+ /* Generate IO structures (declarations) */
+ fTreeParser = new IOStructGen(tree, trace);
+ fTreeParser.generate();
+ }
+
+ /**
+ * Read a metadata fragment from a formatted TSDL string
+ *
+ * @param dataFragment
+ * the data to read
+ * @throws CTFException
+ * this exception wraps a ParseException, IOException or
+ * CtfAntlrException, three exceptions that can be obtained from
+ * parsing a TSDL file
+ */
+ public void parseTextFragment(String dataFragment) throws CTFException {
+ Reader metadataTextInput = new StringReader(dataFragment);
+ try {
+ readMetaDataTextFragment(metadataTextInput);
+ } catch (IOException | ParseException e) {
+ throw new CTFException(e);
+ } catch (RecognitionException | RewriteCardinalityException e) {
+ throw new CtfAntlrException(e);
+ }
+ }
+
+ private void readMetaDataTextFragment(Reader metadataTextInput) throws IOException, RecognitionException, ParseException {
+ CommonTree tree = createAST(metadataTextInput);
+ fTreeParser.setTree(tree);
+ fTreeParser.generateFragment();
+ }
+
+ private static CommonTree createAST(Reader metadataTextInput) throws IOException,
+ RecognitionException {
+ /* Create an ANTLR reader */
+ ANTLRReaderStream antlrStream;
+ antlrStream = new ANTLRReaderStream(metadataTextInput);
+
+ /* Parse the metadata text and get the AST */
+ CTFLexer ctfLexer = new CTFLexer(antlrStream);
+ CommonTokenStream tokens = new CommonTokenStream(ctfLexer);
+ CTFParser ctfParser = new CTFParser(tokens, false);
+
+ parse_return pr = ctfParser.parse();
+ return pr.getTree();
+ }
+
+ /**
+ * Determines whether the metadata file is packet-based by looking at the
+ * TSDL magic number. If it is packet-based, it also gives information about
+ * the endianness of the trace using the detectedByteOrder attribute.
+ *
+ * @param metadataFileChannel
+ * FileChannel of the metadata file.
+ * @return True if the metadata is packet-based.
+ * @throws CTFException
+ */
+ private boolean isPacketBased(FileChannel metadataFileChannel)
+ throws CTFException {
+ /*
+ * Create a ByteBuffer to read the TSDL magic number (default is
+ * big-endian)
+ */
+ ByteBuffer magicByteBuffer = ByteBuffer.allocate(Utils.TSDL_MAGIC_LEN);
+
+ /* Read without changing file position */
+ try {
+ metadataFileChannel.read(magicByteBuffer, 0);
+ } catch (IOException e) {
+ throw new CTFException("Unable to read metadata file channel.", e); //$NON-NLS-1$
+ }
+
+ /* Get the first int from the file */
+ int magic = magicByteBuffer.getInt(0);
+
+ /* Check if it matches */
+ if (Utils.TSDL_MAGIC == magic) {
+ detectedByteOrder = ByteOrder.BIG_ENDIAN;
+ return true;
+ }
+
+ /* Try the same thing, but with little-endian */
+ magicByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
+ magic = magicByteBuffer.getInt(0);
+
+ if (Utils.TSDL_MAGIC == magic) {
+ detectedByteOrder = ByteOrder.LITTLE_ENDIAN;
+ return true;
+ }
+
+ return false;
+ }
+
+ private String getMetadataPath() {
+ /* Path of metadata file = trace directory path + metadata filename */
+ if (trace.getTraceDirectory() == null) {
+ return new String();
+ }
+ return trace.getTraceDirectory().getPath()
+ + Utils.SEPARATOR + METADATA_FILENAME;
+ }
+
+ /**
+ * Reads a metadata packet from the given metadata FileChannel, do some
+ * basic validation and append the text to the StringBuffer.
+ *
+ * @param metadataFileChannel
+ * Metadata FileChannel
+ * @param metadataText
+ * StringBuffer to which the metadata text will be appended.
+ * @return A structure describing the header of the metadata packet, or null
+ * if the end of the file is reached.
+ * @throws CTFException
+ */
+ private MetadataPacketHeader readMetadataPacket(
+ FileChannel metadataFileChannel, StringBuffer metadataText)
+ throws CTFException {
+ /* Allocate a ByteBuffer for the header */
+ ByteBuffer headerByteBuffer = ByteBuffer.allocate(METADATA_PACKET_HEADER_SIZE);
+
+ /* Read the header */
+ try {
+ int nbBytesRead = metadataFileChannel.read(headerByteBuffer);
+
+ /* Return null if EOF */
+ if (nbBytesRead < 0) {
+ return null;
+ }
+
+ if (nbBytesRead != METADATA_PACKET_HEADER_SIZE) {
+ throw new CTFException("Error reading the metadata header."); //$NON-NLS-1$
+ }
+
+ } catch (IOException e) {
+ throw new CTFException("Error reading the metadata header.", e); //$NON-NLS-1$
+ }
+
+ /* Set ByteBuffer's position to 0 */
+ headerByteBuffer.position(0);
+
+ /* Use byte order that was detected with the magic number */
+ headerByteBuffer.order(detectedByteOrder);
+
+ MetadataPacketHeader header = new MetadataPacketHeader(headerByteBuffer);
+
+ /* Check TSDL magic number */
+ if (!header.isMagicValid()) {
+ throw new CTFException("TSDL magic number does not match"); //$NON-NLS-1$
+ }
+
+ /* Check UUID */
+ if (!trace.uuidIsSet()) {
+ trace.setUUID(header.getUuid());
+ } else if (!trace.getUUID().equals(header.getUuid())) {
+ throw new CTFException("UUID mismatch"); //$NON-NLS-1$
+ }
+
+ /* Extract the text from the packet */
+ int payloadSize = ((header.getContentSize() / BITS_PER_BYTE) - METADATA_PACKET_HEADER_SIZE);
+ if (payloadSize < 0) {
+ throw new CTFException("Invalid metadata packet payload size."); //$NON-NLS-1$
+ }
+ int skipSize = (header.getPacketSize() - header.getContentSize()) / BITS_PER_BYTE;
+
+ /* Read the payload + the padding in a ByteBuffer */
+ ByteBuffer payloadByteBuffer = ByteBuffer.allocateDirect(payloadSize
+ + skipSize);
+ try {
+ metadataFileChannel.read(payloadByteBuffer);
+ } catch (IOException e) {
+ throw new CTFException("Error reading metadata packet payload.", e); //$NON-NLS-1$
+ }
+ payloadByteBuffer.rewind();
+
+ /* Read only the payload from the ByteBuffer into a byte array */
+ byte payloadByteArray[] = new byte[payloadByteBuffer.remaining()];
+ payloadByteBuffer.get(payloadByteArray, 0, payloadSize);
+
+ /* Convert the byte array to a String */
+ String str = new String(payloadByteArray, 0, payloadSize);
+
+ /* Append it to the existing metadata */
+ metadataText.append(str);
+
+ return header;
+ }
+
+ private static class MetadataPacketHeader {
+
+ private static final int UUID_SIZE = 16;
+ private final int fMagic;
+ private final UUID fUuid;
+ private final int fChecksum;
+ private final int fContentSize;
+ private final int fPacketSize;
+ private final byte fCompressionScheme;
+ private final byte fEncryptionScheme;
+ private final byte fChecksumScheme;
+ private final byte fCtfMajorVersion;
+ private final byte fCtfMinorVersion;
+
+ public MetadataPacketHeader(ByteBuffer headerByteBuffer) {
+ /* Read from the ByteBuffer */
+ fMagic = headerByteBuffer.getInt();
+ byte[] uuidBytes = new byte[UUID_SIZE];
+ headerByteBuffer.get(uuidBytes);
+ fUuid = Utils.makeUUID(uuidBytes);
+ fChecksum = headerByteBuffer.getInt();
+ fContentSize = headerByteBuffer.getInt();
+ fPacketSize = headerByteBuffer.getInt();
+ fCompressionScheme = headerByteBuffer.get();
+ fEncryptionScheme = headerByteBuffer.get();
+ fChecksumScheme = headerByteBuffer.get();
+ fCtfMajorVersion = headerByteBuffer.get();
+ fCtfMinorVersion = headerByteBuffer.get();
+ }
+
+ public boolean isMagicValid() {
+ return fMagic == Utils.TSDL_MAGIC;
+ }
+
+ public UUID getUuid() {
+ return fUuid;
+ }
+
+ public int getContentSize() {
+ return fContentSize;
+ }
+
+ public int getPacketSize() {
+ return fPacketSize;
+ }
+
+ @Override
+ public String toString() {
+ /* Only for debugging, shouldn't be externalized */
+ /* Therefore it cannot be covered by test cases */
+ return "MetadataPacketHeader [magic=0x" //$NON-NLS-1$
+ + Integer.toHexString(fMagic) + ", uuid=" //$NON-NLS-1$
+ + fUuid.toString() + ", checksum=" + fChecksum //$NON-NLS-1$
+ + ", contentSize=" + fContentSize + ", packetSize=" //$NON-NLS-1$ //$NON-NLS-2$
+ + fPacketSize + ", compressionScheme=" + fCompressionScheme //$NON-NLS-1$
+ + ", encryptionScheme=" + fEncryptionScheme //$NON-NLS-1$
+ + ", checksumScheme=" + fChecksumScheme //$NON-NLS-1$
+ + ", ctfMajorVersion=" + fCtfMajorVersion //$NON-NLS-1$
+ + ", ctfMinorVersion=" + fCtfMinorVersion + ']'; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Copies the metadata file to a destination directory.
+ * @param path
+ * the destination directory
+ * @return the path to the target file
+ * @throws IOException
+ * if an error occurred
+ *
+ * @since 1.0
+ */
+ public Path copyTo(final File path) throws IOException {
+ Path source = FileSystems.getDefault().getPath(trace.getTraceDirectory().getAbsolutePath(), METADATA_FILENAME);
+ Path destPath = FileSystems.getDefault().getPath(path.getAbsolutePath());
+ return Files.copy(source, destPath.resolve(source.getFileName()));
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * <b><u>Activator</u></b>
+ * <p>
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends Plugin {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.tracecompass.ctf.core"; //$NON-NLS-1$
+
+ /**
+ * The shared instance
+ */
+ private static Activator fPlugin;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ */
+ public Activator() {
+ setDefault(this);
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the default activator
+ * @return the default activator
+ */
+ public static Activator getDefault() {
+ return fPlugin;
+ }
+
+ /**
+ * Sets the default activator
+ *
+ * @param plugin the default activator
+ */
+ private static void setDefault(Activator plugin) {
+ fPlugin = plugin;
+ }
+
+ // ------------------------------------------------------------------------
+ // Plugin
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ setDefault(this);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ setDefault(null);
+ super.stop(context);
+ }
+
+ // ------------------------------------------------------------------------
+ // Logging
+ // ------------------------------------------------------------------------
+
+ /**
+ * Log a message
+ *
+ * @param msg
+ * The message to log
+ */
+ public static void log(String msg) {
+ log(msg, null);
+ }
+
+ /**
+ * Log a message with an exception
+ *
+ * @param msg
+ * The message
+ * @param e
+ * The exception
+ */
+ public static void log(String msg, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
+ }
+
+ /**
+ * Log an error, with an associated exception
+ *
+ * @param msg
+ * The error message
+ * @param e
+ * The cause
+ */
+ public static void logError(String msg, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e));
+ }
+
+ /**
+ * Log a message
+ *
+ * @param severity
+ * Desired severity of the message in the log, one of
+ * {@link IStatus#INFO}, {@link IStatus#WARNING} or
+ * {@link IStatus#ERROR}
+ * @param msg
+ * The message to log
+ */
+ public static void log(int severity, String msg) {
+ getDefault().getLog().log(new Status(severity, PLUGIN_ID, msg));
+ }
+
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+/**
+ * A common utility for mapping a ByteBuffer safely to work around a bug on
+ * Windows which prevents deleting a file after it was mapped. On Windows, the
+ * ByteBuffer will be allocated and the file will be read instead of being
+ * mapped.
+ *
+ * http://bugs.java.com/view_bug.do?bug_id=4715154
+ */
+public class SafeMappedByteBuffer {
+
+ private static final boolean IS_WIN32 = System.getProperty("os.name").startsWith("Windows"); //$NON-NLS-1$//$NON-NLS-2$
+
+ private SafeMappedByteBuffer(){}
+
+ /**
+ * Maps a region of this channel's file directly into memory. On Windows,
+ * this will allocate a new ByteBuffer and read the file.
+ *
+ * @param fc
+ * the file channel
+ * @param mode
+ * the mapping mode
+ * @param position
+ * the position within the file
+ * @param size
+ * the size of the region to be mapped (or read)
+ * @return the mapped ByteBuffer
+ * @throws IOException
+ * on FileChannel operations failures
+ */
+ public static ByteBuffer map(FileChannel fc, FileChannel.MapMode mode, long position, long size) throws IOException {
+ ByteBuffer byteBuffer;
+ if (IS_WIN32) {
+ byteBuffer = ByteBuffer.allocate((int) size);
+ fc.read(byteBuffer, position);
+ byteBuffer.flip();
+ } else {
+ byteBuffer = fc.map(mode, position, size);
+ }
+
+ return byteBuffer;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Simon Delisle - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event;
+
+import java.util.Comparator;
+
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+
+/**
+ * Comparator for CTFCallsite
+ *
+ * @author Simon Delisle
+ */
+public class CTFCallsiteComparator implements Comparator<CTFCallsite> {
+
+ private static final long MASK32 = 0x00000000ffffffffL;
+
+ /*
+ * The callsites will be sorted by calling addresses. To do this we take IPs
+ * (instruction pointers) and compare them. Java only supports signed
+ * operation and since memory addresses are unsigned, we will convert the
+ * longs into integers that contain the high and low bytes and compare them.
+ */
+ @Override
+ public int compare(CTFCallsite o1, CTFCallsite o2) {
+ /*
+ * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
+ * will return the lower 32 bits
+ */
+
+ long other = o2.getIp();
+ /*
+ * To get a high int: we downshift by 32 and bitwise and with the mask
+ * to get rid of the sign
+ *
+ * To get the low int: we bitwise and with the mask.
+ */
+ long otherHigh = (other >> 32) & MASK32;
+ long otherLow = other & MASK32;
+ long ownHigh = (o1.getIp() >> 32) & MASK32;
+ long ownLow = o1.getIp() & MASK32;
+ /* are the high values different, if so ignore the lower values */
+ if (ownHigh > otherHigh) {
+ return 1;
+ }
+ if (ownHigh < otherHigh ) {
+ return -1;
+ }
+ /* the high values are the same, compare the lower values */
+ if (ownLow > otherLow) {
+ return 1;
+ }
+ if (ownLow < otherLow) {
+ return -1;
+ }
+ /* the values are identical */
+ return 0;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+
+/**
+ * Representation of one type of event. A bit like "int" or "long" but for trace
+ * events.
+ */
+public class EventDeclaration implements IEventDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * Name of the event
+ */
+ private String fName;
+
+ /**
+ * Event context structure declaration
+ */
+ private StructDeclaration fContext = null;
+
+ /**
+ * Event fields structure declaration
+ */
+ private StructDeclaration fFields = null;
+
+ /**
+ * Stream to which belongs this event.
+ */
+ private CTFStream fStream = null;
+
+ /**
+ * Loglevel of an event
+ */
+ private long fLogLevel;
+
+ /** Map of this event type's custom CTF attributes */
+ private final Map<String, String> fCustomAttributes = new HashMap<>();
+
+ private int fId = (int) UNSET_EVENT_ID;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default constructor. Use the setters afterwards to set the fields
+ * accordingly.
+ */
+ public EventDeclaration() {
+ }
+
+ @Override
+ public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException {
+ StructDeclaration streamEventContextDecl = streamInputReader.getStreamEventContextDecl();
+ StructDefinition streamEventContext = streamEventContextDecl != null ? streamEventContextDecl.createDefinition(fStream.getTrace(), ILexicalScope.STREAM_EVENT_CONTEXT, input) : null;
+ ICompositeDefinition packetContext = streamInputReader.getPacketReader().getCurrentPacketEventHeader();
+ StructDefinition eventContext = fContext != null ? fContext.createDefinition(fStream.getTrace(), ILexicalScope.CONTEXT, input) : null;
+ StructDefinition eventPayload = fFields != null ? fFields.createDefinition(fStream.getTrace(), ILexicalScope.FIELDS, input) : null;
+
+ // a bit lttng specific
+ // CTF doesn't require a timestamp,
+ // but it's passed to us
+ return new EventDefinition(
+ this,
+ streamInputReader,
+ timestamp,
+ streamEventContext,
+ eventContext,
+ packetContext,
+ eventPayload);
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Sets a name for an event Declaration
+ *
+ * @param name
+ * the name
+ */
+ public void setName(String name) {
+ fName = name;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ /**
+ * Sets the context for an event declaration (see CTF specification)
+ *
+ * @param context
+ * the context in structdeclaration format
+ */
+ public void setContext(StructDeclaration context) {
+ fContext = context;
+ }
+
+ /**
+ * Sets the fields of an event declaration
+ *
+ * @param fields
+ * the fields in structdeclaration format
+ */
+ public void setFields(StructDeclaration fields) {
+ fFields = fields;
+ }
+
+ @Override
+ public StructDeclaration getFields() {
+ return fFields;
+ }
+
+ @Override
+ public StructDeclaration getContext() {
+ return fContext;
+ }
+
+ /**
+ * Sets the id of an event declaration
+ *
+ * @param id
+ * the id
+ */
+ public void setId(long id) {
+ if (id < 0 || id > Integer.MAX_VALUE) {
+ throw new IllegalArgumentException("id out of range"); //$NON-NLS-1$
+ }
+ fId = (int) id;
+ }
+
+ @Override
+ public Long getId() {
+ return Long.valueOf(fId);
+ }
+
+ /**
+ * Faster get id assuming you have less than a billion event types
+ *
+ * @return the event id
+ */
+ public int id() {
+ return fId;
+ }
+
+ /**
+ * Sets the stream of an event declaration
+ *
+ * @param stream
+ * the stream
+ */
+ public void setStream(CTFStream stream) {
+ fStream = stream;
+ }
+
+ @Override
+ public CTFStream getStream() {
+ return fStream;
+ }
+
+ /**
+ * Is the name of the event declaration set
+ *
+ * @return is the name set?
+ */
+ public boolean nameIsSet() {
+ return fName != null;
+ }
+
+ /**
+ * Is the context set
+ *
+ * @return is the context set
+ */
+ public boolean contextIsSet() {
+ return fContext != null;
+ }
+
+ /**
+ * Is a field set?
+ *
+ * @return Is the field set?
+ */
+ public boolean fieldsIsSet() {
+ return fFields != null;
+ }
+
+ /**
+ * Is the id set?
+ *
+ * @return is the id set?
+ */
+ public boolean idIsSet() {
+ return (fId != UNSET_EVENT_ID);
+ }
+
+ /**
+ * Is the stream set?
+ *
+ * @return is the stream set?
+ */
+ public boolean streamIsSet() {
+ return fStream != null;
+ }
+
+ @Override
+ public long getLogLevel() {
+ return fLogLevel;
+ }
+
+ /**
+ * Sets the log level
+ *
+ * @param level
+ * the log level
+ */
+ public void setLogLevel(long level) {
+ fLogLevel = level;
+ }
+
+ @Override
+ public Set<String> getCustomAttributes() {
+ return fCustomAttributes.keySet();
+ }
+
+ @Override
+ public String getCustomAttribute(String key) {
+ return fCustomAttributes.get(key);
+ }
+
+ /**
+ * Sets a custom attribute value.
+ *
+ * @param key
+ * the key of the attribute
+ * @param value
+ * the value of the attribute
+ */
+ public void setCustomAttribute(String key, String value) {
+ fCustomAttributes.put(key, value);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof EventDeclaration)) {
+ return false;
+ }
+ EventDeclaration other = (EventDeclaration) obj;
+ if (fContext == null) {
+ if (other.fContext != null) {
+ return false;
+ }
+ } else if (!fContext.equals(other.fContext)) {
+ return false;
+ }
+ if (fFields == null) {
+ if (other.fFields != null) {
+ return false;
+ }
+ } else if (!fFields.equals(other.fFields)) {
+ return false;
+ }
+ if (fId != (other.fId)) {
+ return false;
+ }
+ if (fName == null) {
+ if (other.fName != null) {
+ return false;
+ }
+ } else if (!fName.equals(other.fName)) {
+ return false;
+ }
+ if (fStream == null) {
+ if (other.fStream != null) {
+ return false;
+ }
+ } else if (!fStream.equals(other.fStream)) {
+ return false;
+ }
+ if (!fCustomAttributes.equals(other.fCustomAttributes)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result)
+ + ((fContext == null) ? 0 : fContext.hashCode());
+ result = (prime * result) + ((fFields == null) ? 0 : fFields.hashCode());
+ result = (prime * result) + fId;
+ result = (prime * result) + ((fName == null) ? 0 : fName.hashCode());
+ result = (prime * result) + ((fStream == null) ? 0 : fStream.hashCode());
+ result = (prime * result) + fCustomAttributes.hashCode();
+ return result;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial Design and Grammar
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+
+/**
+ * <b><u>DeclarationScope</u></b>
+ * <p>
+ * A DeclarationScope keeps track of the various CTF declarations for a given
+ * scope.
+ *
+ * TODO: The notion of "symbols" and the notion of "scope" are misused in this
+ * parser, which leads to inefficient tree management. It should be cleaned up.
+ *
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ *
+ */
+class DeclarationScope {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private DeclarationScope fParentScope = null;
+
+ private final Map<String, StructDeclaration> fStructs = new HashMap<>();
+ private final Map<String, EnumDeclaration> fEnums = new HashMap<>();
+ private final Map<String, VariantDeclaration> fVariants = new HashMap<>();
+ private final Map<String, IDeclaration> fTypes = new HashMap<>();
+ private final Map<String, IDeclaration> fIdentifiers = new HashMap<>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a declaration scope with no parent.
+ */
+ public DeclarationScope() {
+ }
+
+ /**
+ * Creates a declaration scope with the specified parent.
+ *
+ * @param parentScope
+ * The parent of the newly created scope.
+ */
+ public DeclarationScope(DeclarationScope parentScope) {
+ fParentScope = parentScope;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the parent of the current scope.
+ *
+ * @return The parent scope.
+ */
+ public DeclarationScope getParentScope() {
+ return fParentScope;
+ }
+
+ // ------------------------------------------------------------------------
+ // Registration operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Registers a type declaration.
+ *
+ * @param name
+ * The name of the type.
+ * @param declaration
+ * The type declaration.
+ * @throws ParseException
+ * if a type with the same name has already been defined.
+ */
+ public void registerType(String name, IDeclaration declaration)
+ throws ParseException {
+ /* Check if the type has been defined in the current scope */
+ if (fTypes.containsKey(name)) {
+ throw new ParseException("Type has already been defined:" + name); //$NON-NLS-1$
+ }
+
+ /* Add it to the register. */
+ fTypes.put(name, declaration);
+ }
+
+ /**
+ * Registers an identifier declaration.
+ *
+ * @param name
+ * name of the identifier
+ * @param declaration
+ * the identfier's declaration
+ * @throws ParseException
+ * if an identifier with the same name has already been defined.
+ */
+ public void registerIdentifier(String name, IDeclaration declaration) throws ParseException {
+ /* Check if the type has been defined in the current scope */
+ if (fIdentifiers.containsKey(name)) {
+ throw new ParseException("Identifier has already been defined:" + name); //$NON-NLS-1$
+ }
+
+ /* Add it to the register. */
+ fIdentifiers.put(name, declaration);
+ }
+
+ /**
+ * Registers a struct declaration.
+ *
+ * @param name
+ * The name of the struct.
+ * @param declaration
+ * The declaration of the struct.
+ * @throws ParseException
+ * if a struct with the same name has already been registered.
+ */
+ public void registerStruct(String name, StructDeclaration declaration)
+ throws ParseException {
+ /* Check if the struct has been defined in the current scope. */
+ if (fStructs.containsKey(name)) {
+ throw new ParseException("Struct has already been defined:" + name); //$NON-NLS-1$
+ }
+
+ /* Add it to the register. */
+ fStructs.put(name, declaration);
+
+ /* It also defined a new type, so add it to the type declarations. */
+ String structPrefix = "struct "; //$NON-NLS-1$
+ registerType(structPrefix + name, declaration);
+ }
+
+ /**
+ * Registers an enum declaration.
+ *
+ * @param name
+ * The name of the enum.
+ * @param declaration
+ * The declaration of the enum.
+ * @throws ParseException
+ * if an enum with the same name has already been registered.
+ */
+ public void registerEnum(String name, EnumDeclaration declaration)
+ throws ParseException {
+ /* Check if the enum has been defined in the current scope. */
+ if (lookupEnum(name) != null) {
+ throw new ParseException("Enum has already been defined:" + name); //$NON-NLS-1$
+ }
+
+ /* Add it to the register. */
+ fEnums.put(name, declaration);
+
+ /* It also defined a new type, so add it to the type declarations. */
+ String enumPrefix = "enum "; //$NON-NLS-1$
+ registerType(enumPrefix + name, declaration);
+ }
+
+ /**
+ * Registers a variant declaration.
+ *
+ * @param name
+ * The name of the variant.
+ * @param declaration
+ * The declaration of the variant.
+ * @throws ParseException
+ * if a variant with the same name has already been registered.
+ */
+ public void registerVariant(String name, VariantDeclaration declaration)
+ throws ParseException {
+ /* Check if the variant has been defined in the current scope. */
+ if (lookupVariant(name) != null) {
+ throw new ParseException("Variant has already been defined:" + name); //$NON-NLS-1$
+ }
+
+ /* Add it to the register. */
+ fVariants.put(name, declaration);
+
+ /* It also defined a new type, so add it to the type declarations. */
+ String variantPrefix = "variant "; //$NON-NLS-1$
+ registerType(variantPrefix + name, declaration);
+ }
+
+ // ------------------------------------------------------------------------
+ // Lookup operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Looks up a type declaration in the current scope.
+ *
+ * @param name
+ * The name of the type to search for.
+ * @return The type declaration, or null if no type with that name has been
+ * defined.
+ */
+ public IDeclaration lookupType(String name) {
+ return fTypes.get(name);
+ }
+
+ /**
+ * Looks up a type declaration in the current scope and recursively in the
+ * parent scopes.
+ *
+ * @param name
+ * The name of the type to search for.
+ * @return The type declaration, or null if no type with that name has been
+ * defined.
+ */
+ public IDeclaration lookupTypeRecursive(String name) {
+ IDeclaration declaration = lookupType(name);
+ if (declaration != null) {
+ return declaration;
+ } else if (fParentScope != null) {
+ return fParentScope.lookupTypeRecursive(name);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Looks up a struct declaration.
+ *
+ * @param name
+ * The name of the struct to search for.
+ * @return The struct declaration, or null if no struct with that name has
+ * been defined.
+ */
+ public StructDeclaration lookupStruct(String name) {
+ return fStructs.get(name);
+ }
+
+ /**
+ * Looks up a struct declaration in the current scope and recursively in the
+ * parent scopes.
+ *
+ * @param name
+ * The name of the struct to search for.
+ * @return The struct declaration, or null if no struct with that name has
+ * been defined.
+ */
+ public StructDeclaration lookupStructRecursive(String name) {
+ StructDeclaration declaration = lookupStruct(name);
+ if (declaration != null) {
+ return declaration;
+ } else if (fParentScope != null) {
+ return fParentScope.lookupStructRecursive(name);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Looks up an enum declaration.
+ *
+ * @param name
+ * The name of the enum to search for.
+ * @return The enum declaration, or null if no enum with that name has been
+ * defined.
+ */
+ public EnumDeclaration lookupEnum(String name) {
+ return fEnums.get(name);
+ }
+
+ /**
+ * Looks up an enum declaration in the current scope and recursively in the
+ * parent scopes.
+ *
+ * @param name
+ * The name of the enum to search for.
+ * @return The enum declaration, or null if no enum with that name has been
+ * defined.
+ */
+ public EnumDeclaration lookupEnumRecursive(String name) {
+ EnumDeclaration declaration = lookupEnum(name);
+ if (declaration != null) {
+ return declaration;
+ } else if (fParentScope != null) {
+ return fParentScope.lookupEnumRecursive(name);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Looks up a variant declaration.
+ *
+ * @param name
+ * The name of the variant to search for.
+ * @return The variant declaration, or null if no variant with that name has
+ * been defined.
+ */
+ public VariantDeclaration lookupVariant(String name) {
+ return fVariants.get(name);
+ }
+
+ /**
+ * Looks up a variant declaration in the current scope and recursively in
+ * the parent scopes.
+ *
+ * @param name
+ * The name of the variant to search for.
+ * @return The variant declaration, or null if no variant with that name has
+ * been defined.
+ */
+ public VariantDeclaration lookupVariantRecursive(String name) {
+ VariantDeclaration declaration = lookupVariant(name);
+ if (declaration != null) {
+ return declaration;
+ } else if (fParentScope != null) {
+ return fParentScope.lookupVariantRecursive(name);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Lookup query for an identifier in this scope.
+ *
+ * @param identifier
+ * the name of the identifier to search for. In the case of int
+ * x; it would be "x"
+ * @return the declaration of the type associated to that identifier
+ */
+ public IDeclaration lookupIdentifier(String identifier) {
+ return fIdentifiers.get(identifier);
+ }
+
+ /**
+ * Lookup query for an identifier through this scope and its ancestors.
+ * An ancestor scope is a scope in which this scope is nested.
+ *
+ * @param identifier
+ * the name of the identifier to search for. In the case of int
+ * x; it would be "x"
+ * @return the declaration of the type associated to that identifier
+ */
+ public IDeclaration lookupIdentifierRecursive(String identifier) {
+ IDeclaration declaration = lookupIdentifier(identifier);
+ if (declaration != null) {
+ return declaration;
+ } else if (fParentScope != null) {
+ return fParentScope.lookupIdentifierRecursive(identifier);
+ }
+ return null;
+ }
+
+ /**
+ * Get all the type names of this scope.
+ *
+ * @return The type names
+ */
+ public Set<String> getTypeNames() {
+ return fTypes.keySet();
+ }
+
+ /**
+ * Replace a type with a new one.
+ *
+ * @param name
+ * The name of the type
+ * @param newType
+ * The type
+ * @throws ParseException
+ * If the type does not exist.
+ */
+ public void replaceType(String name, IDeclaration newType) throws ParseException {
+ if (fTypes.containsKey(name)) {
+ fTypes.put(name, newType);
+ } else {
+ throw new ParseException("Trace does not contain type:" + name); //$NON-NLS-1$
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Matthew Khouzam - Initial Design and Grammar
+ * Francis Giraldeau - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
+
+import java.math.BigInteger;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.antlr.runtime.tree.CommonTree;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.CTFClock;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.parser.CTFParser;
+import org.eclipse.tracecompass.internal.ctf.core.Activator;
+import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.StructDeclarationFlattener;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderCompactDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderLargeDeclaration;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * IOStructGen
+ */
+public class IOStructGen {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final @NonNull String MAP = "map"; //$NON-NLS-1$
+ private static final @NonNull String ENCODING = "encoding"; //$NON-NLS-1$
+ private static final @NonNull String BASE = "base"; //$NON-NLS-1$
+ private static final @NonNull String SIZE = "size"; //$NON-NLS-1$
+ private static final @NonNull String SIGNED = "signed"; //$NON-NLS-1$
+ private static final @NonNull String LINE = "line"; //$NON-NLS-1$
+ private static final @NonNull String FILE = "file"; //$NON-NLS-1$
+ private static final @NonNull String IP = "ip"; //$NON-NLS-1$
+ private static final @NonNull String FUNC = "func"; //$NON-NLS-1$
+ private static final @NonNull String NAME = "name"; //$NON-NLS-1$
+ private static final @NonNull String EMPTY_STRING = ""; //$NON-NLS-1$
+ private static final int INTEGER_BASE_16 = 16;
+ private static final int INTEGER_BASE_10 = 10;
+ private static final int INTEGER_BASE_8 = 8;
+ private static final int INTEGER_BASE_2 = 2;
+ private static final long DEFAULT_ALIGNMENT = 8;
+ private static final int DEFAULT_FLOAT_EXPONENT = 8;
+ private static final int DEFAULT_FLOAT_MANTISSA = 24;
+ private static final int DEFAULT_INT_BASE = 10;
+ /**
+ * The trace
+ */
+ private final CTFTrace fTrace;
+ private CommonTree fTree;
+
+ /**
+ * The current declaration scope.
+ */
+ private DeclarationScope fScope = null;
+
+ /**
+ * Data helpers needed for streaming
+ */
+
+ private boolean fHasBeenParsed = false;
+
+ // ------------------------------------------------------------------------
+ // Constructor
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param tree
+ * the tree (ANTLR generated) with the parsed TSDL data.
+ * @param trace
+ * the trace containing the places to put all the read metadata
+ */
+ public IOStructGen(CommonTree tree, CTFTrace trace) {
+ fTrace = trace;
+ fTree = tree;
+
+ }
+
+ /**
+ * Parse the tree and populate the trace defined in the constructor.
+ *
+ * @throws ParseException
+ * If there was a problem parsing the metadata
+ */
+ public void generate() throws ParseException {
+ parseRoot(fTree);
+ }
+
+ /**
+ * Parse a partial tree and populate the trace defined in the constructor.
+ * Does not check for a "trace" block as there is only one in the trace and
+ * thus
+ *
+ * @throws ParseException
+ * If there was a problem parsing the metadata
+ */
+ public void generateFragment() throws ParseException {
+ parseIncompleteRoot(fTree);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Sets a new tree to parse
+ *
+ * @param newTree
+ * the new tree to parse
+ */
+ public void setTree(CommonTree newTree) {
+ fTree = newTree;
+ }
+
+ /**
+ * Parse the root node.
+ *
+ * @param root
+ * A ROOT node.
+ * @throws ParseException
+ */
+ private void parseRoot(CommonTree root) throws ParseException {
+
+ List<CommonTree> children = root.getChildren();
+
+ CommonTree traceNode = null;
+ boolean hasStreams = false;
+ List<CommonTree> events = new ArrayList<>();
+
+ /* Create a new declaration scope with no parent. */
+ pushScope();
+
+ for (CommonTree child : children) {
+ final int type = child.getType();
+ switch (type) {
+ case CTFParser.DECLARATION:
+ parseRootDeclaration(child);
+ break;
+ case CTFParser.TRACE:
+ if (traceNode != null) {
+ throw new ParseException("Only one trace block is allowed"); //$NON-NLS-1$
+ }
+ traceNode = child;
+ parseTrace(traceNode);
+ break;
+ case CTFParser.STREAM:
+ parseStream(child);
+ hasStreams = true;
+ break;
+ case CTFParser.EVENT:
+ events.add(child);
+ break;
+ case CTFParser.CLOCK:
+ parseClock(child);
+ break;
+ case CTFParser.ENV:
+ parseEnvironment(child);
+ break;
+ case CTFParser.CALLSITE:
+ parseCallsite(child);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+ if (traceNode == null) {
+ throw new ParseException("Missing trace block"); //$NON-NLS-1$
+ }
+ parseEvents(events, hasStreams);
+ popScope();
+ fHasBeenParsed = true;
+ }
+
+ private void parseEvents(List<CommonTree> events, boolean hasStreams) throws ParseException {
+ if (!hasStreams && !events.isEmpty()) {
+ /* Add an empty stream that will have a null id */
+ fTrace.addStream(new CTFStream(fTrace));
+ }
+ for (CommonTree event : events) {
+ parseEvent(event);
+ }
+ }
+
+ private void parseIncompleteRoot(CommonTree root) throws ParseException {
+ if (!fHasBeenParsed) {
+ throw new ParseException("You need to run generate first"); //$NON-NLS-1$
+ }
+ List<CommonTree> children = root.getChildren();
+ List<CommonTree> events = new ArrayList<>();
+ /* Create a new declaration scope with no parent. */
+ pushScope();
+
+ for (CommonTree child : children) {
+ final int type = child.getType();
+ switch (type) {
+ case CTFParser.DECLARATION:
+ parseRootDeclaration(child);
+ break;
+ case CTFParser.TRACE:
+ throw new ParseException("Trace block defined here, please use generate and not generateFragment to parse this fragment"); //$NON-NLS-1$
+ case CTFParser.STREAM:
+ parseStream(child);
+ break;
+ case CTFParser.EVENT:
+ events.add(child);
+ break;
+ case CTFParser.CLOCK:
+ parseClock(child);
+ break;
+ case CTFParser.ENV:
+ parseEnvironment(child);
+ break;
+ case CTFParser.CALLSITE:
+ parseCallsite(child);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+ parseEvents(events, !Iterables.isEmpty(fTrace.getStreams()));
+ popScope();
+ }
+
+ private void parseCallsite(CommonTree callsite) {
+
+ List<CommonTree> children = callsite.getChildren();
+ String name = null;
+ String funcName = null;
+ long lineNumber = -1;
+ long ip = -1;
+ String fileName = null;
+
+ for (CommonTree child : children) {
+ String left;
+ /* this is a regex to find the leading and trailing quotes */
+ final String regex = "^\"|\"$"; //$NON-NLS-1$
+ /*
+ * this is to replace the previous quotes with nothing...
+ * effectively deleting them
+ */
+ final String nullString = EMPTY_STRING;
+ left = child.getChild(0).getChild(0).getChild(0).getText();
+ if (left.equals(NAME)) {
+ name = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
+ } else if (left.equals(FUNC)) {
+ funcName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
+ } else if (left.equals(IP)) {
+ ip = Long.decode(child.getChild(1).getChild(0).getChild(0).getText());
+ } else if (left.equals(FILE)) {
+ fileName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
+ } else if (left.equals(LINE)) {
+ lineNumber = Long.parseLong(child.getChild(1).getChild(0).getChild(0).getText());
+ }
+ }
+ fTrace.addCallsite(name, funcName, ip, fileName, lineNumber);
+ }
+
+ private void parseEnvironment(CommonTree environment) {
+ List<CommonTree> children = environment.getChildren();
+ for (CommonTree child : children) {
+ String left;
+ String right;
+ left = child.getChild(0).getChild(0).getChild(0).getText();
+ right = child.getChild(1).getChild(0).getChild(0).getText();
+ fTrace.addEnvironmentVar(left, right);
+ }
+ }
+
+ private void parseClock(CommonTree clock) throws ParseException {
+ List<CommonTree> children = clock.getChildren();
+ CTFClock ctfClock = new CTFClock();
+ for (CommonTree child : children) {
+ final String key = child.getChild(0).getChild(0).getChild(0).getText();
+ final CommonTree value = (CommonTree) child.getChild(1).getChild(0).getChild(0);
+ final int type = value.getType();
+ final String text = value.getText();
+ switch (type) {
+ case CTFParser.INTEGER:
+ case CTFParser.DECIMAL_LITERAL:
+ /*
+ * Not a pretty hack, this is to make sure that there is no
+ * number overflow due to 63 bit integers. The offset should
+ * only really be an issue in the year 2262. the tracer in C/ASM
+ * can write an offset in an unsigned 64 bit long. In java, the
+ * last bit, being set to 1 will be read as a negative number,
+ * but since it is too big a positive it will throw an
+ * exception. this will happen in 2^63 ns from 1970. Therefore
+ * 293 years from 1970
+ */
+ Long numValue;
+ try {
+ numValue = Long.parseLong(text);
+ } catch (NumberFormatException e) {
+ throw new ParseException("Number conversion issue with " + text, e); //$NON-NLS-1$
+ }
+ ctfClock.addAttribute(key, numValue);
+ break;
+ default:
+ ctfClock.addAttribute(key, text);
+ }
+
+ }
+ String nameValue = ctfClock.getName();
+ fTrace.addClock(nameValue, ctfClock);
+ }
+
+ private void parseTrace(CommonTree traceNode) throws ParseException {
+
+ List<CommonTree> children = traceNode.getChildren();
+ if (children == null) {
+ throw new ParseException("Trace block is empty"); //$NON-NLS-1$
+ }
+
+ pushScope();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPEALIAS:
+ parseTypealias(child);
+ break;
+ case CTFParser.TYPEDEF:
+ parseTypedef(child);
+ break;
+ case CTFParser.CTF_EXPRESSION_TYPE:
+ case CTFParser.CTF_EXPRESSION_VAL:
+ parseTraceDeclaration(child);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ /*
+ * If trace byte order was not specified and not using packet based
+ * metadata
+ */
+ if (fTrace.getByteOrder() == null) {
+ throw new ParseException("Trace byte order not set"); //$NON-NLS-1$
+ }
+
+ popScope();
+ }
+
+ private void parseTraceDeclaration(CommonTree traceDecl)
+ throws ParseException {
+
+ /* There should be a left and right */
+
+ CommonTree leftNode = (CommonTree) traceDecl.getChild(0);
+ CommonTree rightNode = (CommonTree) traceDecl.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
+ }
+
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(MetadataStrings.MAJOR)) {
+ if (fTrace.majorIsSet()) {
+ throw new ParseException("major is already set"); //$NON-NLS-1$
+ }
+
+ fTrace.setMajor(getMajorOrMinor(rightNode));
+ } else if (left.equals(MetadataStrings.MINOR)) {
+ if (fTrace.minorIsSet()) {
+ throw new ParseException("minor is already set"); //$NON-NLS-1$
+ }
+
+ fTrace.setMinor(getMajorOrMinor(rightNode));
+ } else if (left.equals(MetadataStrings.UUID_STRING)) {
+ UUID uuid = getUUID(rightNode);
+
+ /*
+ * If uuid was already set by a metadata packet, compare it to see
+ * if it matches
+ */
+ if (fTrace.uuidIsSet()) {
+ if (fTrace.getUUID().compareTo(uuid) != 0) {
+ throw new ParseException("UUID mismatch. Packet says " //$NON-NLS-1$
+ + fTrace.getUUID() + " but metadata says " + uuid); //$NON-NLS-1$
+ }
+ } else {
+ fTrace.setUUID(uuid);
+ }
+
+ } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
+ ByteOrder byteOrder = getByteOrder(rightNode);
+
+ /*
+ * If byte order was already set by a metadata packet, compare it to
+ * see if it matches
+ */
+ if (fTrace.getByteOrder() != null) {
+ if (fTrace.getByteOrder() != byteOrder) {
+ throw new ParseException(
+ "Endianness mismatch. Magic number says " //$NON-NLS-1$
+ + fTrace.getByteOrder()
+ + " but metadata says " + byteOrder); //$NON-NLS-1$
+ }
+ } else {
+ fTrace.setByteOrder(byteOrder);
+ final DeclarationScope parentScope = fScope.getParentScope();
+
+ for (String type : parentScope.getTypeNames()) {
+ IDeclaration d = parentScope.lookupType(type);
+ if (d instanceof IntegerDeclaration) {
+ addByteOrder(byteOrder, parentScope, type, (IntegerDeclaration) d);
+ } else if (d instanceof StructDeclaration) {
+ setAlign(parentScope, (StructDeclaration) d, byteOrder);
+ }
+ }
+ }
+ } else if (left.equals(MetadataStrings.PACKET_HEADER)) {
+ if (fTrace.packetHeaderIsSet()) {
+ throw new ParseException("packet.header already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("packet.header expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration packetHeaderDecl = parseTypeSpecifierList(
+ typeSpecifier, null);
+
+ if (!(packetHeaderDecl instanceof StructDeclaration)) {
+ throw new ParseException("packet.header expects a struct"); //$NON-NLS-1$
+ }
+
+ fTrace.setPacketHeader((StructDeclaration) packetHeaderDecl);
+ } else {
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownTraceAttributeWarning + " " + left); //$NON-NLS-1$
+ }
+ }
+
+ private static void addByteOrder(ByteOrder byteOrder,
+ final DeclarationScope parentScope, String name,
+ IntegerDeclaration decl) throws ParseException {
+
+ if (decl.getByteOrder() != byteOrder) {
+ IntegerDeclaration newI;
+ newI = IntegerDeclaration.createDeclaration(decl.getLength(), decl.isSigned(),
+ decl.getBase(), byteOrder, decl.getEncoding(),
+ decl.getClock(), decl.getAlignment());
+ parentScope.replaceType(name, newI);
+ }
+ }
+
+ private void setAlign(DeclarationScope parentScope, StructDeclaration sd,
+ ByteOrder byteOrder) throws ParseException {
+
+ for (String s : sd.getFieldsList()) {
+ IDeclaration d = sd.getField(s);
+
+ if (d instanceof StructDeclaration) {
+ setAlign(parentScope, (StructDeclaration) d, byteOrder);
+
+ } else if (d instanceof VariantDeclaration) {
+ setAlign(parentScope, (VariantDeclaration) d, byteOrder);
+ } else if (d instanceof IntegerDeclaration) {
+ IntegerDeclaration decl = (IntegerDeclaration) d;
+ if (decl.getByteOrder() != byteOrder) {
+ IntegerDeclaration newI;
+ newI = IntegerDeclaration.createDeclaration(decl.getLength(),
+ decl.isSigned(), decl.getBase(), byteOrder,
+ decl.getEncoding(), decl.getClock(),
+ decl.getAlignment());
+ sd.getFields().put(s, newI);
+ }
+ }
+ }
+ }
+
+ private void setAlign(DeclarationScope parentScope, VariantDeclaration vd,
+ ByteOrder byteOrder) throws ParseException {
+
+ for (String s : vd.getFields().keySet()) {
+ IDeclaration d = vd.getFields().get(s);
+
+ if (d instanceof StructDeclaration) {
+ setAlign(parentScope, (StructDeclaration) d, byteOrder);
+
+ } else if (d instanceof IntegerDeclaration) {
+ IntegerDeclaration decl = (IntegerDeclaration) d;
+ IntegerDeclaration newI;
+ newI = IntegerDeclaration.createDeclaration(decl.getLength(),
+ decl.isSigned(), decl.getBase(), byteOrder,
+ decl.getEncoding(), decl.getClock(),
+ decl.getAlignment());
+ vd.getFields().put(s, newI);
+ }
+ }
+ }
+
+ private void parseStream(CommonTree streamNode) throws ParseException {
+
+ CTFStream stream = new CTFStream(fTrace);
+
+ List<CommonTree> children = streamNode.getChildren();
+ if (children == null) {
+ throw new ParseException("Empty stream block"); //$NON-NLS-1$
+ }
+
+ pushScope();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPEALIAS:
+ parseTypealias(child);
+ break;
+ case CTFParser.TYPEDEF:
+ parseTypedef(child);
+ break;
+ case CTFParser.CTF_EXPRESSION_TYPE:
+ case CTFParser.CTF_EXPRESSION_VAL:
+ parseStreamDeclaration(child, stream);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ if (stream.isIdSet() &&
+ (!fTrace.packetHeaderIsSet() || !fTrace.getPacketHeader().hasField(MetadataStrings.STREAM_ID))) {
+ throw new ParseException("Stream has an ID, but there is no stream_id field in packet header."); //$NON-NLS-1$
+ }
+
+ fTrace.addStream(stream);
+
+ popScope();
+ }
+
+ private void parseStreamDeclaration(CommonTree streamDecl, CTFStream stream)
+ throws ParseException {
+
+ /* There should be a left and right */
+
+ CommonTree leftNode = (CommonTree) streamDecl.getChild(0);
+ CommonTree rightNode = (CommonTree) streamDecl.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
+ }
+
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(MetadataStrings.ID)) {
+ if (stream.isIdSet()) {
+ throw new ParseException("stream id already defined"); //$NON-NLS-1$
+ }
+
+ long streamID = getStreamID(rightNode);
+
+ stream.setId(streamID);
+ } else if (left.equals(MetadataStrings.EVENT_HEADER)) {
+ if (stream.isEventHeaderSet()) {
+ throw new ParseException("event.header already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("event.header expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration eventHeaderDecl = parseTypeSpecifierList(
+ typeSpecifier, null);
+
+ if (eventHeaderDecl instanceof StructDeclaration) {
+ stream.setEventHeader((StructDeclaration) eventHeaderDecl);
+ } else if (eventHeaderDecl instanceof IEventHeaderDeclaration) {
+ stream.setEventHeader((IEventHeaderDeclaration) eventHeaderDecl);
+ } else {
+ throw new ParseException("event.header expects a struct"); //$NON-NLS-1$
+ }
+
+ } else if (left.equals(MetadataStrings.EVENT_CONTEXT)) {
+ if (stream.isEventContextSet()) {
+ throw new ParseException("event.context already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("event.context expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration eventContextDecl = parseTypeSpecifierList(
+ typeSpecifier, null);
+
+ if (!(eventContextDecl instanceof StructDeclaration)) {
+ throw new ParseException("event.context expects a struct"); //$NON-NLS-1$
+ }
+
+ stream.setEventContext((StructDeclaration) eventContextDecl);
+ } else if (left.equals(MetadataStrings.PACKET_CONTEXT)) {
+ if (stream.isPacketContextSet()) {
+ throw new ParseException("packet.context already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("packet.context expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration packetContextDecl = parseTypeSpecifierList(
+ typeSpecifier, null);
+
+ if (!(packetContextDecl instanceof StructDeclaration)) {
+ throw new ParseException("packet.context expects a struct"); //$NON-NLS-1$
+ }
+
+ stream.setPacketContext((StructDeclaration) packetContextDecl);
+ } else {
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownStreamAttributeWarning + " " + left); //$NON-NLS-1$
+ }
+ }
+
+ private void parseEvent(CommonTree eventNode) throws ParseException {
+
+ List<CommonTree> children = eventNode.getChildren();
+ if (children == null) {
+ throw new ParseException("Empty event block"); //$NON-NLS-1$
+ }
+
+ EventDeclaration event = new EventDeclaration();
+
+ pushScope();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPEALIAS:
+ parseTypealias(child);
+ break;
+ case CTFParser.TYPEDEF:
+ parseTypedef(child);
+ break;
+ case CTFParser.CTF_EXPRESSION_TYPE:
+ case CTFParser.CTF_EXPRESSION_VAL:
+ parseEventDeclaration(child, event);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ if (!event.nameIsSet()) {
+ throw new ParseException("Event name not set"); //$NON-NLS-1$
+ }
+
+ /*
+ * If the event did not specify a stream, then the trace must be single
+ * stream
+ */
+ if (!event.streamIsSet()) {
+ if (fTrace.nbStreams() > 1) {
+ throw new ParseException("Event without stream_id with more than one stream"); //$NON-NLS-1$
+ }
+
+ /*
+ * If the event did not specify a stream, the only existing stream
+ * must not have an id. Note: That behavior could be changed, it
+ * could be possible to just get the only existing stream, whatever
+ * is its id.
+ */
+ CTFStream stream = fTrace.getStream(null);
+
+ if (stream != null) {
+ event.setStream(stream);
+ } else {
+ throw new ParseException("Event without stream_id, but there is no stream without id"); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Add the event to the stream.
+ */
+ event.getStream().addEvent(event);
+
+ popScope();
+ }
+
+ private void parseEventDeclaration(CommonTree eventDecl,
+ EventDeclaration event) throws ParseException {
+
+ /* There should be a left and right */
+
+ CommonTree leftNode = (CommonTree) eventDecl.getChild(0);
+ CommonTree rightNode = (CommonTree) eventDecl.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
+ }
+
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(MetadataStrings.NAME2)) {
+ if (event.nameIsSet()) {
+ throw new ParseException("name already defined"); //$NON-NLS-1$
+ }
+
+ String name = getEventName(rightNode);
+
+ event.setName(name);
+ } else if (left.equals(MetadataStrings.ID)) {
+ if (event.idIsSet()) {
+ throw new ParseException("id already defined"); //$NON-NLS-1$
+ }
+
+ long id = getEventID(rightNode);
+ if (id > Integer.MAX_VALUE) {
+ throw new ParseException("id is greater than int.maxvalue, unsupported. id : " + id); //$NON-NLS-1$
+ }
+ if (id < 0) {
+ throw new ParseException("negative id, unsupported. id : " + id); //$NON-NLS-1$
+ }
+ event.setId((int) id);
+ } else if (left.equals(MetadataStrings.STREAM_ID)) {
+ if (event.streamIsSet()) {
+ throw new ParseException("stream id already defined"); //$NON-NLS-1$
+ }
+
+ long streamId = getStreamID(rightNode);
+
+ CTFStream stream = fTrace.getStream(streamId);
+
+ if (stream == null) {
+ throw new ParseException("Stream " + streamId + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ event.setStream(stream);
+ } else if (left.equals(MetadataStrings.CONTEXT)) {
+ if (event.contextIsSet()) {
+ throw new ParseException("context already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("context expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration contextDecl = parseTypeSpecifierList(typeSpecifier,
+ null);
+
+ if (!(contextDecl instanceof StructDeclaration)) {
+ throw new ParseException("context expects a struct"); //$NON-NLS-1$
+ }
+
+ event.setContext((StructDeclaration) contextDecl);
+ } else if (left.equals(MetadataStrings.FIELDS_STRING)) {
+ if (event.fieldsIsSet()) {
+ throw new ParseException("fields already defined"); //$NON-NLS-1$
+ }
+
+ CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
+
+ if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
+ throw new ParseException("fields expects a type specifier"); //$NON-NLS-1$
+ }
+
+ IDeclaration fieldsDecl;
+ fieldsDecl = parseTypeSpecifierList(typeSpecifier, null);
+
+ if (!(fieldsDecl instanceof StructDeclaration)) {
+ throw new ParseException("fields expects a struct"); //$NON-NLS-1$
+ }
+ /*
+ * The underscores in the event names. These underscores were added
+ * by the LTTng tracer.
+ */
+ final StructDeclaration fields = (StructDeclaration) fieldsDecl;
+ event.setFields(fields);
+ } else if (left.equals(MetadataStrings.LOGLEVEL2)) {
+ long logLevel = parseUnaryInteger((CommonTree) rightNode.getChild(0));
+ event.setLogLevel(logLevel);
+ } else {
+ /* Custom event attribute, we'll add it to the attributes map */
+ String right = parseUnaryString((CommonTree) rightNode.getChild(0));
+ event.setCustomAttribute(left, right);
+ }
+ }
+
+ /**
+ * Parses a declaration at the root level.
+ *
+ * @param declaration
+ * The declaration subtree.
+ * @throws ParseException
+ */
+ private void parseRootDeclaration(CommonTree declaration)
+ throws ParseException {
+
+ List<CommonTree> children = declaration.getChildren();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPEDEF:
+ parseTypedef(child);
+ break;
+ case CTFParser.TYPEALIAS:
+ parseTypealias(child);
+ break;
+ case CTFParser.TYPE_SPECIFIER_LIST:
+ parseTypeSpecifierList(child, null);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+ }
+
+ /**
+ * Parses a typealias node. It parses the target, the alias, and registers
+ * the type in the current scope.
+ *
+ * @param typealias
+ * A TYPEALIAS node.
+ * @throws ParseException
+ */
+ private void parseTypealias(CommonTree typealias) throws ParseException {
+
+ List<CommonTree> children = typealias.getChildren();
+
+ CommonTree target = null;
+ CommonTree alias = null;
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPEALIAS_TARGET:
+ target = child;
+ break;
+ case CTFParser.TYPEALIAS_ALIAS:
+ alias = child;
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ IDeclaration targetDeclaration = parseTypealiasTarget(target);
+
+ if ((targetDeclaration instanceof VariantDeclaration)
+ && ((VariantDeclaration) targetDeclaration).isTagged()) {
+ throw new ParseException("Typealias of untagged variant is not permitted"); //$NON-NLS-1$
+ }
+
+ String aliasString = parseTypealiasAlias(alias);
+
+ getCurrentScope().registerType(aliasString, targetDeclaration);
+ }
+
+ /**
+ * Parses the target part of a typealias and gets the corresponding
+ * declaration.
+ *
+ * @param target
+ * A TYPEALIAS_TARGET node.
+ * @return The corresponding declaration.
+ * @throws ParseException
+ */
+ private IDeclaration parseTypealiasTarget(CommonTree target)
+ throws ParseException {
+
+ List<CommonTree> children = target.getChildren();
+
+ CommonTree typeSpecifierList = null;
+ CommonTree typeDeclaratorList = null;
+ CommonTree typeDeclarator = null;
+ StringBuilder identifierSB = new StringBuilder();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPE_SPECIFIER_LIST:
+ typeSpecifierList = child;
+ break;
+ case CTFParser.TYPE_DECLARATOR_LIST:
+ typeDeclaratorList = child;
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ if (typeDeclaratorList != null) {
+ /*
+ * Only allow one declarator
+ *
+ * eg: "typealias uint8_t *, ** := puint8_t;" is not permitted,
+ * otherwise the new type puint8_t would maps to two different
+ * types.
+ */
+ if (typeDeclaratorList.getChildCount() != 1) {
+ throw new ParseException("Only one type declarator is allowed in the typealias target"); //$NON-NLS-1$
+ }
+
+ typeDeclarator = (CommonTree) typeDeclaratorList.getChild(0);
+ }
+
+ /* Parse the target type and get the declaration */
+ IDeclaration targetDeclaration = parseTypeDeclarator(typeDeclarator,
+ typeSpecifierList, identifierSB);
+
+ /*
+ * We don't allow identifier in the target
+ *
+ * eg: "typealias uint8_t* hello := puint8_t;", the "hello" is not
+ * permitted
+ */
+ if (identifierSB.length() > 0) {
+ throw new ParseException("Identifier (" + identifierSB.toString() //$NON-NLS-1$
+ + ") not expected in the typealias target"); //$NON-NLS-1$
+ }
+
+ return targetDeclaration;
+ }
+
+ /**
+ * Parses the alias part of a typealias. It parses the underlying specifier
+ * list and declarator and creates the string representation that will be
+ * used to register the type.
+ *
+ * @param alias
+ * A TYPEALIAS_ALIAS node.
+ * @return The string representation of the alias.
+ * @throws ParseException
+ */
+ private static String parseTypealiasAlias(CommonTree alias)
+ throws ParseException {
+
+ List<CommonTree> children = alias.getChildren();
+
+ CommonTree typeSpecifierList = null;
+ CommonTree typeDeclaratorList = null;
+ CommonTree typeDeclarator = null;
+ List<CommonTree> pointers = new LinkedList<>();
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.TYPE_SPECIFIER_LIST:
+ typeSpecifierList = child;
+ break;
+ case CTFParser.TYPE_DECLARATOR_LIST:
+ typeDeclaratorList = child;
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ /* If there is a type declarator list, extract the pointers */
+ if (typeDeclaratorList != null) {
+ /*
+ * Only allow one declarator
+ *
+ * eg: "typealias uint8_t := puint8_t *, **;" is not permitted.
+ */
+ if (typeDeclaratorList.getChildCount() != 1) {
+ throw new ParseException("Only one type declarator is allowed in the typealias alias"); //$NON-NLS-1$
+ }
+
+ typeDeclarator = (CommonTree) typeDeclaratorList.getChild(0);
+
+ List<CommonTree> typeDeclaratorChildren = typeDeclarator.getChildren();
+
+ for (CommonTree child : typeDeclaratorChildren) {
+ switch (child.getType()) {
+ case CTFParser.POINTER:
+ pointers.add(child);
+ break;
+ case CTFParser.IDENTIFIER:
+ throw new ParseException("Identifier (" + child.getText() //$NON-NLS-1$
+ + ") not expected in the typealias target"); //$NON-NLS-1$
+ default:
+ throw childTypeError(child);
+ }
+ }
+ }
+
+ return createTypeDeclarationString(typeSpecifierList, pointers);
+ }
+
+ /**
+ * Parses a typedef node. This creates and registers a new declaration for
+ * each declarator found in the typedef.
+ *
+ * @param typedef
+ * A TYPEDEF node.
+ * @throws ParseException
+ * If there is an error creating the declaration.
+ */
+ private void parseTypedef(CommonTree typedef) throws ParseException {
+
+ CommonTree typeDeclaratorListNode = (CommonTree) typedef.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
+
+ CommonTree typeSpecifierListNode = (CommonTree) typedef.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
+
+ List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
+
+ for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
+ StringBuilder identifierSB = new StringBuilder();
+
+ IDeclaration typeDeclaration = parseTypeDeclarator(
+ typeDeclaratorNode, typeSpecifierListNode, identifierSB);
+
+ if ((typeDeclaration instanceof VariantDeclaration)
+ && ((VariantDeclaration) typeDeclaration).isTagged()) {
+ throw new ParseException("Typealias of untagged variant is not permitted"); //$NON-NLS-1$
+ }
+
+ getCurrentScope().registerType(identifierSB.toString(),
+ typeDeclaration);
+ }
+ }
+
+ /**
+ * Parses a pair type declarator / type specifier list and returns the
+ * corresponding declaration. If it is present, it also writes the
+ * identifier of the declarator in the given {@link StringBuilder}.
+ *
+ * @param typeDeclarator
+ * A TYPE_DECLARATOR node.
+ * @param typeSpecifierList
+ * A TYPE_SPECIFIER_LIST node.
+ * @param identifierSB
+ * A StringBuilder that will receive the identifier found in the
+ * declarator.
+ * @return The corresponding declaration.
+ * @throws ParseException
+ * If there is an error finding or creating the declaration.
+ */
+ private IDeclaration parseTypeDeclarator(CommonTree typeDeclarator,
+ CommonTree typeSpecifierList, StringBuilder identifierSB)
+ throws ParseException {
+
+ IDeclaration declaration = null;
+ List<CommonTree> children = null;
+ List<CommonTree> pointers = new LinkedList<>();
+ List<CommonTree> lengths = new LinkedList<>();
+ CommonTree identifier = null;
+
+ /* Separate the tokens by type */
+ if (typeDeclarator != null) {
+ children = typeDeclarator.getChildren();
+ for (CommonTree child : children) {
+
+ switch (child.getType()) {
+ case CTFParser.POINTER:
+ pointers.add(child);
+ break;
+ case CTFParser.IDENTIFIER:
+ identifier = child;
+ break;
+ case CTFParser.LENGTH:
+ lengths.add(child);
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ }
+
+ /*
+ * Parse the type specifier list, which is the "base" type. For example,
+ * it would be int in int a[3][len].
+ */
+ declaration = parseTypeSpecifierList(typeSpecifierList, pointers);
+
+ /*
+ * Each length subscript means that we must create a nested array or
+ * sequence. For example, int a[3][len] means that we have an array of 3
+ * (sequences of length 'len' of (int)).
+ */
+ if (!lengths.isEmpty()) {
+ /* We begin at the end */
+ Collections.reverse(lengths);
+
+ for (CommonTree length : lengths) {
+ /*
+ * By looking at the first expression, we can determine whether
+ * it is an array or a sequence.
+ */
+ List<CommonTree> lengthChildren = length.getChildren();
+
+ CommonTree first = lengthChildren.get(0);
+ if (isUnaryInteger(first)) {
+ /* Array */
+ int arrayLength = (int) parseUnaryInteger(first);
+
+ if (arrayLength < 1) {
+ throw new ParseException("Array length is negative"); //$NON-NLS-1$
+ }
+
+ /* Create the array declaration. */
+ declaration = new ArrayDeclaration(arrayLength, declaration);
+ } else if (isAnyUnaryString(first)) {
+ /* Sequence */
+ String lengthName = concatenateUnaryStrings(lengthChildren);
+
+ /* check that lengthName was declared */
+ if (isSignedIntegerField(lengthName)) {
+ throw new ParseException("Sequence declared with length that is not an unsigned integer"); //$NON-NLS-1$
+ }
+ /* Create the sequence declaration. */
+ declaration = new SequenceDeclaration(lengthName,
+ declaration);
+ } else {
+ throw childTypeError(first);
+ }
+ }
+ }
+
+ if (identifier != null) {
+ identifierSB.append(identifier.getText());
+ }
+
+ return declaration;
+ }
+
+ private boolean isSignedIntegerField(String lengthName) throws ParseException {
+ IDeclaration decl = getCurrentScope().lookupIdentifierRecursive(lengthName);
+ if (decl instanceof IntegerDeclaration) {
+ return ((IntegerDeclaration) decl).isSigned();
+ }
+ throw new ParseException("Is not an integer: " + lengthName); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Parses a type specifier list and returns the corresponding declaration.
+ *
+ * @param typeSpecifierList
+ * A TYPE_SPECIFIER_LIST node.
+ * @param pointerList
+ * A list of POINTER nodes that apply to the specified type.
+ * @return The corresponding declaration.
+ * @throws ParseException
+ * If the type has not been defined or if there is an error
+ * creating the declaration.
+ */
+ private IDeclaration parseTypeSpecifierList(CommonTree typeSpecifierList,
+ List<CommonTree> pointerList) throws ParseException {
+ IDeclaration declaration = null;
+
+ /*
+ * By looking at the first element of the type specifier list, we can
+ * determine which type it belongs to.
+ */
+ CommonTree firstChild = (CommonTree) typeSpecifierList.getChild(0);
+
+ switch (firstChild.getType()) {
+ case CTFParser.FLOATING_POINT:
+ declaration = parseFloat(firstChild);
+ break;
+ case CTFParser.INTEGER:
+ declaration = parseInteger(firstChild);
+ break;
+ case CTFParser.STRING:
+ declaration = parseString(firstChild);
+ break;
+ case CTFParser.STRUCT:
+ declaration = parseStruct(firstChild);
+ StructDeclaration structDeclaration = (StructDeclaration) declaration;
+ IDeclaration idEnumDecl = structDeclaration.getFields().get("id"); //$NON-NLS-1$
+ if (idEnumDecl instanceof EnumDeclaration) {
+ EnumDeclaration enumDeclaration = (EnumDeclaration) idEnumDecl;
+ ByteOrder bo = enumDeclaration.getContainerType().getByteOrder();
+ if (EventHeaderCompactDeclaration.getEventHeader(bo).isCompactEventHeader(structDeclaration)) {
+ declaration = EventHeaderCompactDeclaration.getEventHeader(bo);
+ } else if (EventHeaderLargeDeclaration.getEventHeader(bo).isLargeEventHeader(structDeclaration)) {
+ declaration = EventHeaderLargeDeclaration.getEventHeader(bo);
+ }
+ }
+ break;
+ case CTFParser.VARIANT:
+ declaration = parseVariant(firstChild);
+ break;
+ case CTFParser.ENUM:
+ declaration = parseEnum(firstChild);
+ break;
+ case CTFParser.IDENTIFIER:
+ case CTFParser.FLOATTOK:
+ case CTFParser.INTTOK:
+ case CTFParser.LONGTOK:
+ case CTFParser.SHORTTOK:
+ case CTFParser.SIGNEDTOK:
+ case CTFParser.UNSIGNEDTOK:
+ case CTFParser.CHARTOK:
+ case CTFParser.DOUBLETOK:
+ case CTFParser.VOIDTOK:
+ case CTFParser.BOOLTOK:
+ case CTFParser.COMPLEXTOK:
+ case CTFParser.IMAGINARYTOK:
+ declaration = parseTypeDeclaration(typeSpecifierList, pointerList);
+ break;
+ default:
+ throw childTypeError(firstChild);
+ }
+
+ return declaration;
+ }
+
+ private IDeclaration parseFloat(CommonTree floatingPoint)
+ throws ParseException {
+
+ List<CommonTree> children = floatingPoint.getChildren();
+
+ /*
+ * If the integer has no attributes, then it is missing the size
+ * attribute which is required
+ */
+ if (children == null) {
+ throw new ParseException("float: missing size attribute"); //$NON-NLS-1$
+ }
+
+ /* The return value */
+ FloatDeclaration floatDeclaration = null;
+ ByteOrder byteOrder = fTrace.getByteOrder();
+ long alignment = 0;
+
+ int exponent = DEFAULT_FLOAT_EXPONENT;
+ int mantissa = DEFAULT_FLOAT_MANTISSA;
+
+ /* Iterate on all integer children */
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.CTF_EXPRESSION_VAL:
+ /*
+ * An assignment expression must have 2 children, left and right
+ */
+
+ CommonTree leftNode = (CommonTree) child.getChild(0);
+ CommonTree rightNode = (CommonTree) child.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
+ }
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(MetadataStrings.EXP_DIG)) {
+ exponent = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
+ } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
+ byteOrder = getByteOrder(rightNode);
+ } else if (left.equals(MetadataStrings.MANT_DIG)) {
+ mantissa = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
+ } else if (left.equals(MetadataStrings.ALIGN)) {
+ alignment = getAlignment(rightNode);
+ } else {
+ throw new ParseException("Float: unknown attribute " + left); //$NON-NLS-1$
+ }
+
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+ int size = mantissa + exponent;
+ if (size == 0) {
+ throw new ParseException("Float missing size attribute"); //$NON-NLS-1$
+ }
+
+ if (alignment == 0) {
+ alignment = ((size % DEFAULT_ALIGNMENT) == 0) ? 1 : DEFAULT_ALIGNMENT;
+ }
+
+ floatDeclaration = new FloatDeclaration(exponent, mantissa, byteOrder, alignment);
+
+ return floatDeclaration;
+
+ }
+
+ /**
+ * Parses a type specifier list as a user-declared type.
+ *
+ * @param typeSpecifierList
+ * A TYPE_SPECIFIER_LIST node containing a user-declared type.
+ * @param pointerList
+ * A list of POINTER nodes that apply to the type specified in
+ * typeSpecifierList.
+ * @return The corresponding declaration.
+ * @throws ParseException
+ * If the type does not exist (has not been found).
+ */
+ private IDeclaration parseTypeDeclaration(CommonTree typeSpecifierList,
+ List<CommonTree> pointerList) throws ParseException {
+ /* Create the string representation of the type declaration */
+ String typeStringRepresentation = createTypeDeclarationString(
+ typeSpecifierList, pointerList);
+
+ /* Use the string representation to search the type in the current scope */
+ IDeclaration decl = getCurrentScope().lookupTypeRecursive(
+ typeStringRepresentation);
+
+ if (decl == null) {
+ throw new ParseException("Type " + typeStringRepresentation //$NON-NLS-1$
+ + " has not been defined."); //$NON-NLS-1$
+ }
+
+ return decl;
+ }
+
+ /**
+ * Parses an integer declaration node.
+ *
+ * @param integer
+ * An INTEGER node.
+ * @return The corresponding integer declaration.
+ * @throws ParseException
+ */
+ private IntegerDeclaration parseInteger(CommonTree integer)
+ throws ParseException {
+
+ List<CommonTree> children = integer.getChildren();
+
+ /*
+ * If the integer has no attributes, then it is missing the size
+ * attribute which is required
+ */
+ if (children == null) {
+ throw new ParseException("integer: missing size attribute"); //$NON-NLS-1$
+ }
+
+ /* The return value */
+ IntegerDeclaration integerDeclaration = null;
+ boolean signed = false;
+ ByteOrder byteOrder = fTrace.getByteOrder();
+ long size = 0;
+ long alignment = 0;
+ int base = DEFAULT_INT_BASE;
+ @NonNull
+ String clock = EMPTY_STRING;
+
+ Encoding encoding = Encoding.NONE;
+
+ /* Iterate on all integer children */
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.CTF_EXPRESSION_VAL:
+ /*
+ * An assignment expression must have 2 children, left and right
+ */
+
+ CommonTree leftNode = (CommonTree) child.getChild(0);
+ CommonTree rightNode = (CommonTree) child.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
+ }
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(SIGNED)) {
+ signed = getSigned(rightNode);
+ } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
+ byteOrder = getByteOrder(rightNode);
+ } else if (left.equals(SIZE)) {
+ size = getSize(rightNode);
+ } else if (left.equals(MetadataStrings.ALIGN)) {
+ alignment = getAlignment(rightNode);
+ } else if (left.equals(BASE)) {
+ base = getBase(rightNode);
+ } else if (left.equals(ENCODING)) {
+ encoding = getEncoding(rightNode);
+ } else if (left.equals(MAP)) {
+ clock = getClock(rightNode);
+ } else {
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownIntegerAttributeWarning + " " + left); //$NON-NLS-1$
+ }
+
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ if (size <= 0) {
+ throw new ParseException("Invalid size attribute in Integer: " + size); //$NON-NLS-1$
+ }
+
+ if (alignment == 0) {
+ alignment = ((size % DEFAULT_ALIGNMENT) == 0) ? 1 : DEFAULT_ALIGNMENT;
+ }
+
+ integerDeclaration = IntegerDeclaration.createDeclaration((int) size, signed, base,
+ byteOrder, encoding, clock, alignment);
+
+ return integerDeclaration;
+ }
+
+ @NonNull
+ private static String getClock(CommonTree rightNode) {
+ String clock = rightNode.getChild(1).getChild(0).getChild(0).getText();
+ return clock == null ? EMPTY_STRING : clock;
+ }
+
+ private static StringDeclaration parseString(CommonTree string)
+ throws ParseException {
+
+ List<CommonTree> children = string.getChildren();
+ StringDeclaration stringDeclaration = null;
+
+ if (children == null) {
+ stringDeclaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ } else {
+ Encoding encoding = Encoding.UTF8;
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.CTF_EXPRESSION_VAL:
+ /*
+ * An assignment expression must have 2 children, left and
+ * right
+ */
+
+ CommonTree leftNode = (CommonTree) child.getChild(0);
+ CommonTree rightNode = (CommonTree) child.getChild(1);
+
+ List<CommonTree> leftStrings = leftNode.getChildren();
+
+ if (!isAnyUnaryString(leftStrings.get(0))) {
+ throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
+ }
+ String left = concatenateUnaryStrings(leftStrings);
+
+ if (left.equals(ENCODING)) {
+ encoding = getEncoding(rightNode);
+ } else {
+ throw new ParseException("String: unknown attribute " //$NON-NLS-1$
+ + left);
+ }
+
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ stringDeclaration = StringDeclaration.getStringDeclaration(encoding);
+ }
+
+ return stringDeclaration;
+ }
+
+ /**
+ * Parses a struct declaration and returns the corresponding declaration.
+ *
+ * @param struct
+ * An STRUCT node.
+ * @return The corresponding struct declaration.
+ * @throws ParseException
+ */
+ private StructDeclaration parseStruct(CommonTree struct)
+ throws ParseException {
+
+ List<CommonTree> children = struct.getChildren();
+
+ /* The return value */
+ StructDeclaration structDeclaration = null;
+
+ /* Name */
+ String structName = null;
+ boolean hasName = false;
+
+ /* Body */
+ CommonTree structBody = null;
+ boolean hasBody = false;
+
+ /* Align */
+ long structAlign = 0;
+
+ /* Loop on all children and identify what we have to work with. */
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.STRUCT_NAME: {
+ hasName = true;
+
+ CommonTree structNameIdentifier = (CommonTree) child.getChild(0);
+
+ structName = structNameIdentifier.getText();
+
+ break;
+ }
+ case CTFParser.STRUCT_BODY: {
+ hasBody = true;
+
+ structBody = child;
+
+ break;
+ }
+ case CTFParser.ALIGN: {
+ CommonTree structAlignExpression = (CommonTree) child.getChild(0);
+
+ structAlign = getAlignment(structAlignExpression);
+
+ break;
+ }
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ /*
+ * If a struct has just a body and no name (just like the song,
+ * "A Struct With No Name" by America (sorry for that...)), it's a
+ * definition of a new type, so we create the type declaration and
+ * return it. We can't add it to the declaration scope since there is no
+ * name, but that's what we want because it won't be possible to use it
+ * again to declare another field.
+ *
+ * If it has just a name, we look it up in the declaration scope and
+ * return the associated declaration. If it is not found in the
+ * declaration scope, it means that a struct with that name has not been
+ * declared, which is an error.
+ *
+ * If it has both, then we create the type declaration and register it
+ * to the current scope.
+ *
+ * If it has none, then what are we doing here ?
+ */
+ if (hasBody) {
+ /*
+ * If struct has a name, check if already defined in the current
+ * scope.
+ */
+ if (hasName && (getCurrentScope().lookupStruct(structName) != null)) {
+ throw new ParseException("struct " + structName //$NON-NLS-1$
+ + " already defined."); //$NON-NLS-1$
+ }
+ /* Create the declaration */
+ structDeclaration = new StructDeclaration(structAlign);
+
+ /* Parse the body */
+ parseStructBody(structBody, structDeclaration);
+
+ /* If struct has name, add it to the current scope. */
+ if (hasName) {
+ getCurrentScope().registerStruct(structName, structDeclaration);
+ }
+ } else /* !hasBody */{
+ if (hasName) {
+ /* Name and !body */
+
+ /* Lookup the name in the current scope. */
+ structDeclaration = getCurrentScope().lookupStructRecursive(structName);
+
+ /*
+ * If not found, it means that a struct with such name has not
+ * been defined
+ */
+ if (structDeclaration == null) {
+ throw new ParseException("struct " + structName //$NON-NLS-1$
+ + " is not defined"); //$NON-NLS-1$
+ }
+ } else {
+ /* !Name and !body */
+
+ /* We can't do anything with that. */
+ throw new ParseException("struct with no name and no body"); //$NON-NLS-1$
+ }
+ }
+ return StructDeclarationFlattener.tryFlattenStruct(structDeclaration);
+ }
+
+ /**
+ * Parses a struct body, adding the fields to specified structure
+ * declaration.
+ *
+ * @param structBody
+ * A STRUCT_BODY node.
+ * @param structDeclaration
+ * The struct declaration.
+ * @throws ParseException
+ */
+ private void parseStructBody(CommonTree structBody,
+ StructDeclaration structDeclaration) throws ParseException {
+
+ List<CommonTree> structDeclarations = structBody.getChildren();
+
+ /*
+ * If structDeclaration is null, structBody has no children and the
+ * struct body is empty.
+ */
+ if (structDeclarations != null) {
+ pushScope();
+
+ for (CommonTree declarationNode : structDeclarations) {
+ switch (declarationNode.getType()) {
+ case CTFParser.TYPEALIAS:
+ parseTypealias(declarationNode);
+ break;
+ case CTFParser.TYPEDEF:
+ parseTypedef(declarationNode);
+ break;
+ case CTFParser.SV_DECLARATION:
+ parseStructDeclaration(declarationNode, structDeclaration);
+ break;
+ default:
+ throw childTypeError(declarationNode);
+ }
+ }
+ popScope();
+ }
+ }
+
+ /**
+ * Parses a declaration found in a struct.
+ *
+ * @param declaration
+ * A SV_DECLARATION node.
+ * @param struct
+ * A struct declaration. (I know, little name clash here...)
+ * @throws ParseException
+ */
+ private void parseStructDeclaration(CommonTree declaration,
+ StructDeclaration struct) throws ParseException {
+
+ /* Get the type specifier list node */
+ CommonTree typeSpecifierListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
+
+ /* Get the type declarator list node */
+ CommonTree typeDeclaratorListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
+
+ /* Get the type declarator list */
+ List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
+
+ /*
+ * For each type declarator, parse the declaration and add a field to
+ * the struct
+ */
+ for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
+
+ StringBuilder identifierSB = new StringBuilder();
+
+ IDeclaration decl = parseTypeDeclarator(typeDeclaratorNode,
+ typeSpecifierListNode, identifierSB);
+ String fieldName = identifierSB.toString();
+ getCurrentScope().registerIdentifier(fieldName, decl);
+
+ if (struct.hasField(fieldName)) {
+ throw new ParseException("struct: duplicate field " //$NON-NLS-1$
+ + fieldName);
+ }
+
+ struct.addField(fieldName, decl);
+
+ }
+ }
+
+ /**
+ * Parses an enum declaration and returns the corresponding declaration.
+ *
+ * @param theEnum
+ * An ENUM node.
+ * @return The corresponding enum declaration.
+ * @throws ParseException
+ */
+ private EnumDeclaration parseEnum(CommonTree theEnum) throws ParseException {
+
+ List<CommonTree> children = theEnum.getChildren();
+
+ /* The return value */
+ EnumDeclaration enumDeclaration = null;
+
+ /* Name */
+ String enumName = null;
+
+ /* Body */
+ CommonTree enumBody = null;
+
+ /* Container type */
+ IntegerDeclaration containerTypeDeclaration = null;
+
+ /* Loop on all children and identify what we have to work with. */
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.ENUM_NAME: {
+ CommonTree enumNameIdentifier = (CommonTree) child.getChild(0);
+ enumName = enumNameIdentifier.getText();
+ break;
+ }
+ case CTFParser.ENUM_BODY: {
+ enumBody = child;
+ break;
+ }
+ case CTFParser.ENUM_CONTAINER_TYPE: {
+ containerTypeDeclaration = parseEnumContainerType(child);
+ break;
+ }
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ /*
+ * If the container type has not been defined explicitly, we assume it
+ * is "int".
+ */
+ if (containerTypeDeclaration == null) {
+ IDeclaration enumDecl;
+ /*
+ * it could be because the enum was already declared.
+ */
+ if (enumName != null) {
+ enumDecl = getCurrentScope().lookupEnumRecursive(enumName);
+ if (enumDecl != null) {
+ return (EnumDeclaration) enumDecl;
+ }
+ }
+
+ IDeclaration decl = getCurrentScope().lookupTypeRecursive("int"); //$NON-NLS-1$
+
+ if (decl == null) {
+ throw new ParseException("enum container type implicit and type int not defined"); //$NON-NLS-1$
+ } else if (!(decl instanceof IntegerDeclaration)) {
+ throw new ParseException("enum container type implicit and type int not an integer"); //$NON-NLS-1$
+ }
+
+ containerTypeDeclaration = (IntegerDeclaration) decl;
+ }
+
+ /*
+ * If it has a body, it's a new declaration, otherwise it's a reference
+ * to an existing declaration. Same logic as struct.
+ */
+ if (enumBody != null) {
+ /*
+ * If enum has a name, check if already defined in the current
+ * scope.
+ */
+ if ((enumName != null)
+ && (getCurrentScope().lookupEnum(enumName) != null)) {
+ throw new ParseException("enum " + enumName //$NON-NLS-1$
+ + " already defined"); //$NON-NLS-1$
+ }
+
+ /* Create the declaration */
+ enumDeclaration = new EnumDeclaration(containerTypeDeclaration);
+
+ /* Parse the body */
+ parseEnumBody(enumBody, enumDeclaration);
+
+ /* If the enum has name, add it to the current scope. */
+ if (enumName != null) {
+ getCurrentScope().registerEnum(enumName, enumDeclaration);
+ }
+ } else {
+ if (enumName != null) {
+ /* Name and !body */
+
+ /* Lookup the name in the current scope. */
+ enumDeclaration = getCurrentScope().lookupEnumRecursive(enumName);
+
+ /*
+ * If not found, it means that an enum with such name has not
+ * been defined
+ */
+ if (enumDeclaration == null) {
+ throw new ParseException("enum " + enumName //$NON-NLS-1$
+ + " is not defined"); //$NON-NLS-1$
+ }
+ } else {
+ /* !Name and !body */
+ throw new ParseException("enum with no name and no body"); //$NON-NLS-1$
+ }
+ }
+
+ return enumDeclaration;
+
+ }
+
+ /**
+ * Parses an enum body, adding the enumerators to the specified enum
+ * declaration.
+ *
+ * @param enumBody
+ * An ENUM_BODY node.
+ * @param enumDeclaration
+ * The enum declaration.
+ * @throws ParseException
+ */
+ private void parseEnumBody(CommonTree enumBody,
+ EnumDeclaration enumDeclaration) throws ParseException {
+
+ List<CommonTree> enumerators = enumBody.getChildren();
+ /* enum body can't be empty (unlike struct). */
+
+ pushScope();
+
+ /*
+ * Start at -1, so that if the first enumrator has no explicit value, it
+ * will choose 0
+ */
+ long lastHigh = -1;
+
+ for (CommonTree enumerator : enumerators) {
+ lastHigh = parseEnumEnumerator(enumerator, enumDeclaration,
+ lastHigh);
+ }
+
+ popScope();
+
+ }
+
+ /**
+ * Parses an enumerator node and adds an enumerator declaration to an
+ * enumeration declaration.
+ *
+ * The high value of the range of the last enumerator is needed in case the
+ * current enumerator does not specify its value.
+ *
+ * @param enumerator
+ * An ENUM_ENUMERATOR node.
+ * @param enumDeclaration
+ * en enumeration declaration to which will be added the
+ * enumerator.
+ * @param lastHigh
+ * The high value of the range of the last enumerator
+ * @return The high value of the value range of the current enumerator.
+ * @throws ParseException
+ */
+ private static long parseEnumEnumerator(CommonTree enumerator,
+ EnumDeclaration enumDeclaration, long lastHigh)
+ throws ParseException {
+
+ List<CommonTree> children = enumerator.getChildren();
+
+ long low = 0, high = 0;
+ boolean valueSpecified = false;
+ String label = null;
+
+ for (CommonTree child : children) {
+ if (isAnyUnaryString(child)) {
+ label = parseUnaryString(child);
+ } else if (child.getType() == CTFParser.ENUM_VALUE) {
+
+ valueSpecified = true;
+
+ low = parseUnaryInteger((CommonTree) child.getChild(0));
+ high = low;
+ } else if (child.getType() == CTFParser.ENUM_VALUE_RANGE) {
+
+ valueSpecified = true;
+
+ low = parseUnaryInteger((CommonTree) child.getChild(0));
+ high = parseUnaryInteger((CommonTree) child.getChild(1));
+ } else {
+ throw childTypeError(child);
+ }
+ }
+
+ if (!valueSpecified) {
+ low = lastHigh + 1;
+ high = low;
+ }
+
+ if (low > high) {
+ throw new ParseException("enum low value greater than high value"); //$NON-NLS-1$
+ }
+
+ if (!enumDeclaration.add(low, high, label)) {
+ throw new ParseException("enum declarator values overlap."); //$NON-NLS-1$
+ }
+
+ if (valueSpecified && (BigInteger.valueOf(low).compareTo(enumDeclaration.getContainerType().getMinValue()) == -1 ||
+ BigInteger.valueOf(high).compareTo(enumDeclaration.getContainerType().getMaxValue()) == 1)) {
+ throw new ParseException("enum value is not in range"); //$NON-NLS-1$
+ }
+
+ return high;
+ }
+
+ /**
+ * Parses an enum container type node and returns the corresponding integer
+ * type.
+ *
+ * @param enumContainerType
+ * An ENUM_CONTAINER_TYPE node.
+ * @return An integer declaration corresponding to the container type.
+ * @throws ParseException
+ * If the type does not parse correctly or if it is not an
+ * integer type.
+ */
+ private IntegerDeclaration parseEnumContainerType(
+ CommonTree enumContainerType) throws ParseException {
+
+ /* Get the child, which should be a type specifier list */
+ CommonTree typeSpecifierList = (CommonTree) enumContainerType.getChild(0);
+
+ /* Parse it and get the corresponding declaration */
+ IDeclaration decl = parseTypeSpecifierList(typeSpecifierList, null);
+
+ /* If is is an integer, return it, else throw an error */
+ if (decl instanceof IntegerDeclaration) {
+ return (IntegerDeclaration) decl;
+ }
+ throw new ParseException("enum container type must be an integer"); //$NON-NLS-1$
+ }
+
+ private VariantDeclaration parseVariant(CommonTree variant)
+ throws ParseException {
+
+ List<CommonTree> children = variant.getChildren();
+ VariantDeclaration variantDeclaration = null;
+
+ boolean hasName = false;
+ String variantName = null;
+
+ boolean hasBody = false;
+ CommonTree variantBody = null;
+
+ boolean hasTag = false;
+ String variantTag = null;
+
+ for (CommonTree child : children) {
+ switch (child.getType()) {
+ case CTFParser.VARIANT_NAME:
+
+ hasName = true;
+
+ CommonTree variantNameIdentifier = (CommonTree) child.getChild(0);
+
+ variantName = variantNameIdentifier.getText();
+
+ break;
+ case CTFParser.VARIANT_TAG:
+
+ hasTag = true;
+
+ CommonTree variantTagIdentifier = (CommonTree) child.getChild(0);
+
+ variantTag = variantTagIdentifier.getText();
+
+ break;
+ case CTFParser.VARIANT_BODY:
+
+ hasBody = true;
+
+ variantBody = child;
+
+ break;
+ default:
+ throw childTypeError(child);
+ }
+ }
+
+ if (hasBody) {
+ /*
+ * If variant has a name, check if already defined in the current
+ * scope.
+ */
+ if (hasName
+ && (getCurrentScope().lookupVariant(variantName) != null)) {
+ throw new ParseException("variant " + variantName //$NON-NLS-1$
+ + " already defined."); //$NON-NLS-1$
+ }
+
+ /* Create the declaration */
+ variantDeclaration = new VariantDeclaration();
+
+ /* Parse the body */
+ parseVariantBody(variantBody, variantDeclaration);
+
+ /* If variant has name, add it to the current scope. */
+ if (hasName) {
+ getCurrentScope().registerVariant(variantName,
+ variantDeclaration);
+ }
+ } else /* !hasBody */{
+ if (hasName) {
+ /* Name and !body */
+
+ /* Lookup the name in the current scope. */
+ variantDeclaration = getCurrentScope().lookupVariantRecursive(
+ variantName);
+
+ /*
+ * If not found, it means that a struct with such name has not
+ * been defined
+ */
+ if (variantDeclaration == null) {
+ throw new ParseException("variant " + variantName //$NON-NLS-1$
+ + " is not defined"); //$NON-NLS-1$
+ }
+ } else {
+ /* !Name and !body */
+
+ /* We can't do anything with that. */
+ throw new ParseException("variant with no name and no body"); //$NON-NLS-1$
+ }
+ }
+
+ if (hasTag) {
+ variantDeclaration.setTag(variantTag);
+
+ IDeclaration decl = getCurrentScope().lookupIdentifierRecursive(variantTag);
+ if (decl == null) {
+ throw new ParseException("Variant tag not found: " + variantTag); //$NON-NLS-1$
+ }
+ if (!(decl instanceof EnumDeclaration)) {
+ throw new ParseException("Variant tag must be an enum: " + variantTag); //$NON-NLS-1$
+ }
+ EnumDeclaration tagDecl = (EnumDeclaration) decl;
+ Set<String> intersection = new HashSet<>(tagDecl.getLabels());
+ intersection.retainAll(variantDeclaration.getFields().keySet());
+ if (intersection.isEmpty()) {
+ throw new ParseException("Variant contains no values of the tag, impossible to use: " + variantName); //$NON-NLS-1$
+ }
+ }
+
+ return variantDeclaration;
+ }
+
+ private void parseVariantBody(CommonTree variantBody,
+ VariantDeclaration variantDeclaration) throws ParseException {
+
+ List<CommonTree> variantDeclarations = variantBody.getChildren();
+
+ pushScope();
+
+ for (CommonTree declarationNode : variantDeclarations) {
+ switch (declarationNode.getType()) {
+ case CTFParser.TYPEALIAS:
+ parseTypealias(declarationNode);
+ break;
+ case CTFParser.TYPEDEF:
+ parseTypedef(declarationNode);
+ break;
+ case CTFParser.SV_DECLARATION:
+ parseVariantDeclaration(declarationNode, variantDeclaration);
+ break;
+ default:
+ throw childTypeError(declarationNode);
+ }
+ }
+
+ popScope();
+ }
+
+ private void parseVariantDeclaration(CommonTree declaration,
+ VariantDeclaration variant) throws ParseException {
+
+ /* Get the type specifier list node */
+ CommonTree typeSpecifierListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
+
+ /* Get the type declarator list node */
+ CommonTree typeDeclaratorListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
+
+ /* Get the type declarator list */
+ List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
+
+ /*
+ * For each type declarator, parse the declaration and add a field to
+ * the variant
+ */
+ for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
+
+ StringBuilder identifierSB = new StringBuilder();
+
+ IDeclaration decl = parseTypeDeclarator(typeDeclaratorNode,
+ typeSpecifierListNode, identifierSB);
+
+ String name = identifierSB.toString();
+
+ if (variant.hasField(name)) {
+ throw new ParseException("variant: duplicate field " //$NON-NLS-1$
+ + name);
+ }
+
+ getCurrentScope().registerIdentifier(name, decl);
+
+ variant.addField(name, decl);
+ }
+ }
+
+ /**
+ * Creates the string representation of a type declaration (type specifier
+ * list + pointers).
+ *
+ * @param typeSpecifierList
+ * A TYPE_SPECIFIER_LIST node.
+ * @param pointers
+ * A list of POINTER nodes.
+ * @return The string representation.
+ * @throws ParseException
+ */
+ private static String createTypeDeclarationString(
+ CommonTree typeSpecifierList, List<CommonTree> pointers)
+ throws ParseException {
+ StringBuilder sb = new StringBuilder();
+
+ createTypeSpecifierListString(typeSpecifierList, sb);
+ createPointerListString(pointers, sb);
+
+ return sb.toString();
+ }
+
+ /**
+ * Creates the string representation of a list of type specifiers.
+ *
+ * @param typeSpecifierList
+ * A TYPE_SPECIFIER_LIST node.
+ * @param sb
+ * A StringBuilder to which will be appended the string.
+ * @throws ParseException
+ */
+ private static void createTypeSpecifierListString(
+ CommonTree typeSpecifierList, StringBuilder sb)
+ throws ParseException {
+
+ List<CommonTree> children = typeSpecifierList.getChildren();
+
+ boolean firstItem = true;
+
+ for (CommonTree child : children) {
+ if (!firstItem) {
+ sb.append(' ');
+
+ }
+
+ firstItem = false;
+
+ /* Append the string that represents this type specifier. */
+ createTypeSpecifierString(child, sb);
+ }
+ }
+
+ /**
+ * Creates the string representation of a type specifier.
+ *
+ * @param typeSpecifier
+ * A TYPE_SPECIFIER node.
+ * @param sb
+ * A StringBuilder to which will be appended the string.
+ * @throws ParseException
+ */
+ private static void createTypeSpecifierString(CommonTree typeSpecifier,
+ StringBuilder sb) throws ParseException {
+ switch (typeSpecifier.getType()) {
+ case CTFParser.FLOATTOK:
+ case CTFParser.INTTOK:
+ case CTFParser.LONGTOK:
+ case CTFParser.SHORTTOK:
+ case CTFParser.SIGNEDTOK:
+ case CTFParser.UNSIGNEDTOK:
+ case CTFParser.CHARTOK:
+ case CTFParser.DOUBLETOK:
+ case CTFParser.VOIDTOK:
+ case CTFParser.BOOLTOK:
+ case CTFParser.COMPLEXTOK:
+ case CTFParser.IMAGINARYTOK:
+ case CTFParser.CONSTTOK:
+ case CTFParser.IDENTIFIER:
+ sb.append(typeSpecifier.getText());
+ break;
+ case CTFParser.STRUCT: {
+ CommonTree structName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.STRUCT_NAME);
+ if (structName == null) {
+ throw new ParseException("nameless struct found in createTypeSpecifierString"); //$NON-NLS-1$
+ }
+
+ CommonTree structNameIdentifier = (CommonTree) structName.getChild(0);
+
+ sb.append(structNameIdentifier.getText());
+ break;
+ }
+ case CTFParser.VARIANT: {
+ CommonTree variantName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.VARIANT_NAME);
+ if (variantName == null) {
+ throw new ParseException("nameless variant found in createTypeSpecifierString"); //$NON-NLS-1$
+ }
+
+ CommonTree variantNameIdentifier = (CommonTree) variantName.getChild(0);
+
+ sb.append(variantNameIdentifier.getText());
+ break;
+ }
+ case CTFParser.ENUM: {
+ CommonTree enumName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.ENUM_NAME);
+ if (enumName == null) {
+ throw new ParseException("nameless enum found in createTypeSpecifierString"); //$NON-NLS-1$
+ }
+
+ CommonTree enumNameIdentifier = (CommonTree) enumName.getChild(0);
+
+ sb.append(enumNameIdentifier.getText());
+ break;
+ }
+ case CTFParser.FLOATING_POINT:
+ case CTFParser.INTEGER:
+ case CTFParser.STRING:
+ throw new ParseException("CTF type found in createTypeSpecifierString"); //$NON-NLS-1$
+ default:
+ throw childTypeError(typeSpecifier);
+ }
+ }
+
+ /**
+ * Creates the string representation of a list of pointers.
+ *
+ * @param pointerList
+ * A list of pointer nodes. If pointerList is null, this function
+ * does nothing.
+ * @param sb
+ * A stringbuilder to which will be appended the string.
+ */
+ private static void createPointerListString(List<CommonTree> pointerList,
+ StringBuilder sb) {
+ if (pointerList == null) {
+ return;
+ }
+
+ for (CommonTree pointer : pointerList) {
+
+ sb.append(" *"); //$NON-NLS-1$
+ if (pointer.getChildCount() > 0) {
+
+ sb.append(" const"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @param node
+ * The node to check.
+ * @return True if the given node is an unary string.
+ */
+ private static boolean isUnaryString(CommonTree node) {
+ return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING));
+ }
+
+ /**
+ * @param node
+ * The node to check.
+ * @return True if the given node is any type of unary string (no quotes,
+ * quotes, etc).
+ */
+ private static boolean isAnyUnaryString(CommonTree node) {
+ return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING) || (node.getType() == CTFParser.UNARY_EXPRESSION_STRING_QUOTES));
+ }
+
+ /**
+ * @param node
+ * The node to check.
+ * @return True if the given node is an unary integer.
+ */
+ private static boolean isUnaryInteger(CommonTree node) {
+ return ((node.getType() == CTFParser.UNARY_EXPRESSION_DEC) ||
+ (node.getType() == CTFParser.UNARY_EXPRESSION_HEX) || (node.getType() == CTFParser.UNARY_EXPRESSION_OCT));
+ }
+
+ /**
+ * Parses a unary string node and return the string value.
+ *
+ * @param unaryString
+ * The unary string node to parse (type UNARY_EXPRESSION_STRING
+ * or UNARY_EXPRESSION_STRING_QUOTES).
+ * @return The string value.
+ */
+ /*
+ * It would be really nice to remove the quotes earlier, such as in the
+ * parser.
+ */
+ private static String parseUnaryString(CommonTree unaryString) {
+
+ CommonTree value = (CommonTree) unaryString.getChild(0);
+ String strval = value.getText();
+
+ /* Remove quotes */
+ if (unaryString.getType() == CTFParser.UNARY_EXPRESSION_STRING_QUOTES) {
+ strval = strval.substring(1, strval.length() - 1);
+ }
+
+ return strval;
+ }
+
+ /**
+ * Parses an unary integer (dec, hex or oct).
+ *
+ * @param unaryInteger
+ * An unary integer node.
+ * @return The integer value.
+ * @throws ParseException
+ * on an invalid integer format ("bob" for example)
+ */
+ private static long parseUnaryInteger(CommonTree unaryInteger) throws ParseException {
+
+ List<CommonTree> children = unaryInteger.getChildren();
+ CommonTree value = children.get(0);
+ String strval = value.getText();
+
+ long intval;
+ try {
+ intval = Long.decode(strval);
+ } catch (NumberFormatException e) {
+ throw new ParseException("Invalid integer format: " + strval, e); //$NON-NLS-1$
+ }
+
+ /* The rest of children are sign */
+ if ((children.size() % 2) == 0) {
+ return -intval;
+ }
+ return intval;
+ }
+
+ private static long getMajorOrMinor(CommonTree rightNode)
+ throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryInteger(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
+ }
+
+ long m = parseUnaryInteger(firstChild);
+
+ if (m < 0) {
+ throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
+ }
+
+ return m;
+ }
+ throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
+ }
+
+ private static UUID getUUID(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isAnyUnaryString(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("Invalid value for UUID"); //$NON-NLS-1$
+ }
+
+ String uuidstr = parseUnaryString(firstChild);
+
+ try {
+ return UUID.fromString(uuidstr);
+ } catch (IllegalArgumentException e) {
+ throw new ParseException("Invalid format for UUID", e); //$NON-NLS-1$
+ }
+ }
+ throw new ParseException("Invalid value for UUID"); //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the value of a "signed" integer attribute.
+ *
+ * @param rightNode
+ * A CTF_RIGHT node.
+ * @return The "signed" value as a boolean.
+ * @throws ParseException
+ */
+ private static boolean getSigned(CommonTree rightNode)
+ throws ParseException {
+
+ boolean ret = false;
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryString(firstChild)) {
+ String strval = concatenateUnaryStrings(rightNode.getChildren());
+
+ if (strval.equals(MetadataStrings.TRUE)
+ || strval.equals(MetadataStrings.TRUE2)) {
+ ret = true;
+ } else if (strval.equals(MetadataStrings.FALSE)
+ || strval.equals(MetadataStrings.FALSE2)) {
+ ret = false;
+ } else {
+ throw new ParseException("Invalid boolean value " //$NON-NLS-1$
+ + firstChild.getChild(0).getText());
+ }
+ } else if (isUnaryInteger(firstChild)) {
+ /* Happens if the value is something like "1234.hello" */
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("Invalid boolean value"); //$NON-NLS-1$
+ }
+
+ long intval = parseUnaryInteger(firstChild);
+
+ if (intval == 1) {
+ ret = true;
+ } else if (intval == 0) {
+ ret = false;
+ } else {
+ throw new ParseException("Invalid boolean value " //$NON-NLS-1$
+ + firstChild.getChild(0).getText());
+ }
+ } else {
+ throw new ParseException();
+ }
+
+ return ret;
+ }
+
+ /**
+ * Gets the value of a "byte_order" integer attribute.
+ *
+ * @param rightNode
+ * A CTF_RIGHT node.
+ * @return The "byte_order" value.
+ * @throws ParseException
+ */
+ private ByteOrder getByteOrder(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryString(firstChild)) {
+ String strval = concatenateUnaryStrings(rightNode.getChildren());
+
+ if (strval.equals(MetadataStrings.LE)) {
+ return ByteOrder.LITTLE_ENDIAN;
+ } else if (strval.equals(MetadataStrings.BE)
+ || strval.equals(MetadataStrings.NETWORK)) {
+ return ByteOrder.BIG_ENDIAN;
+ } else if (strval.equals(MetadataStrings.NATIVE)) {
+ return fTrace.getByteOrder();
+ } else {
+ throw new ParseException("Invalid value for byte order"); //$NON-NLS-1$
+ }
+ }
+ throw new ParseException("Invalid value for byte order"); //$NON-NLS-1$
+ }
+
+ /**
+ * Determines if the given value is a valid alignment value.
+ *
+ * @param alignment
+ * The value to check.
+ * @return True if it is valid.
+ */
+ private static boolean isValidAlignment(long alignment) {
+ return !((alignment <= 0) || ((alignment & (alignment - 1)) != 0));
+ }
+
+ /**
+ * Gets the value of a "size" integer attribute.
+ *
+ * @param rightNode
+ * A CTF_RIGHT node.
+ * @return The "size" value.
+ * @throws ParseException
+ */
+ private static long getSize(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryInteger(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("Invalid value for size"); //$NON-NLS-1$
+ }
+
+ long size = parseUnaryInteger(firstChild);
+
+ if (size < 1) {
+ throw new ParseException("Invalid value for size"); //$NON-NLS-1$
+ }
+
+ return size;
+ }
+ throw new ParseException("Invalid value for size"); //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the value of a "align" integer or struct attribute.
+ *
+ * @param node
+ * A CTF_RIGHT node or directly an unary integer.
+ * @return The align value.
+ * @throws ParseException
+ */
+ private static long getAlignment(CommonTree node) throws ParseException {
+
+ /*
+ * If a CTF_RIGHT node was passed, call getAlignment with the first
+ * child
+ */
+ if (node.getType() == CTFParser.CTF_RIGHT) {
+ if (node.getChildCount() > 1) {
+ throw new ParseException("Invalid alignment value"); //$NON-NLS-1$
+ }
+
+ return getAlignment((CommonTree) node.getChild(0));
+ } else if (isUnaryInteger(node)) {
+ long alignment = parseUnaryInteger(node);
+
+ if (!isValidAlignment(alignment)) {
+ throw new ParseException("Invalid value for alignment : " //$NON-NLS-1$
+ + alignment);
+ }
+
+ return alignment;
+ }
+ throw new ParseException("Invalid value for alignment"); //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the value of a "base" integer attribute.
+ *
+ * @param rightNode
+ * An CTF_RIGHT node.
+ * @return The "base" value.
+ * @throws ParseException
+ */
+ private static int getBase(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryInteger(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("invalid base value"); //$NON-NLS-1$
+ }
+
+ long intval = parseUnaryInteger(firstChild);
+ if ((intval == INTEGER_BASE_2) || (intval == INTEGER_BASE_8) || (intval == INTEGER_BASE_10)
+ || (intval == INTEGER_BASE_16)) {
+ return (int) intval;
+ }
+ throw new ParseException("Invalid value for base"); //$NON-NLS-1$
+ } else if (isUnaryString(firstChild)) {
+ switch (concatenateUnaryStrings(rightNode.getChildren())) {
+ case MetadataStrings.DECIMAL:
+ case MetadataStrings.DEC:
+ case MetadataStrings.DEC_CTE:
+ case MetadataStrings.INT_MOD:
+ case MetadataStrings.UNSIGNED_CTE:
+ return INTEGER_BASE_10;
+ case MetadataStrings.HEXADECIMAL:
+ case MetadataStrings.HEX:
+ case MetadataStrings.X:
+ case MetadataStrings.X2:
+ case MetadataStrings.POINTER:
+ return INTEGER_BASE_16;
+ case MetadataStrings.OCT:
+ case MetadataStrings.OCTAL:
+ case MetadataStrings.OCTAL_CTE:
+ return INTEGER_BASE_8;
+ case MetadataStrings.BIN:
+ case MetadataStrings.BINARY:
+ return INTEGER_BASE_2;
+ default:
+ throw new ParseException("Invalid value for base"); //$NON-NLS-1$
+ }
+ } else {
+ throw new ParseException("invalid value for base"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Gets the value of an "encoding" integer attribute.
+ *
+ * @param rightNode
+ * A CTF_RIGHT node.
+ * @return The "encoding" value.
+ * @throws ParseException
+ */
+ @NonNull
+ private static Encoding getEncoding(CommonTree rightNode)
+ throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryString(firstChild)) {
+ String strval = concatenateUnaryStrings(rightNode.getChildren());
+
+ if (strval.equals(MetadataStrings.UTF8)) {
+ return Encoding.UTF8;
+ } else if (strval.equals(MetadataStrings.ASCII)) {
+ return Encoding.ASCII;
+ } else if (strval.equals(MetadataStrings.NONE)) {
+ return Encoding.NONE;
+ } else {
+ throw new ParseException("Invalid value for encoding"); //$NON-NLS-1$
+ }
+ }
+ throw new ParseException("Invalid value for encoding"); //$NON-NLS-1$
+ }
+
+ private static long getStreamID(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryInteger(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("invalid value for stream id"); //$NON-NLS-1$
+ }
+
+ long intval = parseUnaryInteger(firstChild);
+
+ return intval;
+ }
+ throw new ParseException("invalid value for stream id"); //$NON-NLS-1$
+ }
+
+ private static String getEventName(CommonTree rightNode)
+ throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isAnyUnaryString(firstChild)) {
+ String str = concatenateUnaryStrings(rightNode.getChildren());
+
+ return str;
+ }
+ throw new ParseException("invalid value for event name"); //$NON-NLS-1$
+ }
+
+ private static long getEventID(CommonTree rightNode) throws ParseException {
+
+ CommonTree firstChild = (CommonTree) rightNode.getChild(0);
+
+ if (isUnaryInteger(firstChild)) {
+ if (rightNode.getChildCount() > 1) {
+ throw new ParseException("invalid value for event id"); //$NON-NLS-1$
+ }
+
+ long intval = parseUnaryInteger(firstChild);
+ if (intval > Integer.MAX_VALUE) {
+ throw new ParseException("Event id larger than int.maxvalue, something is amiss"); //$NON-NLS-1$
+ }
+ return intval;
+ }
+ throw new ParseException("invalid value for event id"); //$NON-NLS-1$
+ }
+
+ /**
+ * Concatenates a list of unary strings separated by arrows (->) or dots.
+ *
+ * @param strings
+ * A list, first element being an unary string, subsequent
+ * elements being ARROW or DOT nodes with unary strings as child.
+ * @return The string representation of the unary string chain.
+ */
+ private static String concatenateUnaryStrings(List<CommonTree> strings) {
+
+ StringBuilder sb = new StringBuilder();
+
+ CommonTree first = strings.get(0);
+ sb.append(parseUnaryString(first));
+
+ boolean isFirst = true;
+
+ for (CommonTree ref : strings) {
+ if (isFirst) {
+ isFirst = false;
+ continue;
+ }
+
+ CommonTree id = (CommonTree) ref.getChild(0);
+
+ if (ref.getType() == CTFParser.ARROW) {
+ sb.append("->"); //$NON-NLS-1$
+ } else { /* DOT */
+ sb.append('.');
+ }
+
+ sb.append(parseUnaryString(id));
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Throws a ParseException stating that the parent-child relation between
+ * the given node and its parent is not valid. It means that the shape of
+ * the AST is unexpected.
+ *
+ * @param child
+ * The invalid child node.
+ * @return ParseException with details
+ */
+ private static ParseException childTypeError(CommonTree child) {
+ CommonTree parent = (CommonTree) child.getParent();
+ String error = "Parent " + CTFParser.tokenNames[parent.getType()] //$NON-NLS-1$
+ + " can't have a child of type " //$NON-NLS-1$
+ + CTFParser.tokenNames[child.getType()] + "."; //$NON-NLS-1$
+
+ return new ParseException(error);
+ }
+
+ // ------------------------------------------------------------------------
+ // Scope management
+ // ------------------------------------------------------------------------
+
+ /**
+ * Adds a new declaration scope on the top of the scope stack.
+ */
+ private void pushScope() {
+ fScope = new DeclarationScope(fScope);
+ }
+
+ /**
+ * Removes the top declaration scope from the scope stack.
+ */
+ private void popScope() {
+ fScope = fScope.getParentScope();
+ }
+
+ /**
+ * Returns the current declaration scope.
+ *
+ * @return The current declaration scope.
+ */
+ private DeclarationScope getCurrentScope() {
+ return fScope;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public final class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.ctf.core.event.metadata.messages"; //$NON-NLS-1$
+
+ public static String IOStructGen_UnknownTraceAttributeWarning;
+ public static String IOStructGen_UnknownStreamAttributeWarning;
+ public static String IOStructGen_UnknownIntegerAttributeWarning;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
+
+/**
+ * Strings generated from the TSDL grammar. Note that they are static final so
+ * they get quarked. See CTF specs for more details
+ *
+ * @author Matthew Khouzam and All
+ */
+@SuppressWarnings("nls")
+public interface MetadataStrings {
+
+ /** None */
+
+ String NONE = "none";
+ /** Ascii */
+ String ASCII = "ASCII";
+ /** UTF8 */
+ String UTF8 = "UTF8";
+ /** b (for binary like b11010010 */
+ String BIN = "b";
+ /** Binary */
+ String BINARY = "binary";
+ /** Octal like o177 */
+ String OCTAL_CTE = "o";
+ /** Octal like oct177 */
+ String OCT = "oct";
+ /** Octal like octal177 */
+ String OCTAL = "octal";
+ /** Pointer (memory address for all the hardcore Java gurus out there)*/
+ String POINTER = "p";
+ /** X for hex */
+ String X2 = "X";
+ /** x for hex */
+ String X = "x";
+ /** hex */
+ String HEX = "hex";
+ /** Hexadecimal */
+ String HEXADECIMAL = "hexadecimal";
+ /** unsigned like in 10000ul */
+ String UNSIGNED_CTE = "u";
+ /** Decimal */
+ String DEC_CTE = "d";
+ /** Integer like 1000i */
+ String INT_MOD = "i";
+ /** Decimal */
+ String DEC = "dec";
+ /** Decimal */
+ String DECIMAL = "decimal";
+ /** native for byteorders*/
+ String NATIVE = "native";
+ /** network for byteorders*/
+ String NETWORK = "network";
+ /** Big endian */
+ String BE = "be";
+ /** Little endian */
+ String LE = "le";
+ /** Alignment of a field */
+ String ALIGN = "align";
+ /** Mantissa digits */
+ String MANT_DIG = "mant_dig";
+ /** Exponent digits */
+ String EXP_DIG = "exp_dig";
+ /** Loglevel */
+ String LOGLEVEL2 = "loglevel";
+ /** Name */
+ String NAME2 = "name";
+ /** Event context */
+ String EVENT_CONTEXT = "event.context";
+ /** Fields */
+ String FIELDS_STRING = "fields";
+ /** context */
+ String CONTEXT = "context";
+ /** Stream ID */
+ String STREAM_ID = "stream_id";
+ /** Packet context */
+ String PACKET_CONTEXT = "packet.context";
+ /** ID */
+ String ID = "id";
+ /** Packet Header */
+ String PACKET_HEADER = "packet.header";
+ /** Event Header */
+ String EVENT_HEADER = "event.header";
+ /** Byte order */
+ String BYTE_ORDER = "byte_order";
+ /** UUID */
+ String UUID_STRING = "uuid";
+ /** False */
+ String FALSE2 = "FALSE";
+ /** False */
+ String FALSE = "false";
+ /** True */
+ String TRUE2 = "TRUE";
+ /** True */
+ String TRUE = "true";
+ /** Minor (Version)*/
+ String MINOR = "minor";
+ /** Major (Version)*/
+ String MAJOR = "major";
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ * Matthew Khouzam - Addition to have more descriptive errors
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;
+
+import java.lang.reflect.Field;
+
+import org.antlr.runtime.MismatchedTokenException;
+import org.antlr.runtime.RecognitionException;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.parser.CTFLexer;
+
+/**
+ * CTF Reader exception but dealing with Antlr-specific parsing problems.
+ *
+ * It is separated from the main {@link CTFException} - and is not part of the
+ * API - to isolate the Antlr-specific classes and avoid pushing that dependency
+ * to the users of this plugin.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfAntlrException extends CTFException {
+
+ private static final long serialVersionUID = -7078624493350073777L;
+
+ private final int fErrorLine;
+ private final String fFile;
+ private String fExpectingName = ""; //$NON-NLS-1$
+ private int fExpectedValue = -1;
+ private String fActualName = ""; //$NON-NLS-1$
+ private int fActualValue = -1;
+
+ private final int fCharPositionInLine;
+
+ /**
+ * Re-throw the exception but read its data
+ *
+ * @param e
+ * the previous recognition exception (Antlr specific)
+ */
+ public CtfAntlrException(MismatchedTokenException e) {
+ super(e);
+ fErrorLine = e.line;
+ fCharPositionInLine = e.charPositionInLine;
+ fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
+ parseMismatchedException(e);
+ }
+
+ /**
+ * Re-throw the exception but read its data
+ *
+ * @param e
+ * the previous recognition exception (Antlr specific)
+ */
+ public CtfAntlrException(RecognitionException e) {
+ super(e);
+ fErrorLine = e.line;
+ fCharPositionInLine = e.charPositionInLine;
+ fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
+ }
+
+ /**
+ * Re-throw the exception but read its data
+ *
+ * @param e
+ * the previous rewrite exception (Antlr specific)
+ */
+ public CtfAntlrException(Exception e) {
+ super(e);
+ fErrorLine = -1;
+ fCharPositionInLine = -1;
+ fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
+ }
+
+ private void parseMismatchedException(MismatchedTokenException m) {
+ // Iterate through the tokens that are hidden in the CTFLexer
+ // They are private static final int fields.
+ for (Field f : CTFLexer.class.getDeclaredFields()) {
+ f.setAccessible(true);
+ String name;
+ int value;
+ try {
+ name = f.getName();
+ final boolean isInt = (f.getType().isPrimitive());
+ if (isInt) {
+ value = ((Integer) f.get(null)).intValue();
+ if (value == m.expecting) {
+ this.fExpectingName = name;
+ this.fExpectedValue = value;
+ }
+ if (value == m.c) {
+ this.fActualName = name;
+ this.fActualValue = value;
+ }
+ }
+ } catch (NullPointerException e1) {
+ // Pokemon, gotta catch em all!
+ // actually useful since f may not have a
+ // value
+ } catch (IllegalArgumentException e1) {
+ // Catch these exceptions (reflexion)
+ } catch (IllegalAccessException e1) {
+ // Catch these exceptions (reflexion)
+ }
+ if (!this.fExpectingName.isEmpty() && !this.fActualName.isEmpty()) {
+ return;
+ }
+ }
+ }
+
+ @Override
+ public String getMessage() {
+ final String message = super.getMessage();
+ if (fErrorLine == -1) {
+ return message;
+ }
+ String expected = "" + this.fExpectedValue; //$NON-NLS-1$
+ String actual = "" + this.fActualValue; //$NON-NLS-1$
+ String newMessage = message.replaceAll(expected, this.fExpectingName);
+ newMessage = newMessage.replaceAll(actual, this.fActualName);
+ return newMessage + " at " + fFile + ":" + fErrorLine + ":" + fCharPositionInLine; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;
+
+
+/**
+ * <b><u>ParseException</u></b>
+ */
+public class ParseException extends Exception {
+
+ private static final long serialVersionUID = 7901917601459652080L;
+
+ /**
+ * Empty constructor
+ */
+ public ParseException() {
+ super();
+ }
+
+ /**
+ * Constructor
+ *
+ * @param message to be sent to logs
+ */
+ public ParseException(String message) {
+ super(message);
+ }
+
+ /**
+ * Copy constructor
+ * @param e the exception to throw
+ */
+ public ParseException(Exception e) {
+ super(e);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and
+ * cause. <p>Note that the detail message associated with
+ * {@code cause} is <i>not</i> automatically incorporated in
+ * this exception's detail message.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ParseException(String message, Exception cause) {
+ super(message, cause);
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Marc-Andre Laperle - Initial API and implementation
+# Alexandre Montplaisir - Added strings from DeclarationScope
+###############################################################################
+
+#IOStructGen
+IOStructGen_UnknownTraceAttributeWarning=Unknown trace attribute:
+IOStructGen_UnknownStreamAttributeWarning=Unknown stream attribute:
+IOStructGen_UnknownIntegerAttributeWarning=Unknown integer attribute:
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * A CTF array declaration
+ *
+ * Arrays are fixed-length. Their length is declared in the type declaration
+ * within the meta-data. They contain an array of "inner type" elements, which
+ * can refer to any type not containing the type of the array being declared (no
+ * circular dependency). The length is the number of elements in an array.
+ *
+ * @author Matthew Khouzam
+ */
+public final class ArrayDeclaration extends CompoundDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final int fLength;
+ private final IDeclaration fElemType;
+
+ /**
+ * <pre>
+ * Cache where we can pre-generate the children names
+ * Key: parent name
+ * Value: children names
+ * ex: field → {field[0], field[1], … field[n]}
+ * </pre>
+ *
+ * TODO: investigate performance
+ */
+ private final transient ArrayListMultimap<String, String> fChildrenNames = ArrayListMultimap.create();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param length
+ * how many elements in the array
+ * @param elemType
+ * what type of element is in the array
+ */
+ public ArrayDeclaration(int length, IDeclaration elemType) {
+ fLength = length;
+ fElemType = elemType;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public IDeclaration getElementType() {
+ return fElemType;
+ }
+
+ /**
+ * Get the length of the array
+ *
+ * @return the length of the array
+ */
+ public int getLength() {
+ return fLength;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public AbstractArrayDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
+ @NonNull String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ if (isAlignedBytes()) {
+ byte[] data = new byte[fLength];
+ if (input.getByteBuffer().remaining() < fLength) {
+ throw new CTFException("Buffer underflow"); //$NON-NLS-1$
+ }
+ input.get(data);
+
+ return new ByteArrayDefinition(this, definitionScope, fieldName, data);
+ }
+ @NonNull List<Definition> definitions = read(input, definitionScope, fieldName);
+ return new ArrayDefinition(this, definitionScope, fieldName, definitions);
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
+ }
+
+ private @NonNull List<Definition> read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFException {
+ Builder<Definition> definitions = new ImmutableList.Builder<>();
+ if (!fChildrenNames.containsKey(fieldName)) {
+ for (int i = 0; i < fLength; i++) {
+ fChildrenNames.put(fieldName, fieldName + '[' + i + ']');
+ }
+ }
+ List<String> elemNames = fChildrenNames.get(fieldName);
+ for (int i = 0; i < fLength; i++) {
+ String name = elemNames.get(i);
+ if (name == null) {
+ throw new IllegalStateException();
+ }
+ definitions.add(fElemType.createDefinition(definitionScope, name, input));
+ }
+ return checkNotNull(definitions.build());
+ }
+
+ @Override
+ public int getMaximumSize() {
+ long val = (long) fLength * fElemType.getMaximumSize();
+ return (int) Math.min(Integer.MAX_VALUE, val);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + fElemType.hashCode();
+ result = prime * result + fLength;
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ArrayDeclaration other = (ArrayDeclaration) obj;
+ if (!fElemType.equals(other.fElemType)) {
+ return false;
+ }
+ if (fLength != other.fLength) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ArrayDeclaration other = (ArrayDeclaration) obj;
+ if (!fElemType.isBinaryEquivalent(other.fElemType)) {
+ return false;
+ }
+ if (fLength != other.fLength) {
+ return false;
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A CTF array definition
+ *
+ * Arrays are fixed-length. Their length is declared in the type declaration
+ * within the meta-data. They contain an array of "inner type" elements, which
+ * can refer to any type not containing the type of the array being declared (no
+ * circular dependency). The length is the number of elements in an array.
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class ArrayDefinition extends AbstractArrayDefinition {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final List<Definition> fDefinitions;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param declaration
+ * the parent declaration
+ * @param definitionScope
+ * the parent scope
+ * @param fieldName
+ * the field name
+ * @param definitions
+ * the content of the array
+ */
+ public ArrayDefinition(CompoundDeclaration declaration,
+ @Nullable IDefinitionScope definitionScope,
+ String fieldName,
+ List<Definition> definitions) {
+ super(declaration, definitionScope, fieldName);
+ fDefinitions = checkNotNull(ImmutableList.copyOf(definitions));
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public List<Definition> getDefinitions() {
+ return fDefinitions;
+ }
+
+ @Override
+ public int getLength() {
+ return fDefinitions.size();
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder();
+ b.append('[');
+ Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
+ b.append(joiner.join(fDefinitions));
+ b.append(']');
+ return checkNotNull(b.toString());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A fixed length string definition
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class ByteArrayDefinition extends AbstractArrayDefinition {
+
+ private final byte[] fContent;
+ private transient @Nullable List<Definition> fDefs;
+
+ /**
+ * An fixed length string declaration, it's created by sequence or array
+ * defintions
+ *
+ * @param declaration
+ * the declaration
+ * @param definitionScope
+ * the definition scope
+ * @param fieldName
+ * the field name
+ * @param content
+ * the string content
+ */
+ public ByteArrayDefinition(CompoundDeclaration declaration,
+ @Nullable IDefinitionScope definitionScope,
+ String fieldName,
+ byte[] content) {
+ super(declaration, definitionScope, fieldName);
+ fContent = content;
+
+ }
+
+ @Override
+ public int getLength() {
+ return fContent.length;
+ }
+
+ @Override
+ public synchronized List<Definition> getDefinitions() {
+ List<Definition> defs = fDefs;
+ if (defs == null) {
+ ImmutableList.Builder<Definition> builder = new ImmutableList.Builder<>();
+ for (int i = 0; i < fContent.length; i++) {
+ IntegerDeclaration charDecl = IntegerDeclaration.UINT_8_DECL;
+ String fieldName = getFieldName() + '[' + i + ']';
+ byte fieldValue = fContent[i];
+ builder.add(new IntegerDefinition(charDecl, getDefinitionScope(), fieldName, fieldValue));
+ }
+ fDefs = NonNullUtils.checkNotNull(builder.build());
+ return fDefs;
+ }
+
+ return defs;
+ }
+
+ @Override
+ public String toString() {
+ if (((CompoundDeclaration) getDeclaration()).isString()) {
+ /*
+ * the string is a byte array and may contain more than the string
+ * plus a null char, this will truncate it back to a null char
+ */
+ int pos = -1;
+ for (int i = 0; i < fContent.length; i++) {
+ if (fContent[i] == 0) {
+ pos = i;
+ break;
+ }
+ }
+ byte[] bytes = (pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent;
+ return new String(bytes);
+ }
+ StringBuilder b = new StringBuilder();
+ b.append('[');
+ Joiner.on(", ").appendTo(b, Arrays.asList(fContent)); //$NON-NLS-1$
+ b.append(']');
+ return checkNotNull(b.toString());
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import com.google.common.collect.Multimap;
+
+/**
+ * A CTF sequence declaration.
+ *
+ * An array where the size is fixed but declared in the trace, unlike array
+ * where it is declared with a literal
+ *
+ * @author Matthew Khouzam
+ */
+public class SequenceDeclaration extends CompoundDeclaration {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final IDeclaration fElemType;
+ private final String fLengthName;
+ private final transient Multimap<String, String> fPaths = ArrayListMultimap.create();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param lengthName
+ * the name of the field describing the length
+ * @param elemType
+ * The element type
+ */
+ public SequenceDeclaration(@Nullable String lengthName, IDeclaration elemType) {
+ fElemType = elemType;
+ fLengthName = lengthName;
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ @Override
+ public IDeclaration getElementType() {
+ return fElemType;
+ }
+
+ /**
+ * Gets the name of the length field
+ *
+ * @return the name of the length field
+ */
+ public String getLengthName() {
+ return fLengthName;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public AbstractArrayDefinition createDefinition(
+ @Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
+ IDefinition lenDef = null;
+
+ if (definitionScope != null) {
+ lenDef = definitionScope.lookupDefinition(getLengthName());
+ }
+
+ if (lenDef == null) {
+ throw new CTFException("Sequence length field not found"); //$NON-NLS-1$
+ }
+
+ if (!(lenDef instanceof IntegerDefinition)) {
+ throw new CTFException("Sequence length field not integer"); //$NON-NLS-1$
+ }
+
+ IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef;
+
+ if (lengthDefinition.getDeclaration().isSigned()) {
+ throw new CTFException("Sequence length must not be signed"); //$NON-NLS-1$
+ }
+
+ long length = lengthDefinition.getValue();
+ if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) {
+ throw new CTFException("Sequence length too long " + length); //$NON-NLS-1$
+ }
+
+ if (isAlignedBytes()) {
+ // Don't create "useless" definitions
+ byte[] data = new byte[(int) length];
+ input.get(data);
+ return new ByteArrayDefinition(this, definitionScope, fieldName, data);
+ }
+ Collection<String> collection = fPaths.get(fieldName);
+ while (collection.size() < length) {
+ fPaths.put(fieldName, fieldName + '[' + collection.size() + ']');
+ }
+ List<String> paths = (List<String>) fPaths.get(fieldName);
+ Builder<Definition> definitions = new ImmutableList.Builder<>();
+ for (int i = 0; i < length; i++) {
+ /* We should not have inserted any null values */
+ String elemName = checkNotNull(paths.get(i));
+ definitions.add(fElemType.createDefinition(definitionScope, elemName, input));
+ }
+ List<Definition> list = checkNotNull(definitions.build());
+ return new ArrayDefinition(this, definitionScope, fieldName, list);
+ }
+
+ @Override
+ public String toString() {
+ /* Only used for debugging */
+ return "[declaration] sequence[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return Integer.MAX_VALUE;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + fElemType.hashCode();
+ result = prime * result + fLengthName.hashCode();
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SequenceDeclaration other = (SequenceDeclaration) obj;
+ if (!fElemType.equals(other.fElemType)) {
+ return false;
+ }
+ if (!fLengthName.equals(other.fLengthName)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SequenceDeclaration other = (SequenceDeclaration) obj;
+ if (!fElemType.isBinaryEquivalent(other.fElemType)) {
+ return false;
+ }
+ if (!fLengthName.equals(other.fLengthName)) {
+ return false;
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.ISimpleDatatypeDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+
+/**
+ * A fixed size struct declaration is a declaration of a structure that has no
+ * variant or sequence fields. This will accelerate reading of the trace.
+ *
+ * @author Matthew Khouzam
+ */
+public final class StructDeclarationFlattener {
+
+ private StructDeclarationFlattener() {}
+
+ /**
+ * Flatten a {@link StructDeclaration}, if it can be (which means if it
+ * contains only fixed-size elements).
+ *
+ * This does not modify the declaration passed in parameter, you need to use
+ * the return value.
+ *
+ * @param sd
+ * The initial StructDeclaration
+ * @return The flattened struct. Or if it couldn't be flattened, the 'sd'
+ * struct itself
+ */
+ public static @NonNull StructDeclaration tryFlattenStruct(@NonNull StructDeclaration sd) {
+ if (canBeFlattened(sd)) {
+ return newFlattenedStruct(sd);
+ }
+ return sd;
+ }
+
+ /**
+ * Check if this struct is fixed size
+ *
+ * @param sd
+ * the struct
+ * @return if the struct is of fixed size
+ */
+ private static boolean canBeFlattened(@NonNull StructDeclaration sd) {
+ for (String field : sd.getFieldsList()) {
+ IDeclaration dec = sd.getField(field);
+ if (!isFixedSize(dec)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isFixedSize(IDeclaration dec) {
+ if (dec instanceof ISimpleDatatypeDeclaration) {
+ return true;
+ }
+ if (dec instanceof ArrayDeclaration) {
+ return isFixedSize(((ArrayDeclaration) dec).getElementType());
+ }
+ if (dec instanceof StructDeclaration) {
+ StructDeclaration sDec = ((StructDeclaration) dec);
+ return canBeFlattened(sDec);
+ }
+ return false;
+ }
+
+ private static @NonNull StructDeclaration newFlattenedStruct(@NonNull StructDeclaration sd) {
+ StructDeclaration flatStruct = new StructDeclaration(sd.getAlignment());
+ for (String name : sd.getFieldsList()) {
+ depthFirstAdd(name, flatStruct, sd.getField(name));
+ }
+ return flatStruct;
+ }
+
+ private static void depthFirstAdd(String path, StructDeclaration flatStruct, IDeclaration dec) {
+ if (dec instanceof ISimpleDatatypeDeclaration) {
+ flatStruct.addField(path, dec);
+ } else if (dec instanceof ArrayDeclaration) {
+ ArrayDeclaration ad = (ArrayDeclaration) dec;
+ int lastIndexOf = path.lastIndexOf('.');
+ String name = (lastIndexOf > 0) ? path.substring(lastIndexOf) : path;
+ if (ad.isAlignedBytes()) {
+ flatStruct.addField(path, dec);
+ } else {
+ for (int i = 0; i < ad.getLength(); i++) {
+ depthFirstAdd(path + '.' + name + '[' + i + ']', flatStruct, ad.getElementType());
+ }
+ }
+ } else if (dec instanceof StructDeclaration) {
+ StructDeclaration sDec = ((StructDeclaration) dec);
+ for (String name : sDec.getFieldsList()) {
+ depthFirstAdd(path + '.' + name, flatStruct, sDec.getField(name));
+ }
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
+
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+
+/**
+ * An event header declaration is a declaration of a structure defined in the
+ * CTF spec examples section 6.1.1 . It is used in LTTng traces. This will
+ * accelerate reading of the trace.
+ *
+ * Reminder
+ *
+ * <pre>
+ * struct event_header_compact {
+ * enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
+ * variant <id> {
+ * struct {
+ * uint27_clock_monotonic_t timestamp;
+ * } compact;
+ * struct {
+ * uint32_t id;
+ * uint64_clock_monotonic_t timestamp;
+ * } extended;
+ * } v;
+ * } align(8);
+ * </pre>
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class EventHeaderCompactDeclaration extends Declaration implements IEventHeaderDeclaration {
+
+ private static final int BASE_10 = 10;
+ /**
+ * The id is 5 bits
+ */
+ private static final int COMPACT_ID = 5;
+ private static final int EXTENDED_VALUE = (1 << COMPACT_ID) - 1;
+ /**
+ * Full sized id is 32 bits
+ */
+ private static final int ID_SIZE = 32;
+ /**
+ * Full sized timestamp is 64 bits
+ */
+ private static final int FULL_TS = 64;
+ /**
+ * Compact timestamp is 27 bits,
+ */
+ private static final int COMPACT_TS = 27;
+ /**
+ * Clock identifier
+ */
+ private static final String CLOCK = ""; //$NON-NLS-1$
+ /**
+ * Maximum size = largest this header can be
+ */
+ private static final int MAX_SIZE = 104;
+ /**
+ * Byte aligned
+ */
+ private static final int ALIGN_ON_1 = 1;
+ private static final int ALIGN_ON_8 = 8;
+
+ private final ByteOrder fByteOrder;
+ private final List<StructDeclaration> fReferenceStructs = new ArrayList<>();
+
+ /**
+ * Big-Endian Large Event Header
+ */
+ private static final EventHeaderCompactDeclaration EVENT_HEADER_BIG_ENDIAN = new EventHeaderCompactDeclaration(nullCheck(ByteOrder.BIG_ENDIAN));
+
+ /**
+ * Little-Endian Large Event Header
+ */
+ private static final EventHeaderCompactDeclaration EVENT_HEADER_LITTLE_ENDIAN = new EventHeaderCompactDeclaration(nullCheck(ByteOrder.LITTLE_ENDIAN));
+
+ /**
+ * Event Header Declaration
+ *
+ * @param byteOrder
+ * the byteorder
+ */
+ private EventHeaderCompactDeclaration(ByteOrder byteOrder) {
+ fByteOrder = byteOrder;
+ populateReferences();
+ }
+
+ private void populateReferences() {
+ if (!fReferenceStructs.isEmpty()) {
+ return;
+ }
+ StructDeclaration ref = new StructDeclaration(ALIGN_ON_8);
+ EnumDeclaration id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
+ id.add(0, EXTENDED_VALUE - 1, COMPACT);
+ id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
+ ref.addField(ID, id);
+ VariantDeclaration v = new VariantDeclaration();
+ StructDeclaration compact = new StructDeclaration(ALIGN_ON_1);
+ compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
+ StructDeclaration extended = new StructDeclaration(ALIGN_ON_8);
+ extended.addField(ID, IntegerDeclaration.createDeclaration(ID_SIZE, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ v.addField(COMPACT, compact);
+ v.addField(EXTENDED, extended);
+ ref.addField(VARIANT_NAME, v);
+ fReferenceStructs.add(ref);
+ }
+
+ /**
+ * Gets an {@link EventHeaderCompactDeclaration} of a given ByteOrder
+ *
+ * @param byteOrder
+ * the byte order
+ * @return the header declaration
+ */
+ public static EventHeaderCompactDeclaration getEventHeader(@Nullable ByteOrder byteOrder) {
+ if (byteOrder == ByteOrder.BIG_ENDIAN) {
+ return EVENT_HEADER_BIG_ENDIAN;
+ }
+ return EVENT_HEADER_LITTLE_ENDIAN;
+ }
+
+ @Override
+ public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ ByteOrder bo = input.getByteOrder();
+ input.setByteOrder(fByteOrder);
+ int enumId = (int) input.get(COMPACT_ID, false);
+ if (enumId != EXTENDED_VALUE) {
+ long timestamp2 = input.get(COMPACT_TS, false);
+ input.setByteOrder(bo);
+ return new EventHeaderDefinition(this, enumId, timestamp2, COMPACT_TS);
+ }
+ // needed since we read 5 bits
+ input.position(input.position() + 3);
+ long id = input.get(ID_SIZE, false);
+ if (id > Integer.MAX_VALUE) {
+ throw new CTFException("ID " + id + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ long timestampLong = input.get(FULL_TS, false);
+ input.setByteOrder(bo);
+ return new EventHeaderDefinition(this, (int) id, timestampLong, FULL_TS);
+
+ }
+
+ @Override
+ public long getAlignment() {
+ return ALIGN_ON_8;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return MAX_SIZE;
+ }
+
+ /**
+ * Check if a given struct declaration is an event header
+ *
+ * @param declaration
+ * the declaration
+ * @return true if the struct is a compact event header
+ */
+ public boolean isCompactEventHeader(@Nullable StructDeclaration declaration) {
+ if (declaration == null) {
+ return false;
+ }
+ for (IDeclaration ref : fReferenceStructs) {
+ if (ref.isBinaryEquivalent(declaration)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static ByteOrder nullCheck(@Nullable ByteOrder bo) {
+ if (bo == null) {
+ throw new IllegalStateException("Could not create byteorder"); //$NON-NLS-1$
+ }
+ return bo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (fByteOrder.equals(ByteOrder.BIG_ENDIAN) ? 4321 : 1234);
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EventHeaderCompactDeclaration other = (EventHeaderCompactDeclaration) obj;
+ if (!fByteOrder.equals(other.fByteOrder)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
+ for (StructDeclaration referenceStruct : fReferenceStructs) {
+ if (referenceStruct.isBinaryEquivalent(other)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * An event header definition, as shown in the example of the CTF spec examples
+ * section 6.1.1
+ *
+ * @author Matthew Khouzam
+ */
+public final class EventHeaderDefinition extends Definition implements ICompositeDefinition {
+
+ private static final List<String> FIELD_NAMES = ImmutableList.of(
+ IEventHeaderDeclaration.ID,
+ IEventHeaderDeclaration.TIMESTAMP
+ );
+
+ private final int fId;
+ private final long fTimestamp;
+ private final int fTimestampLength;
+
+ /**
+ * Event header defintion
+ *
+ * @param id
+ * the event id
+ * @param timestamp
+ * the timestamp
+ * @param eventHeaderDecl
+ * The declaration of this defintion
+ * @param timestampLength
+ * the number of bits valid in the timestamp
+ */
+ public EventHeaderDefinition(@NonNull Declaration eventHeaderDecl, int id, long timestamp, int timestampLength) {
+ super(eventHeaderDecl, null, ILexicalScope.EVENT_HEADER.getPath(), ILexicalScope.EVENT_HEADER);
+ fId = id;
+ fTimestamp = timestamp;
+ fTimestampLength = timestampLength;
+ }
+
+ /**
+ * Gets the timestamp declaration
+ *
+ * @return the timestamp declaration
+ */
+ public int getTimestampLength() {
+ return fTimestampLength;
+ }
+
+ /**
+ * Get the event id
+ *
+ * @return the event id
+ */
+ public int getId() {
+ return fId;
+ }
+
+ /**
+ * Get the timestamp
+ *
+ * @return the timestamp
+ */
+ public long getTimestamp() {
+ return fTimestamp;
+ }
+
+ @Override
+ public Definition getDefinition(String fieldName) {
+ if (fieldName.equals(IEventHeaderDeclaration.ID)) {
+ return new IntegerDefinition(IntegerDeclaration.INT_32B_DECL, null, IEventHeaderDeclaration.ID, getId());
+ } else if (fieldName.equals(IEventHeaderDeclaration.TIMESTAMP)) {
+ return new IntegerDefinition(IntegerDeclaration.INT_64B_DECL, null, IEventHeaderDeclaration.TIMESTAMP, getTimestamp());
+ }
+ return null;
+ }
+
+ @Override
+ public List<String> getFieldNames() {
+ return FIELD_NAMES;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
+
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
+import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+
+/**
+ * An event header declaration is a declaration of a structure defined in the
+ * CTF spec examples section 6.1.1 . It is used in LTTng traces. This will
+ * accelerate reading of the trace.
+ *
+ * Reminder
+ *
+ * <pre>
+ * struct event_header_large {
+ * enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
+ * variant <id> {
+ * struct {
+ * uint32_clock_monotonic_t timestamp;
+ * } compact;
+ * struct {
+ * uint32_t id;
+ * uint64_clock_monotonic_t timestamp;
+ * } extended;
+ * } v;
+ * } align(8);
+ * </pre>
+ *
+ * @author Matthew Khouzam
+ */
+@NonNullByDefault
+public final class EventHeaderLargeDeclaration extends Declaration implements IEventHeaderDeclaration {
+
+ private static final int ALIGN_ON_1 = 1;
+ private static final int BASE_10 = 10;
+ /**
+ * The id is 16 bits
+ */
+ private static final int COMPACT_ID = 16;
+ private static final int EXTENDED_VALUE = (1 << COMPACT_ID) - 1;
+ /**
+ * Full sized timestamp is 64 bits
+ */
+ private static final int FULL_TS = 64;
+ /**
+ * Compact timestamp is 32 bits,
+ */
+ private static final int COMPACT_TS = 32;
+ /**
+ * Clock mapping
+ */
+ private static final String CLOCK = ""; //$NON-NLS-1$
+ private static final String CLOCK_MONOTONIC = "clock_monotonic"; //$NON-NLS-1$
+ /**
+ * Maximum size = largest this header can be
+ */
+ private static final int MAX_SIZE = 112;
+ /**
+ * Byte aligned
+ */
+ private static final int ALIGN_ON_8 = 8;
+
+ private final ByteOrder fByteOrder;
+ private final List<StructDeclaration> fReferenceStructs = new ArrayList<>();
+
+ /**
+ * Big-Endian Large Event Header
+ */
+ private static final EventHeaderLargeDeclaration EVENT_HEADER_BIG_ENDIAN = new EventHeaderLargeDeclaration(nullCheck(ByteOrder.BIG_ENDIAN));
+
+ /**
+ * Little-Endian Large Event Header
+ */
+ private static final EventHeaderLargeDeclaration EVENT_HEADER_LITTLE_ENDIAN = new EventHeaderLargeDeclaration(nullCheck(ByteOrder.LITTLE_ENDIAN));
+
+ /**
+ * Event Header Declaration
+ *
+ * @param byteOrder
+ * the byteorder
+ */
+ private EventHeaderLargeDeclaration(ByteOrder byteOrder) {
+ fByteOrder = byteOrder;
+ populateReferences();
+ }
+
+ private void populateReferences() {
+ if (!fReferenceStructs.isEmpty()) {
+ return;
+ }
+ StructDeclaration ref = new StructDeclaration(ALIGN_ON_8);
+ EnumDeclaration id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
+ id.add(0, EXTENDED_VALUE - 1, COMPACT);
+ id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
+ ref.addField(ID, id);
+ VariantDeclaration v = new VariantDeclaration();
+ StructDeclaration compact = new StructDeclaration(1);
+ compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ StructDeclaration extended = new StructDeclaration(1);
+ extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ v.addField(COMPACT, compact);
+ v.addField(EXTENDED, extended);
+ ref.addField(VARIANT_NAME, v);
+ fReferenceStructs.add(ref);
+ ref = new StructDeclaration(ALIGN_ON_8);
+ id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ id.add(0, EXTENDED_VALUE - 1, COMPACT);
+ id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
+ ref.addField(ID, id);
+ v = new VariantDeclaration();
+ compact = new StructDeclaration(ALIGN_ON_1);
+ compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended = new StructDeclaration(ALIGN_ON_1);
+ extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK_MONOTONIC, ALIGN_ON_8));
+ v.addField(COMPACT, compact);
+ v.addField(EXTENDED, extended);
+ ref.addField(VARIANT_NAME, v);
+ fReferenceStructs.add(ref);
+ ref = new StructDeclaration(ALIGN_ON_8);
+ id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, COMPACT_ID));
+ id.add(0, EXTENDED_VALUE - 1, COMPACT);
+ id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
+ ref.addField(ID, id);
+ v = new VariantDeclaration();
+ compact = new StructDeclaration(ALIGN_ON_1);
+ compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended = new StructDeclaration(ALIGN_ON_1);
+ extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
+ extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK_MONOTONIC, ALIGN_ON_8));
+ v.addField(COMPACT, compact);
+ v.addField(EXTENDED, extended);
+ ref.addField(VARIANT_NAME, v);
+ fReferenceStructs.add(ref);
+ }
+
+ /**
+ * Gets an {@link EventHeaderLargeDeclaration} of a given ByteOrder
+ *
+ * @param byteOrder
+ * the byte order
+ * @return the header declaration
+ */
+ public static EventHeaderLargeDeclaration getEventHeader(@Nullable ByteOrder byteOrder) {
+ if (byteOrder == ByteOrder.BIG_ENDIAN) {
+ return EVENT_HEADER_BIG_ENDIAN;
+ }
+ return EVENT_HEADER_LITTLE_ENDIAN;
+ }
+
+ @Override
+ public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
+ alignRead(input);
+ ByteOrder bo = input.getByteOrder();
+ input.setByteOrder(fByteOrder);
+ int first = (int) input.get(COMPACT_ID, false);
+ long second = input.get(COMPACT_TS, false);
+ if (first != EXTENDED_VALUE) {
+ input.setByteOrder(bo);
+ return new EventHeaderDefinition(this, first, second, COMPACT_TS);
+ }
+ long timestampLong = input.get(FULL_TS, false);
+ input.setByteOrder(bo);
+ if (second > Integer.MAX_VALUE) {
+ throw new CTFException("ID " + second + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return new EventHeaderDefinition(this, (int) second, timestampLong, FULL_TS);
+ }
+
+ @Override
+ public long getAlignment() {
+ return ALIGN_ON_8;
+ }
+
+ @Override
+ public int getMaximumSize() {
+ return MAX_SIZE;
+ }
+
+ /**
+ * Check if a given struct declaration is an event header
+ *
+ * @param declaration
+ * the declaration
+ * @return true if the event is a large event header
+ */
+ public boolean isLargeEventHeader(@Nullable StructDeclaration declaration) {
+ if (declaration == null) {
+ return false;
+ }
+ for (IDeclaration ref : fReferenceStructs) {
+ if (ref.isBinaryEquivalent(declaration)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static ByteOrder nullCheck(@Nullable ByteOrder bo) {
+ if (bo == null) {
+ throw new IllegalStateException("Could not create byteorder"); //$NON-NLS-1$
+ }
+ return bo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (fByteOrder.equals(ByteOrder.BIG_ENDIAN) ? 4321 : 1234);
+ return result;
+ }
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ EventHeaderLargeDeclaration other = (EventHeaderLargeDeclaration) obj;
+ if (!fByteOrder.equals(other.fByteOrder)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
+ for (StructDeclaration referenceStruct : fReferenceStructs) {
+ if (referenceStruct.isBinaryEquivalent(other)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ * Contributors: Etienne Bergeron <etienne.bergeron@gmail.com>
+ * Contributors: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.trace;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.TreeSet;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
+
+/**
+ * <b><u>StreamInputPacketIndex</u></b>
+ * <p>
+ * This is a data structure containing entries, you may append to this and read
+ * it. It is not thread safe.
+ */
+public class StreamInputPacketIndex {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * Entries of the index. They are sorted by increasing begin timestamp.
+ * index builder.
+ */
+ private final List<ICTFPacketDescriptor> fEntries = new ArrayList<>();
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the number of elements in this data structure. If this data
+ * structure contains more than {@code Integer.MAX_VALUE} elements, returns
+ * {@code Integer.MAX_VALUE}.
+ *
+ * @return the number of elements in this data structure
+ */
+ public int size() {
+ return fEntries.size();
+ }
+
+ /**
+ * Returns {@code true} if this data structure contains no elements.
+ *
+ * @return {@code true} if this data structure contains no elements
+ */
+ public boolean isEmpty() {
+ return fEntries.isEmpty();
+ }
+
+ /**
+ * Adds a collection of entries to the index, the entries must be sorted.
+ *
+ * @param preParsedIndex
+ * the pre-parsed index file
+ *
+ * @throws CTFException
+ * If there was a problem reading the entry
+ */
+ public void appendAll(Collection<ICTFPacketDescriptor> preParsedIndex)
+ throws CTFException {
+ for (ICTFPacketDescriptor sipie : preParsedIndex) {
+ append(checkNotNull(sipie));
+ }
+ }
+
+ /**
+ * Appends the specified element to the end of this data structure
+ *
+ * @param entry
+ * element to be appended to this index, cannot be null
+ * @return {@code true} (as specified by {@link Collection#add})
+ * @throws CTFException
+ * If there was a problem reading the entry
+ */
+ public boolean append(@NonNull ICTFPacketDescriptor entry)
+ throws CTFException {
+
+ /* Validate consistent entry. */
+ if (entry.getTimestampBegin() > entry.getTimestampEnd()) {
+ throw new CTFException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$
+ }
+
+ /*
+ * Validate entries are inserted in monotonic increasing timestamp
+ * order.
+ */
+ if (!fEntries.isEmpty() && (entry.getTimestampBegin() < lastElement().getTimestampBegin())) {
+ throw new CTFException("Packets begin timestamp decreasing"); //$NON-NLS-1$
+ }
+
+ fEntries.add(entry);
+ return true;
+ }
+
+ /**
+ * Returns the first PacketIndexEntry that could include the timestamp, that
+ * is the last packet with a begin timestamp smaller than the given
+ * timestamp.
+ *
+ * @param timestamp
+ * The timestamp to look for.
+ * @return The StreamInputPacketEntry that corresponds to the packet that
+ * includes the given timestamp.
+ */
+ public ListIterator<ICTFPacketDescriptor> search(final long timestamp) {
+ /*
+ * Start with min and max covering all the elements.
+ */
+ int max = fEntries.size() - 1;
+ int min = 0;
+
+ int guessI;
+ ICTFPacketDescriptor guessEntry = null;
+
+ /*
+ * If the index is empty, return the iterator at the very beginning.
+ */
+ if (isEmpty()) {
+ return fEntries.listIterator();
+ }
+
+ if (timestamp < 0) {
+ throw new IllegalArgumentException("timestamp is negative"); //$NON-NLS-1$
+ }
+
+ /* Binary search */
+ for (;;) {
+ /*
+ * Guess in the middle of min and max.
+ */
+ guessI = min + ((max - min) / 2);
+ guessEntry = fEntries.get(guessI);
+
+ /*
+ * If we reached the point where we focus on a single packet, our
+ * search is done.
+ */
+ if (min == max) {
+ break;
+ }
+
+ if (timestamp <= guessEntry.getTimestampEnd()) {
+ /*
+ * If the timestamp is lower or equal to the end of the guess
+ * packet, then the guess packet becomes the new inclusive max.
+ */
+ max = guessI;
+ } else {
+ /*
+ * If the timestamp is greater than the end of the guess packet,
+ * then the new inclusive min is the packet after the guess
+ * packet.
+ */
+ min = guessI + 1;
+ }
+ }
+
+ return fEntries.listIterator(guessI);
+ }
+
+ /**
+ * Get the last element of the index
+ *
+ * @return the last element in the index
+ */
+ public ICTFPacketDescriptor lastElement() {
+ return fEntries.get(fEntries.size() - 1);
+ }
+
+ /**
+ * Returns the element at the specified position in this data structure.
+ *
+ * @param index
+ * index of the element to return
+ * @return the element at the specified position in this data structure
+ * @throws IndexOutOfBoundsException
+ * if the index is out of range (
+ * {@code index < 0 || index >= size()})
+ */
+ public ICTFPacketDescriptor getElement(int index) {
+ return fEntries.get(index);
+ }
+
+ /**
+ * Returns the index of the first occurrence of the specified element in
+ * this data structure, or -1 if this data structure does not contain the
+ * element. More formally, returns the lowest index {@code i} such that, for
+ * an entry {@code o}, {@code (o==null ? get(i)==null : o.equals(get(i)))},
+ * or {@code -1} if there is no such index. This will work in log(n) time
+ * since the data structure contains elements in a non-repeating increasing
+ * manner.
+ *
+ * @param element
+ * element to search for
+ * @return the index of the first occurrence of the specified element in
+ * this data structure, or -1 if this data structure does not
+ * contain the element
+ * @throws ClassCastException
+ * if the type of the specified element is incompatible with
+ * this data structure (<a
+ * href="Collection.html#optional-restrictions">optional</a>)
+ * @throws NullPointerException
+ * if the specified element is null and this data structure does
+ * not permit null elements (<a
+ * href="Collection.html#optional-restrictions">optional</a>)
+ */
+ public int indexOf(ICTFPacketDescriptor element) {
+ int indexOf = -1;
+ if (element != null) {
+ indexOf = Collections.binarySearch(fEntries, element, new MonotonicComparator());
+ }
+ return (indexOf < 0) ? -1 : indexOf;
+ }
+
+ /**
+ * Ordering comparator for entering entries into a data structure sorted by
+ * timestamp.
+ */
+ private static class MonotonicComparator implements Comparator<ICTFPacketDescriptor>, Serializable {
+ /**
+ * For {@link Serializable}, that way if we migrate to a {@link TreeSet}
+ * the comparator is serializable too.
+ */
+ private static final long serialVersionUID = -5693064068367242076L;
+
+ @Override
+ public int compare(ICTFPacketDescriptor left, ICTFPacketDescriptor right) {
+ if (left.getTimestampBegin() > right.getTimestampBegin()) {
+ return 1;
+ }
+ if (left.getTimestampBegin() < right.getTimestampBegin()) {
+ return -1;
+ }
+ if (left.getTimestampEnd() > right.getTimestampEnd()) {
+ return 1;
+ }
+ if (left.getTimestampEnd() < right.getTimestampEnd()) {
+ return -1;
+ }
+ return 0;
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.trace;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
+
+/**
+ * <b><u>StreamInputPacketIndexEntry</u></b>
+ * <p>
+ * Represents an entry in the index of event packets.
+ */
+public class StreamInputPacketIndexEntry implements ICTFPacketDescriptor {
+
+ private static final int UNKNOWN = -1;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * Position of the start of the packet header in the file, in bits
+ */
+ private final long fOffsetBits;
+
+ /**
+ * Position of the start of the packet header in the file, in bytes
+ */
+ private final long fOffsetBytes;
+
+ /**
+ * Packet size, in bits
+ */
+ private final long fPacketSizeBits;
+
+ /**
+ * Content size, in bits
+ */
+ private final long fContentSizeBits;
+
+ /**
+ * Begin timestamp
+ */
+ private final long fTimestampBegin;
+
+ /**
+ * End timestamp
+ */
+ private final long fTimestampEnd;
+
+ /**
+ * How many lost events are there?
+ */
+ private final long fLostEvents;
+
+ /**
+ * Which target is being traced
+ */
+ private final String fTarget;
+ private final long fTargetID;
+
+ /**
+ * Attributes of this index entry
+ */
+ private final Map<String, Object> fAttributes = new HashMap<>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructs an index entry.
+ *
+ * @param dataOffsetBits
+ * offset in the file for the start of data in bits
+ * @param fileSizeBytes
+ * number of bytes in a file
+ */
+
+ public StreamInputPacketIndexEntry(long dataOffsetBits, long fileSizeBytes) {
+ fContentSizeBits = (fileSizeBytes * Byte.SIZE);
+ fPacketSizeBits = (fileSizeBytes * Byte.SIZE);
+ fOffsetBits = dataOffsetBits;
+ fOffsetBytes = dataOffsetBits / Byte.SIZE;
+ fLostEvents = 0;
+ fTarget = ""; //$NON-NLS-1$
+ fTargetID = 0;
+ fTimestampBegin = Long.MIN_VALUE;
+ fTimestampEnd = Long.MAX_VALUE;
+ }
+
+ /**
+ * full Constructor
+ *
+ * @param dataOffsetBits
+ * offset in the file for the start of data in bits
+ * @param streamPacketContextDef
+ * packet context
+ * @param fileSizeBytes
+ * number of bytes in a file
+ * @param lostSoFar
+ * number of lost events so far
+ */
+ public StreamInputPacketIndexEntry(long dataOffsetBits, StructDefinition streamPacketContextDef, long fileSizeBytes, long lostSoFar) {
+ for (String field : streamPacketContextDef.getDeclaration().getFieldsList()) {
+ IDefinition id = streamPacketContextDef.lookupDefinition(field);
+ if (id instanceof IntegerDefinition) {
+ fAttributes.put(field, ((IntegerDefinition) id).getValue());
+ } else if (id instanceof FloatDefinition) {
+ fAttributes.put(field, ((FloatDefinition) id).getValue());
+ } else if (id instanceof EnumDefinition) {
+ fAttributes.put(field, ((EnumDefinition) id).getValue());
+ } else if (id instanceof StringDefinition) {
+ fAttributes.put(field, ((StringDefinition) id).getValue());
+ }
+ }
+
+ Long contentSize = (Long) fAttributes.get(CTFStrings.CONTENT_SIZE);
+ Long packetSize = (Long) fAttributes.get(CTFStrings.PACKET_SIZE);
+ Long tsBegin = (Long) fAttributes.get(CTFStrings.TIMESTAMP_BEGIN);
+ Long tsEnd = (Long) fAttributes.get(CTFStrings.TIMESTAMP_END);
+ String device = (String) fAttributes.get(CTFStrings.DEVICE);
+ // LTTng Specific
+ Long cpuId = (Long) fAttributes.get(CTFStrings.CPU_ID);
+ Long lostEvents = (Long) fAttributes.get(CTFStrings.EVENTS_DISCARDED);
+
+ /* Read the content size in bits */
+ if (contentSize != null) {
+ fContentSizeBits = (contentSize.longValue());
+ } else if (packetSize != null) {
+ fContentSizeBits = (packetSize.longValue());
+ } else {
+ fContentSizeBits = (fileSizeBytes * Byte.SIZE);
+ }
+
+ /* Read the packet size in bits */
+ if (packetSize != null) {
+ fPacketSizeBits = (packetSize.longValue());
+ } else if (this.getContentSizeBits() != 0) {
+ fPacketSizeBits = fContentSizeBits;
+ } else {
+ fPacketSizeBits = (fileSizeBytes * Byte.SIZE);
+ }
+
+ /* Read the begin timestamp */
+ if (tsBegin != null) {
+ fTimestampBegin = (tsBegin.longValue());
+ } else {
+ fTimestampBegin = Long.MIN_VALUE;
+ }
+
+ /* Read the end timestamp */
+ if (tsEnd != null) {
+ // check if tsEnd == unsigned long max value
+ if (tsEnd == -1) {
+ tsEnd = Long.MAX_VALUE;
+ }
+ fTimestampEnd = (tsEnd.longValue());
+ } else {
+ fTimestampEnd = Long.MAX_VALUE;
+ }
+
+ if (device != null) {
+ fTarget = device;
+ fTargetID = Integer.parseInt(device.replaceAll("[\\D]", "")); //$NON-NLS-1$ //$NON-NLS-2$ // slow
+ } else if (cpuId != null) {
+ fTarget = ("CPU" + cpuId.toString()); //$NON-NLS-1$
+ fTargetID = cpuId;
+ } else {
+ fTarget = null;
+ fTargetID = UNKNOWN;
+ }
+
+ if (lostEvents != null) {
+ fLostEvents = (lostEvents - lostSoFar);
+ } else {
+ fLostEvents = 0;
+ }
+
+ fOffsetBits = dataOffsetBits;
+ fOffsetBytes = dataOffsetBits / Byte.SIZE;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ @Override
+ public boolean includes(long ts) {
+ return (ts >= fTimestampBegin) && (ts <= fTimestampEnd);
+ }
+
+ @Override
+ public String toString() {
+ return "StreamInputPacketIndexEntry [offsetBits=" + fOffsetBits //$NON-NLS-1$
+ + ", timestampBegin=" + fTimestampBegin + ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
+ + fTimestampEnd + "]"; //$NON-NLS-1$
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters and Setters
+ // ------------------------------------------------------------------------
+
+ @Override
+ public long getOffsetBits() {
+ return fOffsetBits;
+ }
+
+ @Override
+ public long getPacketSizeBits() {
+ return fPacketSizeBits;
+ }
+
+ @Override
+ public long getContentSizeBits() {
+ return fContentSizeBits;
+ }
+
+ @Override
+ public long getTimestampBegin() {
+ return fTimestampBegin;
+ }
+
+ @Override
+ public long getTimestampEnd() {
+ return fTimestampEnd;
+ }
+
+ @Override
+ public long getLostEvents() {
+ return fLostEvents;
+ }
+
+ /**
+ * Add an attribute to this index entry
+ *
+ * @param field
+ * The name of the attribute
+ * @param value
+ * The value to insert
+ */
+ public void addAttribute(String field, Object value) {
+ fAttributes.put(field, value);
+ }
+
+ @Override
+ public Object lookupAttribute(String field) {
+ return fAttributes.get(field);
+ }
+
+ @Override
+ public String getTarget() {
+ return fTarget;
+ }
+
+ @Override
+ public long getTargetId() {
+ return fTargetID;
+ }
+
+ @Override
+ public long getOffsetBytes() {
+ return fOffsetBytes;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.trace;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+
+/**
+ * <b><u>StreamInputReaderTimestampComparator</u></b>
+ * <p>
+ * Compares two StreamInputReader by their timestamp (smaller comes before).
+ */
+public class StreamInputReaderTimestampComparator implements
+ Comparator<CTFStreamInputReader>, Serializable {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final long serialVersionUID = 1066434959451875045L;
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * @throws NullPointerException
+ * If any {@link CTFStreamInputReader} parameter is null, of if any
+ * of them does not contain a current event.
+ */
+ @Override
+ public int compare(CTFStreamInputReader a, CTFStreamInputReader b) {
+ EventDefinition event_a = a.getCurrentEvent();
+ EventDefinition event_b = b.getCurrentEvent();
+
+ long ta = event_a.getTimestamp();
+ long tb = event_b.getTimestamp();
+ return Utils.unsignedCompare(ta, tb);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
+ * Contributors: Simon Marchi - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.ctf.core.trace;
+
+import java.util.UUID;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+
+/**
+ * Various utilities.
+ *
+ * @version 1.0
+ * @author Matthew Khouzam
+ * @author Simon Marchi
+ */
+public final class Utils {
+
+ private Utils() {
+ }
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ /**
+ * CTF magic number. (sort of looks like CTF CTF CT)
+ */
+ public static final int CTF_MAGIC = 0xC1FC1FC1;
+
+ /**
+ * TSDL magic number. (sort of looks like TSDL LSDT)
+ */
+ public static final int TSDL_MAGIC = 0x75D11D57;
+
+ /**
+ * TSDL magic number length in bytes.
+ */
+ public static final int TSDL_MAGIC_LEN = 4;
+
+ /**
+ * Directory separator on the current platform.
+ */
+ public static final String SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
+
+ /**
+ * Length in bytes of a UUID value.
+ */
+ public static final int UUID_LEN = 16;
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Performs an unsigned long comparison on two unsigned long numbers.
+ *
+ * <strong> As Java does not support unsigned types and arithmetic,
+ * parameters are received encoded as a signed long (two-complement) but the
+ * operation is an unsigned comparator.</strong>
+ *
+ * @param left
+ * Left operand of the comparator.
+ * @param right
+ * Right operand of the comparator.
+ * @return -1 if left < right, 1 if left > right, 0 if left == right.
+ */
+ public static int unsignedCompare(long left, long right) {
+ /*
+ * This method assumes that the arithmetic overflow on signed integer
+ * wrap on a circular domain (modulo arithmetic in two-complement),
+ * which is the defined behavior in Java.
+ *
+ * This idea is to rotate the domain by the length of the negative
+ * space, and then use the signed operator.
+ */
+ final long a = left + Long.MIN_VALUE;
+ final long b = right + Long.MIN_VALUE;
+ if (a < b) {
+ return -1;
+ } else if (a > b) {
+ return 1;
+ }
+ return 0;
+ }
+
+ /**
+ * Gets a UUID from an array defintion
+ *
+ * @param uuidDef
+ * the array defintions, must contain integer bytes
+ * @return the UUID
+ * @throws CTFException
+ * if the definition contains less than 16 elements
+ */
+ public static UUID getUUIDfromDefinition(AbstractArrayDefinition uuidDef) throws CTFException {
+ byte[] uuidArray = new byte[UUID_LEN];
+ IDeclaration declaration = uuidDef.getDeclaration();
+ if (!(declaration instanceof CompoundDeclaration)) {
+ throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
+ }
+ CompoundDeclaration uuidDec = (CompoundDeclaration) declaration;
+
+ IDeclaration uuidElem = uuidDec.getElementType();
+ if (!(uuidElem instanceof IntegerDeclaration)) {
+ throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
+ }
+ IntegerDeclaration intUuidElem = (IntegerDeclaration) uuidElem;
+ if (!intUuidElem.isUnsignedByte()) {
+ throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
+ }
+ return getUUID(uuidDef, uuidArray);
+ }
+
+ private static UUID getUUID(AbstractArrayDefinition uuidDef, byte[] uuidArray) throws CTFException {
+ for (int i = 0; i < uuidArray.length; i++) {
+ IntegerDefinition uuidByteDef = (IntegerDefinition) uuidDef.getDefinitions().get(i);
+ if (uuidByteDef == null) {
+ throw new CTFException("UUID incomplete, only " + i + " bytes available"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ uuidArray[i] = (byte) uuidByteDef.getValue();
+ }
+
+ UUID uuid = Utils.makeUUID(uuidArray);
+ return uuid;
+ }
+
+ /**
+ * Creates a UUID object from an array of 16 bytes.
+ *
+ * @param bytes
+ * Array of 16 bytes.
+ * @return A UUID object.
+ */
+ public static UUID makeUUID(byte bytes[]) {
+ long high = 0;
+ long low = 0;
+
+ assert (bytes.length == Utils.UUID_LEN);
+
+ final int bitsPerByte = Byte.SIZE;
+ int bitMask = (1 << bitsPerByte) - 1;
+ for (int i = 0; i < bitsPerByte; i++) {
+ low = (low << bitsPerByte) | (bytes[i + bitsPerByte] & bitMask);
+ high = (high << bitsPerByte) | (bytes[i] & bitMask);
+ }
+
+ UUID uuid = new UUID(high, low);
+
+ return uuid;
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.ctf.parser.tests</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.ctf.parser.tests;singleton:=true
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.runtime,
+ org.eclipse.tracecompass.ctf.parser
+Export-Package: org.eclipse.tracecompass.ctf.parser.tests
+Import-Package: org.antlr.runtime;version="3.2.0",
+ org.antlr.runtime.tree;version="3.2.0"
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2015 Ericsson
+#
+# 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:
+# Etienne Bergeron - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Etienne Bergeron - Initial API and implementation
+###############################################################################
+
+#Properties file for org.eclipse.tracecompass.ctf.parser.tests
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = Trace Compass CTF Parser Tests Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2013 Ericsson
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.ctf.parser.tests</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <name>Trace Compass CTF Parser Tests Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.tracecompass.ctf.parser.tests</testSuite>
+ <testClass>org.eclipse.tracecompass.ctf.parser.tests.AllCtfParserTests</testClass>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <product>org.eclipse.platform.ide</product>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Etienne Bergeron - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Master test suite for CTF parser.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfLexerTest.class,
+ CtfParserTest.class
+})
+
+public class AllCtfParserTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Etienne Bergeron
+ *
+ * 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:
+ * Etienne Bergeron - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser.tests;
+
+import static org.junit.Assert.fail;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.Token;
+import org.eclipse.tracecompass.ctf.parser.CTFLexer;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test validates the CTF-Lexer implementation.
+ *
+ * The test splits a string into tokens with the compiled lexer and
+ * validates the sequences of tokens produced by comparing their type
+ * and content.
+ *
+ * @author Etienne Bergeron
+ */
+public class CtfLexerTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final List<Token> tokens = new LinkedList<>();
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ private void tokenize(String content) {
+ CharStream cs = new ANTLRStringStream(content);
+ CTFLexer lexer = new CTFLexer(cs);
+
+ tokens.clear();
+ for (;;) {
+ Token token = lexer.nextToken();
+ if (token == Token.EOF_TOKEN) {
+ return;
+ }
+ tokens.add(token);
+ }
+ }
+
+ private void checkToken(int type, String content) {
+ Token token = tokens.remove(0);
+ if (token.getType() != type) {
+ fail("Invalid type [value " + token.getType()
+ + " but expect " + type + "]."
+ + " Fail to tokenize:" + content);
+ } else if (token.getText().compareTo(content) != 0) {
+ fail("Invalid content [value " + token.getText()
+ + " but expect " + content + "].");
+ }
+ }
+
+ private void checkSingle(int type, String content) {
+ tokenize(content);
+ checkToken(type, content);
+ }
+
+ // ------------------------------------------------------------------------
+ // Test cases
+ // ------------------------------------------------------------------------
+
+ /**
+ * Validate the parsing of keywords
+ */
+ @Test
+ public void testKeywords() {
+ checkSingle(CTFLexer.ALIGNTOK, "align");
+ checkSingle(CTFLexer.CONSTTOK, "const");
+ checkSingle(CTFLexer.CHARTOK, "char");
+ checkSingle(CTFLexer.DOUBLETOK, "double");
+ checkSingle(CTFLexer.ENUMTOK, "enum");
+ checkSingle(CTFLexer.EVENTTOK, "event");
+ checkSingle(CTFLexer.FLOATINGPOINTTOK, "floating_point");
+ checkSingle(CTFLexer.FLOATTOK, "float");
+ checkSingle(CTFLexer.INTEGERTOK, "integer");
+ checkSingle(CTFLexer.INTTOK, "int");
+ checkSingle(CTFLexer.LONGTOK, "long");
+ checkSingle(CTFLexer.SHORTTOK, "short");
+ checkSingle(CTFLexer.SIGNEDTOK, "signed");
+ checkSingle(CTFLexer.STREAMTOK, "stream");
+ checkSingle(CTFLexer.STRINGTOK, "string");
+ checkSingle(CTFLexer.STRUCTTOK, "struct");
+ checkSingle(CTFLexer.TRACETOK, "trace");
+ checkSingle(CTFLexer.TYPEALIASTOK, "typealias");
+ checkSingle(CTFLexer.TYPEDEFTOK, "typedef");
+ checkSingle(CTFLexer.UNSIGNEDTOK, "unsigned");
+ checkSingle(CTFLexer.VARIANTTOK, "variant");
+ checkSingle(CTFLexer.VOIDTOK, "void");
+ checkSingle(CTFLexer.BOOLTOK, "_Bool");
+ checkSingle(CTFLexer.COMPLEXTOK, "_Complex");
+ checkSingle(CTFLexer.IMAGINARYTOK, "_Imaginary");
+ checkSingle(CTFLexer.ENVTOK, "env");
+ checkSingle(CTFLexer.CLOCKTOK, "clock");
+ checkSingle(CTFLexer.CALLSITETOK, "callsite");
+ checkSingle(CTFLexer.NANNUMBERTOK, "NaN");
+ checkSingle(CTFLexer.INFINITYTOK, "+inf");
+ checkSingle(CTFLexer.NINFINITYTOK, "-inf");
+ }
+
+ /**
+ * Validate the parsing of symbols
+ */
+ @Test
+ public void testSymbols() {
+ tokenize(" , : ... ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.SEPARATOR, ",");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COLON, ":");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.ELIPSES, "...");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize(" = := = ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.ASSIGNMENT, "=");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.TYPE_ASSIGNMENT, ":=");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize(" <<>> ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.LT, "<");
+ checkToken(CTFLexer.LT, "<");
+ checkToken(CTFLexer.GT, ">");
+ checkToken(CTFLexer.GT, ">");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize(" ({[]}) ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.LPAREN, "(");
+ checkToken(CTFLexer.LCURL, "{");
+ checkToken(CTFLexer.OPENBRAC, "[");
+ checkToken(CTFLexer.CLOSEBRAC, "]");
+ checkToken(CTFLexer.RCURL, "}");
+ checkToken(CTFLexer.RPAREN, ")");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize(";;");
+ checkToken(CTFLexer.TERM, ";");
+ checkToken(CTFLexer.TERM, ";");
+
+ tokenize(" ++ -- ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.SIGN, "+");
+ checkToken(CTFLexer.SIGN, "+");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.SIGN, "-");
+ checkToken(CTFLexer.SIGN, "-");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize("-> .*.");
+ checkToken(CTFLexer.ARROW, "->");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.DOT, ".");
+ checkToken(CTFLexer.POINTER, "*");
+ checkToken(CTFLexer.DOT, ".");
+ }
+
+ /**
+ * Validate the parsing of literals
+ */
+ @Test
+ public void testLiterals() {
+ tokenize("01 02 010");
+ checkToken(CTFLexer.OCTAL_LITERAL, "01");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.OCTAL_LITERAL, "02");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.OCTAL_LITERAL, "010");
+
+ tokenize("1 2 10 1024 ");
+ checkToken(CTFLexer.DECIMAL_LITERAL, "1");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.DECIMAL_LITERAL, "2");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.DECIMAL_LITERAL, "10");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.DECIMAL_LITERAL, "1024");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize("0x01 0x02 0x0F0");
+ checkToken(CTFLexer.HEX_LITERAL, "0x01");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.HEX_LITERAL, "0x02");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.HEX_LITERAL, "0x0F0");
+ }
+
+ /**
+ * Validate the parsing of literals with hexa prefix
+ */
+ @Test
+ public void testLiteralPrefixes() {
+ checkSingle(CTFLexer.HEX_LITERAL, "0x1");
+ checkSingle(CTFLexer.HEX_LITERAL, "0X1");
+ }
+
+ /**
+ * Validate the parsing of literals with type suffix
+ */
+ @Test
+ public void testLiteralSuffixes() {
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0l");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0L");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0ll");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0LL");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0ul");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0uL");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0ull");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0uLL");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0Ul");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0UL");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0Ull");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0ULL");
+ }
+
+ /**
+ * Validate the accepted characters in literals.
+ */
+ @Test
+ public void testLiteralDigits() {
+ checkSingle(CTFLexer.OCTAL_LITERAL, "001234567");
+
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "123456");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "987654");
+
+ checkSingle(CTFLexer.HEX_LITERAL, "0x012345");
+ checkSingle(CTFLexer.HEX_LITERAL, "0x678990");
+ checkSingle(CTFLexer.HEX_LITERAL, "0xABCDEF");
+ checkSingle(CTFLexer.HEX_LITERAL, "0xabcdef");
+ }
+
+ /**
+ * Validate zero literal to be the right token.
+ */
+ @Test
+ public void testLiteralZero() {
+ checkSingle(CTFLexer.OCTAL_LITERAL, "00");
+ checkSingle(CTFLexer.DECIMAL_LITERAL, "0");
+ checkSingle(CTFLexer.HEX_LITERAL, "0x0");
+ }
+
+ /**
+ * Validate character literals
+ */
+ @Test
+ public void testCharLiteral() {
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'x'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\''");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "' '");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "L'1'");
+ }
+
+ /**
+ * Validate escaped character literals
+ */
+ @Test
+ public void testEscapeCharLiteral() {
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\a'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\b'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\f'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\n'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\r'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\t'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\v'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\''");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\\"'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\\\'");
+
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\001'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\01'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\1'");
+
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x1A'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x1a'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\xa'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x0'");
+
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\uABCD'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\u0123'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\u012345678'");
+ checkSingle(CTFLexer.CHARACTER_LITERAL, "'\uFEDCBA987'");
+ }
+
+ /**
+ * Validate string literals
+ */
+ @Test
+ public void testStringLiteral() {
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"x\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\\"\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\" \"");
+ checkSingle(CTFLexer.STRING_LITERAL, "L\"1\"");
+
+ checkSingle(CTFLexer.STRING_LITERAL, "\"This is \\n a multiline\\r\\n\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "L\"This is \\n a multiline\\r\\n\"");
+ }
+
+ /**
+ * Validate string literals with escape sequence
+ */
+ @Test
+ public void testEscapeStringLiteral() {
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\a\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\b\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\f\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\n\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\r\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\t\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\v\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\'\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\\"\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\\\\"");
+
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\001\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\01\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\1\"");
+
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\x1A\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\x1a\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\xa\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\\x0\"");
+
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\uABCD\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\u0123\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\u012345678\"");
+ checkSingle(CTFLexer.STRING_LITERAL, "\"\uFEDCBA987\"");
+ }
+
+ /**
+ * Validate spaces parsing
+ */
+ @Test
+ public void testWhitespaces() {
+ tokenize(" \r\t\n\u000C ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.WS, "\r");
+ checkToken(CTFLexer.WS, "\t");
+ checkToken(CTFLexer.WS, "\n");
+ checkToken(CTFLexer.WS, "\u000C");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate comments parsing
+ */
+ @Test
+ public void testComment() {
+ tokenize(" /* test */ ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COMMENT, "/* test */");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate complex nested comments parsing
+ */
+ @Test
+ public void testNestedComment() {
+ tokenize(" /* /* */ ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COMMENT, "/* /* */");
+ checkToken(CTFLexer.WS, " ");
+
+ tokenize(" /* /* * ** / */ ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COMMENT, "/* /* * ** / */");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate multi-lines comments
+ */
+ @Test
+ public void testMultiLineComment() {
+ tokenize(" /*\ntest\n*/ ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COMMENT, "/*\ntest\n*/");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate single line comments
+ */
+ @Test
+ public void testLineComment() {
+ tokenize(" // asdad\r\n ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.LINE_COMMENT, "// asdad\r\n");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate incomplete comments parsing
+ */
+ @Ignore("Lexer must be fixed first")
+ @Test
+ public void testLineCommentWithEOF() {
+ tokenize("//");
+ checkToken(CTFLexer.LINE_COMMENT, "//");
+ }
+
+ /**
+ * Validate parsing of mixed kind of comments
+ */
+ @Test
+ public void testMixedComment() {
+ tokenize(" // /*\n");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.LINE_COMMENT, "// /*\n");
+
+ tokenize(" /*\n//\n*/ ");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.COMMENT, "/*\n//\n*/");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate parsing identifiers
+ */
+ @Test
+ public void testIdentifier() {
+ tokenize("_ a a1 B ");
+ checkToken(CTFLexer.IDENTIFIER, "_");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.IDENTIFIER, "a");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.IDENTIFIER, "a1");
+ checkToken(CTFLexer.WS, " ");
+ checkToken(CTFLexer.IDENTIFIER, "B");
+ checkToken(CTFLexer.WS, " ");
+ }
+
+ /**
+ * Validate accepted characters within an identifier
+ */
+ @Test
+ public void testIdentifierLetters() {
+ checkSingle(CTFLexer.IDENTIFIER, "ABCDEFGHI");
+ checkSingle(CTFLexer.IDENTIFIER, "JKLMNOPQR");
+ checkSingle(CTFLexer.IDENTIFIER, "STUVWXYZ");
+ checkSingle(CTFLexer.IDENTIFIER, "abcdefghi");
+ checkSingle(CTFLexer.IDENTIFIER, "jklmnopqr");
+ checkSingle(CTFLexer.IDENTIFIER, "stuvwxyz");
+ checkSingle(CTFLexer.IDENTIFIER, "_0123456789");
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Etienne Bergeron
+ *
+ * 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:
+ * Etienne Bergeron - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.antlr.runtime.ANTLRStringStream;
+import org.antlr.runtime.CharStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.RecognitionException;
+import org.antlr.runtime.tree.CommonTree;
+import org.eclipse.tracecompass.ctf.parser.CTFLexer;
+import org.eclipse.tracecompass.ctf.parser.CTFParser;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * This test validates the CTF-Parser implementation.
+ *
+ * The goal of these tests is to validate syntactic rules and not the
+ * CTF semantic. Each test parses a string with a given rule of the
+ * compiled parser and validates the resulting tree by using match rules.
+ *
+ * @author Etienne Bergeron
+ */
+public class CtfParserTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private CTFParser parser;
+
+ // ------------------------------------------------------------------------
+ // Matches - Helper class and functions to match a parsed tree.
+ // ------------------------------------------------------------------------
+
+ private class TreeMatcher {
+ int fType;
+ String fText;
+ TreeMatcher[] fChild;
+
+ TreeMatcher(int type, String text, TreeMatcher child[]) {
+ fType = type;
+ fText = text;
+ fChild = child;
+ }
+
+ void matches(CommonTree tree) {
+ if (fType == -1) {
+ return;
+ }
+ if (tree.getType() != fType) {
+ fail("Type mismatch!" +
+ " expected:" + fType +
+ " actual:" + tree.getType());
+ }
+
+ if (fText != null) {
+ if (tree.getText().compareTo(fText) != 0) {
+ fail("Text mismatch!" +
+ " expected:" + fText +
+ " actual:" + tree.getText());
+ }
+ }
+
+ if (fChild != null) {
+ int size = fChild.length;
+ if (tree.getChildren() == null) {
+ if (size != 0) {
+ fail("Invalid children!"
+ + "Expect: " + size + "child");
+ }
+ } else {
+ if (tree.getChildren().size() != size) {
+ fail("Invalid number of childs!"
+ + " expected:" + size
+ + " actual:" + tree.getChildren().size());
+ }
+
+ for (int i = 0; i < size; ++i) {
+ fChild[i].matches((CommonTree) tree.getChild(i));
+ }
+ }
+ }
+ }
+ }
+
+ void Matches(TreeMatcher matcher, CommonTree tree) {
+ if (tree == null) {
+ fail("Parsing failed!");
+ }
+ matcher.matches(tree);
+ }
+
+ TreeMatcher All() {
+ return new TreeMatcher(-1, null, null);
+ }
+
+ TreeMatcher Node(int type, TreeMatcher... child) {
+ return new TreeMatcher(type, null, child);
+ }
+
+ TreeMatcher Node(int type, String text, TreeMatcher... child) {
+ return new TreeMatcher(type, text, child);
+ }
+
+ TreeMatcher List(TreeMatcher... child) {
+ return new TreeMatcher(0, null, child);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ private void setInput(String content) {
+ CharStream cs = new ANTLRStringStream(content);
+ CTFLexer lexer = new CTFLexer(cs);
+ CommonTokenStream tokens = new CommonTokenStream(lexer);
+ parser = new CTFParser(tokens, false);
+ }
+
+ private CommonTree primaryExpression(String content) {
+ try {
+ setInput(content);
+ return parser.primaryExpression().getTree();
+ } catch (RecognitionException e) {
+ return null;
+ }
+ }
+
+ private CommonTree unaryExpression(String content) {
+ try {
+ setInput(content);
+ return parser.unaryExpression().getTree();
+ } catch (RecognitionException e) {
+ return null;
+ }
+ }
+
+ private CommonTree declaration(String content) {
+ try {
+ setInput(content);
+ return parser.declaration().getTree();
+ } catch (RecognitionException e) {
+ return null;
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test cases
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Validate that parsing of an empty expression is invalid.
+ */
+ @Test
+ public void testPrimaryExpression() {
+ CommonTree tree_empty = primaryExpression("");
+ assertEquals(null, tree_empty);
+ }
+
+ /**
+ * Validate parsing of literals through a primary expression
+ */
+ @Test
+ public void testIntegerLiteralPrimaryExpression() {
+ Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "123")),
+ primaryExpression("123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_HEX,
+ Node(CTFParser.HEX_LITERAL, "0x123")),
+ primaryExpression("0x123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_OCT,
+ Node(CTFParser.OCTAL_LITERAL, "0123")),
+ primaryExpression("0123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "123"),
+ Node(CTFParser.SIGN, "-")),
+ primaryExpression("-123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "123"),
+ Node(CTFParser.SIGN, "-")),
+ primaryExpression(" - 123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "123"),
+ Node(CTFParser.SIGN, "-"),
+ Node(CTFParser.SIGN, "-"),
+ Node(CTFParser.SIGN, "+")),
+ primaryExpression(" - - + 123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_HEX,
+ Node(CTFParser.HEX_LITERAL, "0x123"),
+ Node(CTFParser.SIGN, "+"),
+ Node(CTFParser.SIGN, "-")),
+ primaryExpression("+ - 0x123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_OCT,
+ Node(CTFParser.OCTAL_LITERAL, "0123"),
+ Node(CTFParser.SIGN, "+"),
+ Node(CTFParser.SIGN, "-")),
+ primaryExpression("+ - 0123"));
+ }
+
+ /**
+ * Validate parsing of a character literals through a primary expression
+ */
+ @Test
+ public void testCharacterLiteralPrimaryExpression() {
+ Matches(Node(CTFParser.CHARACTER_LITERAL, "'a'"),
+ primaryExpression("'a'"));
+
+ Matches(Node(CTFParser.CHARACTER_LITERAL, "'\\n'"),
+ primaryExpression("'\\n'"));
+ }
+
+ /**
+ * Validate parsing of a string literals through a primary expression
+ */
+ @Test
+ public void testStringLiteralPrimaryExpression() {
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
+ Node(CTFParser.STRING_LITERAL, "\"aaa\"")),
+ primaryExpression("\"aaa\""));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
+ Node(CTFParser.STRING_LITERAL, "L\"aaa\"")),
+ primaryExpression("L\"aaa\""));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
+ Node(CTFParser.STRING_LITERAL, "\"aaa\\n\"")),
+ primaryExpression("\"aaa\\n\""));
+ }
+
+ /**
+ * Validate parsing of keywords through a primary expression
+ */
+ @Test
+ public void testKeywordPrimaryExpression() {
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.SIGNEDTOK, "signed")),
+ primaryExpression("signed"));
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.ALIGNTOK, "align")),
+ primaryExpression("align"));
+ }
+
+ /**
+ * Validate parsing of identifiers through a primary expression
+ */
+ @Test
+ public void testIdentifierPrimaryExpression() {
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ primaryExpression("x"));
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "_123")),
+ primaryExpression("_123"));
+ }
+
+ /**
+ * Validate that parsing of an empty unary expression is invalid.
+ */
+ @Test
+ public void testUnaryExpression() {
+ CommonTree tree_empty = unaryExpression("");
+ assertEquals(null, tree_empty);
+ }
+
+ /**
+ * Validate parsing primary expression through an unary expression
+ */
+ @Test
+ public void testSimpleUnaryExpression() {
+ Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "123")),
+ unaryExpression("123"));
+
+ Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ unaryExpression("x"));
+ }
+
+ /**
+ * Validate parsing array through an unary expression
+ */
+ @Test
+ public void testArrayUnaryExpression() {
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"))),
+ unaryExpression("x[1]"));
+
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "n"))),
+ unaryExpression("x[n]"));
+
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "n")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"))),
+ unaryExpression("x[n][1]"));
+
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "n")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"),
+ Node(CTFParser.SIGN, "+"))),
+ unaryExpression("x[n][+1]"));
+ }
+
+ /**
+ * Validate parsing array with keywords through an unary expression
+ */
+ @Test
+ public void testSpecialArrayUnaryExpression() {
+ // Added for CTF-v1.8
+ Matches(List(Node(CTFParser.TRACE),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "n"))),
+ unaryExpression("trace[n]"));
+
+ Matches(List(Node(CTFParser.CLOCK),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "n")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"))),
+ unaryExpression("clock[n][1]"));
+ }
+
+ /**
+ * Validate parsing member expression through an unary expression
+ */
+ @Test
+ public void testMemberUnaryExpression() {
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.DOT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "y")))),
+ unaryExpression("x.y"));
+
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.DOT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "y"))),
+ Node(CTFParser.DOT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "z")))),
+ unaryExpression("x.y.z"));
+ }
+
+ /**
+ * Validate parsing pointer expression through an unary expression
+ */
+ @Test
+ public void testPointerUnaryExpression() {
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.ARROW,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "y")))),
+ unaryExpression("x->y"));
+
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.ARROW,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "y"))),
+ Node(CTFParser.ARROW,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "z")))),
+ unaryExpression("x->y->z"));
+ }
+
+ /**
+ * Validate complex expressions through an unary expression
+ */
+ @Test
+ public void testMixedUnaryExpression() {
+ Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "x")),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "2")),
+ Node(CTFParser.ARROW,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "y"))),
+ Node(CTFParser.DOT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "z"))),
+ Node(CTFParser.OPENBRAC),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"))),
+ unaryExpression("x[2]->y.z[1]"));
+ }
+
+ /**
+ * Validate that parsing of an empty declaration is invalid.
+ */
+ @Test
+ public void testDeclaration() {
+ CommonTree tree_empty = declaration("");
+ assertEquals(null, tree_empty);
+ }
+
+ /**
+ * Validate parsing of integer declaration
+ */
+ @Test
+ public void testIntegerTypeAliasDeclaration() {
+ // TODO: replace the "all" match with a better tree matcher.
+ Matches(All(),
+ declaration("typealias integer { } := int;"));
+ Matches(All(),
+ declaration("typealias integer { signed=true; } := int;"));
+ }
+
+ /**
+ * Validate parsing of floating declaration
+ */
+ @Test
+ public void testFloatingTypeAliasDeclaration() {
+ // TODO: replace the "all" match with a better tree matcher.
+ Matches(All(),
+ declaration("typealias floating_point { } := float;"));
+ Matches(All(),
+ declaration("typealias floating_point { align = 32; } := float;"));
+ }
+
+ /**
+ * Validate parsing of typedef declaration
+ */
+ @Ignore("This need a fix to the grammar to support a dummy initial scope. ")
+ @Test
+ public void testTypedefDeclaration() {
+ // TODO: replace the "all" match with a better tree matcher.
+ Matches(All(),
+ declaration("typedef dummy int;"));
+ Matches(All(),
+ declaration("typedef integer { } int;"));
+ }
+
+ /**
+ * Validate parsing of an enum declaration
+ */
+ @Test
+ public void testEnumDeclaration() {
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_NAME,
+ Node(CTFParser.IDENTIFIER, "name")),
+ Node(CTFParser.ENUM_BODY,
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "A"))))))),
+ declaration("enum name { A };"));
+
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_NAME, All()),
+ Node(CTFParser.ENUM_CONTAINER_TYPE,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.INTTOK))),
+ Node(CTFParser.ENUM_BODY, All())))),
+ declaration("enum name : int { A };"));
+
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_BODY, All())))),
+ declaration("enum { A };"));
+
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_CONTAINER_TYPE,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.INTTOK))),
+ Node(CTFParser.ENUM_BODY, All())))),
+ declaration("enum : int { A };"));
+ }
+
+ /**
+ * Validate parsing of an enumerator
+ */
+ @Ignore("The grammar needs to be fixed.")
+ @Test
+ public void testDeclaratorOfEnumDeclaration() {
+ /* TODO: This test crash the parser. */
+ Matches(All(),
+ declaration("enum { };"));
+
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_BODY,
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "A"))),
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "B")),
+ Node(CTFParser.ENUM_VALUE,
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "2")))),
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "C")),
+ Node(CTFParser.ENUM_VALUE_RANGE,
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "3")),
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "5")))))))),
+ declaration("enum { A, B=2, C=3...5 };"));
+
+ Matches(Node(CTFParser.DECLARATION,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.ENUM,
+ Node(CTFParser.ENUM_BODY,
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
+ Node(CTFParser.STRING_LITERAL, "\"A\""))),
+ Node(CTFParser.ENUM_ENUMERATOR,
+ Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
+ Node(CTFParser.STRING_LITERAL, "\"B\"")),
+ All()))))),
+ declaration("enum { \"A\", \"B\"=2 };"));
+ }
+
+ /**
+ * Validate parsing of empty declaration
+ */
+ @Ignore("The grammar need to be fixed to support empty ctf-body.")
+ @Test
+ public void testEmptyDeclaration() {
+ /* TODO: An exception is throw when building an common tree without
+ * assignments in the ctf-body.
+ */
+ Matches(All(),
+ declaration("env { };"));
+ Matches(All(),
+ declaration("trace { };"));
+ Matches(All(),
+ declaration("stream { };"));
+ Matches(All(),
+ declaration("event { };"));
+ }
+
+ /**
+ * Validate parsing of an environment declaration
+ */
+ @Test
+ public void testEnvDeclaration() {
+ Matches(Node(CTFParser.ENV,
+ Node(CTFParser.CTF_EXPRESSION_VAL,
+ Node(CTFParser.CTF_LEFT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "pid"))),
+ Node(CTFParser.CTF_RIGHT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "value"))))),
+ declaration("env { pid = value; };"));
+
+ Matches(Node(CTFParser.ENV,
+ Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
+ Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
+ Node(CTFParser.CTF_EXPRESSION_VAL, All(), All())),
+ declaration("env { pid = value; proc_name = \"name\"; x = y;};"));
+ }
+
+ /**
+ * Validate parsing of a trace declaration
+ */
+ @Ignore("The grammar need to be fixed.")
+ @Test
+ public void testTraceDeclaration() {
+ Matches(Node(CTFParser.TRACE,
+ Node(CTFParser.CTF_EXPRESSION_VAL,
+ Node(CTFParser.CTF_LEFT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "major"))),
+ Node(CTFParser.CTF_RIGHT,
+ Node(CTFParser.UNARY_EXPRESSION_DEC,
+ Node(CTFParser.DECIMAL_LITERAL, "1"))))),
+ declaration("trace { major = 1; };"));
+
+ Matches(Node(CTFParser.TRACE,
+ Node(CTFParser.CTF_EXPRESSION_TYPE,
+ Node(CTFParser.CTF_LEFT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "packet")),
+ Node(CTFParser.DOT,
+ Node(CTFParser.UNARY_EXPRESSION_STRING,
+ Node(CTFParser.IDENTIFIER, "header")))),
+ Node(CTFParser.CTF_RIGHT,
+ Node(CTFParser.TYPE_SPECIFIER_LIST,
+ Node(CTFParser.STRUCT,
+ Node(CTFParser.STRUCT_NAME,
+ Node(CTFParser.IDENTIFIER, "dummy"))))))),
+ declaration("trace { packet.header := struct dummy; };"));
+
+ /* TODO: This test crash the parser. */
+ Matches(Node(CTFParser.TRACE,
+ All()),
+ declaration("trace { typedef x y; };"));
+
+ Matches(Node(CTFParser.TRACE,
+ Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
+ Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
+ Node(CTFParser.CTF_EXPRESSION_TYPE, All(), All())),
+ declaration("trace { major = 1; minor = 1;"
+ + "packet.header := struct dummy; };"));
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/antlr3"/>
+ <classpathentry kind="src" path="target/generated-sources/antlr3"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.ctf.parser</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.deved.antlride.core.nature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=disabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.ctf.parser
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.tracecompass.ctf.parser;x-friends:="org.eclipse.tracecompass.ctf.core,org.eclipse.tracecompass.ctf.parser.tests"
+Import-Package: org.antlr.runtime;version="3.2.0",
+ org.antlr.runtime.tree;version="3.2.0"
--- /dev/null
+This file describes how to build the CTF Java parser files. They are stored in
+the git repository (to avoid additional compile-time dependencies), but if you
+do modify the .g files in src/, you should rebuild the resulting .java files and
+commit them.
+
+To rebuild the parser files, run Maven with the "ctf-grammar" profile, as such:
+$ mvn clean install -Pctf-grammar
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/main/antlr3,\
+ target/generated-sources/antlr3
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.properties,\
+ about.html,\
+ .
+jars.compile.order = .
+src.includes = about.html
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+#Properties file fororg.eclipse.tracecompass.ctf.parser
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = Trace Compass CTF Parser Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Trace Compass CTF Parser Plug-in</name>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <artifactId>org.eclipse.tracecompass.ctf.parser</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <!-- Do not delete the existing .java parser files in target/ -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.6.1</version>
+ <configuration>
+ <excludeDefaultDirectories>true</excludeDefaultDirectories>
+ <filesets>
+ <fileset>
+ <directory>target</directory>
+ <followSymlinks>false</followSymlinks>
+ <includes>
+ <include>*/**</include>
+ </includes>
+ <excludes>
+ <exclude>generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFLexer.java</exclude>
+ <exclude>generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFParser.java</exclude>
+ </excludes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Only rebuild the CTF grammar files if the ctf-grammar profile is active -->
+ <profiles>
+ <profile>
+ <id>ctf-grammar</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <version>3.5.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>antlr</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ <version>3.5.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
--- /dev/null
+lexer grammar CTFLexer;
+
+options {
+ language = Java;
+}
+
+@lexer::header {
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Etienne Bergeron - Update to Antlr 3.5 syntax
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser;
+}
+
+/*
+ * Lexer tokens
+ */
+
+/*
+ * Keywords
+ */
+ALIGNTOK : 'align' ;
+CONSTTOK : 'const' ;
+CHARTOK : 'char' ;
+DOUBLETOK : 'double' ;
+ENUMTOK : 'enum' ;
+EVENTTOK : 'event' ;
+FLOATINGPOINTTOK : 'floating_point' ;
+FLOATTOK : 'float' ;
+INTEGERTOK : 'integer' ;
+INTTOK : 'int' ;
+LONGTOK : 'long' ;
+SHORTTOK : 'short' ;
+SIGNEDTOK : 'signed' ;
+STREAMTOK : 'stream' ;
+STRINGTOK : 'string' ;
+STRUCTTOK : 'struct' ;
+TRACETOK : 'trace' ;
+TYPEALIASTOK : 'typealias' ;
+TYPEDEFTOK : 'typedef' ;
+UNSIGNEDTOK : 'unsigned' ;
+VARIANTTOK : 'variant' ;
+VOIDTOK : 'void' ;
+BOOLTOK : '_Bool' ;
+COMPLEXTOK : '_Complex' ;
+IMAGINARYTOK : '_Imaginary' ;
+ENVTOK : 'env' ;
+CLOCKTOK : 'clock' ;
+/*
+ * Callsite tokens (CTF v1.9)
+ */
+CALLSITETOK : 'callsite' ;
+
+
+/*
+ * These tokens are not part of the CTF standard.
+ * There are planned to be in CTF v1.9
+ */
+NANNUMBERTOK : 'NaN' ;
+INFINITYTOK : '+inf' ;
+NINFINITYTOK : '-inf' ;
+
+/*
+ * Symbols
+ */
+SEPARATOR : ',' ;
+COLON : ':' ;
+ELIPSES : '...' ;
+ASSIGNMENT : '=' ;
+TYPE_ASSIGNMENT : ':=' ;
+LT : '<' ;
+GT : '>' ;
+OPENBRAC : '[' ;
+CLOSEBRAC : ']' ;
+LPAREN : '(' ;
+RPAREN : ')' ;
+LCURL : '{' ;
+RCURL : '}' ;
+TERM : ';' ;
+POINTER : '*' ;
+SIGN : '+' | '-' ;
+ARROW : '->' ;
+DOT : '.' ;
+fragment BACKSLASH : '\\' ;
+
+/* Helpers for integer literals */
+fragment DIGIT : '0'..'9' ;
+fragment OCT_DIGIT : '0'..'7' ;
+fragment OCT_PREFIX : '0' ;
+fragment NONZERO_DIGIT : '1'..'9' ;
+fragment HEX_DIGIT : DIGIT | ('a'..'f') | ('A'..'F') ;
+fragment HEX_PREFIX : '0' ('x' | 'X') ;
+
+/*
+ * Integer literals
+ */
+OCTAL_LITERAL : OCT_PREFIX (OCT_DIGIT)+ INTEGER_TYPES_SUFFIX? ;
+DECIMAL_LITERAL : DIGIT+ INTEGER_TYPES_SUFFIX? ;
+HEX_LITERAL : HEX_PREFIX HEX_DIGIT+ INTEGER_TYPES_SUFFIX? ;
+
+/**
+ * Integer suffix for long, long long and unsigned.
+ *
+ * Matches all possible combination of L, LL and U.
+ */
+fragment INTEGER_TYPES_SUFFIX
+ : ('l' ('l')? | 'L' ('L')?) // l, ll
+ | ('u' | 'U') // u
+ | ('u' | 'U') ('l' ('l')? | 'L' ('L')?) // ul, ull
+ | ('l' ('l')? | 'L' ('L')?) ('u'| 'U') // lu, llu
+ ;
+
+/**
+ * Escape sequences
+ */
+fragment ESCAPE_SEQUENCE
+ : BACKSLASH ('\'' | '"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' )
+ | OCTAL_ESCAPE
+ | UNICODE_ESCAPE
+ | HEXADECIMAL_ESCAPE
+ ;
+
+/**
+ * Octal escape sequence
+ */
+fragment OCTAL_ESCAPE
+ : BACKSLASH ('0'..'3') ('0'..'7') ('0'..'7')
+ | BACKSLASH ('0'..'7') ('0'..'7')
+ | BACKSLASH ('0'..'7')
+ ;
+
+/**
+ * Hexadecimal escape sequence
+ */
+fragment HEXADECIMAL_ESCAPE : BACKSLASH 'x' HEX_DIGIT+ ;
+
+/**
+ * Unicode escape sequence
+ */
+fragment UNICODE_ESCAPE
+ : BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ | BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ ;
+
+
+/* Used in both character and string literal */
+fragment STRINGPREFIX : 'L';
+
+/*
+ * Character literal
+ */
+CHARACTER_LITERAL : STRINGPREFIX? SINGLEQUOTE CHAR_CONTENT+ SINGLEQUOTE ;
+fragment CHAR_CONTENT : (ESCAPE_SEQUENCE | ~(BACKSLASH | SINGLEQUOTE)) ;
+fragment SINGLEQUOTE : '\'';
+
+/*
+ * String literal
+ */
+STRING_LITERAL : STRINGPREFIX? DOUBLEQUOTE STRING_CONTENT* DOUBLEQUOTE ;
+fragment STRING_CONTENT : (ESCAPE_SEQUENCE | ~(BACKSLASH | DOUBLEQUOTE)) ;
+fragment DOUBLEQUOTE : '"' ;
+
+/**
+ * Whitespaces
+ */
+WS : (' ' | '\r' | '\t' | '\u000C' | '\n') { $channel = HIDDEN; } ;
+
+/**
+ * Multiline comment
+ */
+// About the greedy option: see page 100-101 of The Definitive ANTLR reference
+// COMMENT : '/*' ( options { greedy = false; } : . )* '*/' { $channel = HIDDEN; } ;
+COMMENT : COMMENT_OPEN .* COMMENT_CLOSE { $channel = HIDDEN; } ;
+fragment COMMENT_OPEN : '/*';
+fragment COMMENT_CLOSE : '*/';
+
+/**
+ * Single line comment
+ */
+LINE_COMMENT : '//' ~('\n')* '\n' { $channel = HIDDEN; } ;
+
+/**
+ * Identifiers
+ */
+IDENTIFIER : NONDIGIT (NONDIGIT | DIGIT)* ;
+fragment NONDIGIT : ('_') | ('A'..'Z') | ('a'..'z') ;
--- /dev/null
+parser grammar CTFParser;
+
+options {
+ language = Java;
+ output = AST;
+ ASTLabelType = CommonTree;
+ tokenVocab = CTFLexer;
+}
+
+tokens {
+ ROOT;
+
+ EVENT;
+ STREAM;
+ TRACE;
+ ENV;
+ CLOCK;
+ CALLSITE;
+
+ DECLARATION;
+ SV_DECLARATION;
+ TYPE_SPECIFIER_LIST;
+ TYPE_DECLARATOR_LIST;
+ TYPE_DECLARATOR;
+
+ STRUCT;
+ STRUCT_NAME;
+ STRUCT_BODY;
+ ALIGN;
+
+ CTF_EXPRESSION_TYPE;
+ CTF_EXPRESSION_VAL;
+ CTF_LEFT;
+ CTF_RIGHT;
+
+ UNARY_EXPRESSION_STRING;
+ UNARY_EXPRESSION_STRING_QUOTES;
+ UNARY_EXPRESSION_DEC;
+ UNARY_EXPRESSION_HEX;
+ UNARY_EXPRESSION_OCT;
+ LENGTH;
+
+ TYPEDEF;
+
+ TYPEALIAS;
+ TYPEALIAS_TARGET;
+ TYPEALIAS_ALIAS;
+
+ INTEGER;
+ STRING;
+ FLOATING_POINT;
+
+ ENUM;
+ ENUM_CONTAINER_TYPE;
+ ENUM_ENUMERATOR;
+ ENUM_NAME;
+ ENUM_VALUE;
+ ENUM_VALUE_RANGE;
+ ENUM_BODY;
+
+ VARIANT;
+ VARIANT_NAME;
+ VARIANT_TAG;
+ VARIANT_BODY;
+
+ DECLARATOR;
+ LENGTH;
+}
+
+/*
+ * Scope for the tracking of types.
+ * For now we just track the names (it's a simple Set), but
+ * later we will have to track the info about the target type.
+ */
+scope Symbols {
+ Set<String> types;
+}
+
+@header {
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Etienne Bergeron - Update to Antlr 3.5 syntax
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser;
+
+import java.util.Set;
+import java.util.HashSet;
+}
+
+@members {
+ public CTFParser(TokenStream input, boolean verbose) {
+ this(input);
+ this.verbose = verbose;
+ }
+
+ /**
+ * This method is overriden to disable automatic error recovery.
+ * On a mismatched token, it simply re-throw an exception.
+ */
+ @Override
+ protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
+ throw new MismatchedTokenException(ttype, input);
+ }
+
+ /**
+ * Checks if a given name has been defined has a type.
+ * From: http://www.antlr.org/grammar/1153358328744/C.g
+ *
+ * @param name The name to check.
+ * @return True if is is a type, false otherwise.
+ */
+ boolean isTypeName(String name) {
+ for (int i = Symbols_stack.size() - 1; i >= 0; i--) {
+ Symbols_scope scope = (Symbols_scope) Symbols_stack.get(i);
+ if (scope.types.contains(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void addTypeName(String name) {
+ $Symbols::types.add(name);
+ if (verbose) {
+ debug_print("New type: " + name);
+ }
+ }
+
+ boolean _inTypedef = false;
+
+ void typedefOn() {
+ debug_print("typedefOn");
+ _inTypedef = true;
+ }
+
+ void typedefOff() {
+ debug_print("typedefOff");
+ _inTypedef = false;
+ }
+
+ boolean inTypedef() {
+ return _inTypedef;
+ }
+
+ boolean _inTypealiasAlias = false;
+
+ void typealiasAliasOn() {
+ debug_print("typealiasAliasOn");
+ _inTypealiasAlias = true;
+ }
+
+ void typealiasAliasOff() {
+ debug_print("typealiasAliasOff");
+ _inTypealiasAlias = false;
+ }
+
+ boolean inTypealiasAlias() {
+ return _inTypealiasAlias;
+ }
+
+ void debug_print(String str) {
+ if (verbose) {
+ System.out.println(str);
+ }
+ }
+
+ /* Prints rule entry and exit while parsing */
+ boolean verbose = false;
+}
+
+ /*
+ * Override the catch clause to disable automatic error recovery.
+ * By default, the catch block of every rule simple rethrows the error.
+ */
+@rulecatch {
+ catch (RecognitionException e) {
+ throw e;
+ }
+}
+
+/* The top-level rule. */
+parse
+scope Symbols;
+@init {
+ $Symbols::types = new HashSet<String>();
+}
+ : declaration+ EOF -> ^(ROOT declaration+)
+ ;
+
+numberLiteral
+ : SIGN*
+ ( HEX_LITERAL -> ^(UNARY_EXPRESSION_HEX HEX_LITERAL SIGN*)
+ | DECIMAL_LITERAL -> ^(UNARY_EXPRESSION_DEC DECIMAL_LITERAL SIGN*)
+ | OCTAL_LITERAL -> ^(UNARY_EXPRESSION_OCT OCTAL_LITERAL SIGN*)
+ )
+ ;
+
+primaryExpression
+ : (IDENTIFIER) => IDENTIFIER
+ -> ^(UNARY_EXPRESSION_STRING IDENTIFIER)
+ | (ctfKeyword) => ctfKeyword -> ^(UNARY_EXPRESSION_STRING ctfKeyword)
+ | (STRING_LITERAL) => STRING_LITERAL
+ -> ^(UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL)
+ /*| (LPAREN unaryExpression RPAREN)*/ // Not supported yet
+ | numberLiteral
+ | enumConstant
+ | CHARACTER_LITERAL
+ ;
+
+postfixExpressionSuffix
+ : OPENBRAC unaryExpression CLOSEBRAC!
+ | (ref=DOT | ref=ARROW) IDENTIFIER
+ -> ^($ref ^(UNARY_EXPRESSION_STRING IDENTIFIER))
+ ;
+
+postfixExpression
+ : primaryExpression postfixExpressionSuffix*
+ | ctfSpecifierHead postfixExpressionSuffix+ // added for ctf-v1.8
+ ;
+
+unaryExpression
+ : postfixExpression
+ /* | ((SIGN postfixExpression[true]) | postfixExpression[false]) */
+ ;
+
+enumConstant
+ : STRING_LITERAL -> ^(UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL)
+ | IDENTIFIER -> ^(UNARY_EXPRESSION_STRING IDENTIFIER)
+ | ctfKeyword -> ^(UNARY_EXPRESSION_STRING ctfKeyword)
+ ;
+
+// 2.2
+
+declaration
+@after {
+ if (inTypedef()) {
+ typedefOff();
+ }
+}
+ : declarationSpecifiers declaratorList? TERM
+ // When the declaration is completely parsed and was a typedef,
+ // we add the declarators to the symbol table.
+ -> {inTypedef()}?
+ ^(DECLARATION ^(TYPEDEF declaratorList declarationSpecifiers))
+ -> ^(DECLARATION declarationSpecifiers declaratorList?)
+ | ctfSpecifier TERM!
+ ;
+
+declarationSpecifiers
+ : (
+ // We don't want to keep the typedef keyword in the specifier list.
+ // Instead, we keep track that we encountered a typedef in the declaration.
+ storageClassSpecifier
+ | typeQualifier
+ | typeSpecifier
+ )+ -> ^(TYPE_SPECIFIER_LIST typeQualifier* typeSpecifier*)
+ ;
+
+declaratorList
+ : declarator (SEPARATOR declarator)*
+ -> ^(TYPE_DECLARATOR_LIST declarator+)
+ ;
+
+abstractDeclaratorList
+ : abstractDeclarator (SEPARATOR abstractDeclarator)*
+ -> ^(TYPE_DECLARATOR_LIST abstractDeclarator+)
+ ;
+
+storageClassSpecifier
+ : TYPEDEFTOK { typedefOn(); }
+ ;
+
+typeSpecifier
+ : FLOATTOK
+ | INTTOK
+ | LONGTOK
+ | SHORTTOK
+ | SIGNEDTOK
+ | UNSIGNEDTOK
+ | CHARTOK
+ | DOUBLETOK
+ | VOIDTOK
+ | BOOLTOK
+ | COMPLEXTOK
+ | IMAGINARYTOK
+ | structSpecifier
+ | variantSpecifier
+ | enumSpecifier
+ | ctfTypeSpecifier
+ | { inTypealiasAlias() || isTypeName(input.LT(1).getText()) }? => typedefName
+ ;
+
+typeQualifier
+ : CONSTTOK
+ ;
+
+alignAttribute
+ : ALIGNTOK LPAREN unaryExpression RPAREN -> ^(ALIGN unaryExpression)
+ ;
+
+ // you can have an empty struct but not an empty variant
+structBody
+scope Symbols;
+@init {
+ $Symbols::types = new HashSet<String>();
+}
+ : LCURL structOrVariantDeclarationList? RCURL
+ -> ^(STRUCT_BODY structOrVariantDeclarationList?)
+ ;
+
+structSpecifier
+ : STRUCTTOK
+ (
+ // We have an IDENTIFIER after 'struct'
+ (
+ structName
+ (
+ alignAttribute
+ |
+ (
+ structBody
+ ( /* structBody can return an empty tree, so we need those ? */
+ alignAttribute
+ |
+ /* empty */
+ )
+ )
+ |
+ /* empty */
+ )
+ )
+ |
+ // We have a body after 'struct'
+ (
+ structBody
+ (
+ alignAttribute
+ |
+ /* empty */
+ )
+ )
+ ) -> ^(STRUCT structName? structBody? alignAttribute?)
+ ;
+
+structName
+ : IDENTIFIER -> ^(STRUCT_NAME IDENTIFIER)
+ ;
+
+structOrVariantDeclarationList
+ : structOrVariantDeclaration+
+ ;
+
+structOrVariantDeclaration
+ :
+ (
+ (
+ declarationSpecifiers
+ (
+ /* If we met a "typedef" */
+ {inTypedef()}? => declaratorList {typedefOff();}
+ -> ^(TYPEDEF declaratorList declarationSpecifiers)
+ | structOrVariantDeclaratorList
+ -> ^(SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList)
+ )
+ )
+ |
+ // Lines 3 and 4
+ typealiasDecl -> typealiasDecl
+ )
+ TERM
+ ;
+
+specifierQualifierList
+ : (typeQualifier | typeSpecifier)+
+ -> ^(TYPE_SPECIFIER_LIST typeQualifier* typeSpecifier*)
+ ;
+
+structOrVariantDeclaratorList
+ : structOrVariantDeclarator (SEPARATOR structOrVariantDeclarator)*
+ -> ^(TYPE_DECLARATOR_LIST structOrVariantDeclarator+)
+ ;
+
+structOrVariantDeclarator
+ :
+ /* Bitfields not supported yet */
+ (declarator (COLON numberLiteral)?) -> declarator
+ /*| (COLON numberLiteral)*/
+ ;
+
+variantSpecifier
+ : VARIANTTOK
+ (
+ (
+ variantName
+ (
+ (
+ variantTag
+ (
+ variantBody
+ |
+ /* empty */
+ )
+ )
+ |
+ variantBody
+ )
+ )
+ | (variantTag variantBody)
+ | variantBody
+ ) -> ^(VARIANT variantName? variantTag? variantBody?)
+ ;
+
+variantName
+ : IDENTIFIER -> ^(VARIANT_NAME IDENTIFIER)
+ ;
+
+variantBody
+scope Symbols;
+@init {
+ $Symbols::types = new HashSet<String>();
+}
+ : LCURL structOrVariantDeclarationList RCURL
+ -> ^(VARIANT_BODY structOrVariantDeclarationList)
+ ;
+
+variantTag
+ : LT IDENTIFIER GT -> ^(VARIANT_TAG IDENTIFIER)
+ ;
+
+enumSpecifier
+ : ENUMTOK
+ (
+ // Lines 1 to 5, when we have "ENUMTOK IDENTIFIER".
+ (
+ enumName
+ (
+ enumContainerType enumBody
+ |
+ enumBody
+ |
+ // no enumDeclarator or enumBodym
+ )
+ )
+ |
+ // Lines 1, 2, 4, 5, when we have no IDENTIFIER.
+ (
+ enumContainerType enumBody
+ |
+ enumBody
+ )
+ ) -> ^(ENUM enumName? enumContainerType? enumBody?)
+ ;
+
+enumName
+ : IDENTIFIER -> ^(ENUM_NAME IDENTIFIER)
+ ;
+
+enumBody
+ : LCURL enumeratorList SEPARATOR? RCURL -> ^(ENUM_BODY enumeratorList)
+ ;
+
+enumContainerType
+ : COLON declarationSpecifiers -> ^(ENUM_CONTAINER_TYPE declarationSpecifiers)
+ ;
+
+enumeratorList
+ : enumerator (SEPARATOR enumerator)* -> (^(ENUM_ENUMERATOR enumerator))+
+ ;
+
+enumerator
+ : enumConstant enumeratorValue?
+ ;
+
+enumeratorValue
+ : ASSIGNMENT e1=unaryExpression
+ ( /* empty */
+ -> ^(ENUM_VALUE $e1)
+ | ELIPSES e2=unaryExpression
+ -> ^(ENUM_VALUE_RANGE $e1 $e2)
+ )
+ ;
+
+declarator
+ : pointer* directDeclarator
+ -> ^(TYPE_DECLARATOR pointer* directDeclarator)
+ ;
+
+directDeclarator
+ : (
+ IDENTIFIER
+ { if (inTypedef()) addTypeName($IDENTIFIER.text); }
+ { debug_print($IDENTIFIER.text); }
+ /*| LPAREN declarator RPAREN*/ /* Not supported yet */
+ )
+ directDeclaratorSuffix*
+ ;
+
+directDeclaratorSuffix
+ : OPENBRAC directDeclaratorLength CLOSEBRAC
+ -> ^(LENGTH directDeclaratorLength)
+ ;
+
+directDeclaratorLength
+ : unaryExpression
+ ;
+
+abstractDeclarator
+ : pointer+ directAbstractDeclarator?
+ -> ^(TYPE_DECLARATOR pointer+ directAbstractDeclarator?)
+ | directAbstractDeclarator
+ -> ^(TYPE_DECLARATOR directAbstractDeclarator)
+ ;
+
+/**
+ * In the CTF grammar, direct-abstract-declarator can be empty (because of
+ * identifier-opt). We take care of that by appending a '?' to each use of
+ * "abstractDeclaratorList".
+ */
+directAbstractDeclarator
+ : (
+ IDENTIFIER
+ | (LPAREN abstractDeclarator RPAREN)
+ ) (
+ OPENBRAC unaryExpression? CLOSEBRAC
+ )?
+ ;
+
+pointer
+ : POINTER typeQualifierList? -> ^(POINTER typeQualifierList?)
+ ;
+
+typeQualifierList
+ : typeQualifier+
+ ;
+
+typedefName
+ : {inTypealiasAlias() || isTypeName(input.LT(1).getText())}? IDENTIFIER { if ((inTypedef() || inTypealiasAlias()) && !isTypeName($IDENTIFIER.text)) { addTypeName($IDENTIFIER.text); } }
+ ;
+
+/**
+ * What goes in the target part of a typealias.
+ *
+ * For example, the integer part in:
+ * typealias integer {...} := my_new_integer;
+ */
+typealiasTarget
+ : declarationSpecifiers abstractDeclaratorList?
+ ;
+
+/**
+ * What goes in the alias part of a typealias.
+ *
+ * For example, the my_new_integer part in:
+ * typealias integer {...} := my_new_integer;
+ */
+typealiasAlias
+@init {
+ typealiasAliasOn();
+}
+@after {
+ typealiasAliasOff();
+}
+ : abstractDeclaratorList
+ | declarationSpecifiers abstractDeclaratorList?
+ ;
+
+typealiasDecl
+ : TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias
+ -> ^(TYPEALIAS
+ ^(TYPEALIAS_TARGET typealiasTarget)
+ ^(TYPEALIAS_ALIAS typealiasAlias))
+ ;
+
+// 2.3 CTF stuff
+
+// TODO: Ajouter ceux qui manquent
+ctfKeyword
+ : ALIGNTOK
+ | EVENTTOK
+ | SIGNEDTOK
+ | STRINGTOK
+ ;
+
+ctfSpecifier
+ // event {...}, stream {...}, trace {...}
+ : ctfSpecifierHead ctfBody -> ^(ctfSpecifierHead ctfBody)
+ // typealias
+ | typealiasDecl -> ^(DECLARATION typealiasDecl)
+ ;
+
+ctfSpecifierHead
+ : EVENTTOK -> EVENT
+ | STREAMTOK -> STREAM
+ | TRACETOK -> TRACE
+ | ENVTOK -> ENV
+ | CLOCKTOK -> CLOCK
+ | CALLSITETOK -> CALLSITE
+ ;
+
+ctfTypeSpecifier
+ /* ctfBody can return an empty tree if the body is empty */
+ : FLOATINGPOINTTOK ctfBody -> ^(FLOATING_POINT ctfBody?)
+ | INTEGERTOK ctfBody -> ^(INTEGER ctfBody?)
+ | STRINGTOK ctfBody? -> ^(STRING ctfBody?)
+ ;
+
+ctfBody
+scope Symbols;
+@init {
+ $Symbols::types = new HashSet<String>();
+}
+ : LCURL ctfAssignmentExpressionList? RCURL -> ctfAssignmentExpressionList?
+ ;
+
+ctfAssignmentExpressionList
+ : (ctfAssignmentExpression TERM!)+
+ ;
+
+ctfAssignmentExpression
+@after {
+ if (inTypedef()) {
+ typedefOff();
+ }
+}
+ : left=unaryExpression
+ ( assignment=ASSIGNMENT right1=unaryExpression
+ -> ^(CTF_EXPRESSION_VAL
+ ^(CTF_LEFT $left)
+ ^(CTF_RIGHT $right1))
+ | type_assignment=TYPE_ASSIGNMENT right2=typeSpecifier
+ -> ^(CTF_EXPRESSION_TYPE
+ ^(CTF_LEFT $left)
+ ^(CTF_RIGHT ^(TYPE_SPECIFIER_LIST $right2)))
+ )
+ | (declarationSpecifiers {inTypedef()}? declaratorList)
+ -> ^(TYPEDEF declaratorList declarationSpecifiers)
+ | typealiasDecl
+ ;
--- /dev/null
+// $ANTLR 3.5.2 org/eclipse/tracecompass/ctf/parser/CTFLexer.g 2014-10-20 18:17:49
+
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Etienne Bergeron - Update to Antlr 3.5 syntax
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+
+@SuppressWarnings("all")
+public class CTFLexer extends Lexer {
+ public static final int EOF=-1;
+ public static final int ALIGNTOK=4;
+ public static final int ARROW=5;
+ public static final int ASSIGNMENT=6;
+ public static final int BACKSLASH=7;
+ public static final int BOOLTOK=8;
+ public static final int CALLSITETOK=9;
+ public static final int CHARACTER_LITERAL=10;
+ public static final int CHARTOK=11;
+ public static final int CHAR_CONTENT=12;
+ public static final int CLOCKTOK=13;
+ public static final int CLOSEBRAC=14;
+ public static final int COLON=15;
+ public static final int COMMENT=16;
+ public static final int COMMENT_CLOSE=17;
+ public static final int COMMENT_OPEN=18;
+ public static final int COMPLEXTOK=19;
+ public static final int CONSTTOK=20;
+ public static final int DECIMAL_LITERAL=21;
+ public static final int DIGIT=22;
+ public static final int DOT=23;
+ public static final int DOUBLEQUOTE=24;
+ public static final int DOUBLETOK=25;
+ public static final int ELIPSES=26;
+ public static final int ENUMTOK=27;
+ public static final int ENVTOK=28;
+ public static final int ESCAPE_SEQUENCE=29;
+ public static final int EVENTTOK=30;
+ public static final int FLOATINGPOINTTOK=31;
+ public static final int FLOATTOK=32;
+ public static final int GT=33;
+ public static final int HEXADECIMAL_ESCAPE=34;
+ public static final int HEX_DIGIT=35;
+ public static final int HEX_LITERAL=36;
+ public static final int HEX_PREFIX=37;
+ public static final int IDENTIFIER=38;
+ public static final int IMAGINARYTOK=39;
+ public static final int INFINITYTOK=40;
+ public static final int INTEGERTOK=41;
+ public static final int INTEGER_TYPES_SUFFIX=42;
+ public static final int INTTOK=43;
+ public static final int LCURL=44;
+ public static final int LINE_COMMENT=45;
+ public static final int LONGTOK=46;
+ public static final int LPAREN=47;
+ public static final int LT=48;
+ public static final int NANNUMBERTOK=49;
+ public static final int NINFINITYTOK=50;
+ public static final int NONDIGIT=51;
+ public static final int NONZERO_DIGIT=52;
+ public static final int OCTAL_ESCAPE=53;
+ public static final int OCTAL_LITERAL=54;
+ public static final int OCT_DIGIT=55;
+ public static final int OCT_PREFIX=56;
+ public static final int OPENBRAC=57;
+ public static final int POINTER=58;
+ public static final int RCURL=59;
+ public static final int RPAREN=60;
+ public static final int SEPARATOR=61;
+ public static final int SHORTTOK=62;
+ public static final int SIGN=63;
+ public static final int SIGNEDTOK=64;
+ public static final int SINGLEQUOTE=65;
+ public static final int STREAMTOK=66;
+ public static final int STRINGPREFIX=67;
+ public static final int STRINGTOK=68;
+ public static final int STRING_CONTENT=69;
+ public static final int STRING_LITERAL=70;
+ public static final int STRUCTTOK=71;
+ public static final int TERM=72;
+ public static final int TRACETOK=73;
+ public static final int TYPEALIASTOK=74;
+ public static final int TYPEDEFTOK=75;
+ public static final int TYPE_ASSIGNMENT=76;
+ public static final int UNICODE_ESCAPE=77;
+ public static final int UNSIGNEDTOK=78;
+ public static final int VARIANTTOK=79;
+ public static final int VOIDTOK=80;
+ public static final int WS=81;
+
+ // delegates
+ // delegators
+ public Lexer[] getDelegates() {
+ return new Lexer[] {};
+ }
+
+ public CTFLexer() {}
+ public CTFLexer(CharStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public CTFLexer(CharStream input, RecognizerSharedState state) {
+ super(input,state);
+ }
+ @Override public String getGrammarFileName() { return "org/eclipse/tracecompass/ctf/parser/CTFLexer.g"; }
+
+ // $ANTLR start "ALIGNTOK"
+ public final void mALIGNTOK() throws RecognitionException {
+ try {
+ int _type = ALIGNTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:32:18: ( 'align' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:32:20: 'align'
+ {
+ match("align");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ALIGNTOK"
+
+ // $ANTLR start "CONSTTOK"
+ public final void mCONSTTOK() throws RecognitionException {
+ try {
+ int _type = CONSTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:33:18: ( 'const' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:33:20: 'const'
+ {
+ match("const");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CONSTTOK"
+
+ // $ANTLR start "CHARTOK"
+ public final void mCHARTOK() throws RecognitionException {
+ try {
+ int _type = CHARTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:34:18: ( 'char' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:34:20: 'char'
+ {
+ match("char");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CHARTOK"
+
+ // $ANTLR start "DOUBLETOK"
+ public final void mDOUBLETOK() throws RecognitionException {
+ try {
+ int _type = DOUBLETOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:35:18: ( 'double' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:35:20: 'double'
+ {
+ match("double");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DOUBLETOK"
+
+ // $ANTLR start "ENUMTOK"
+ public final void mENUMTOK() throws RecognitionException {
+ try {
+ int _type = ENUMTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:36:18: ( 'enum' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:36:20: 'enum'
+ {
+ match("enum");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ENUMTOK"
+
+ // $ANTLR start "EVENTTOK"
+ public final void mEVENTTOK() throws RecognitionException {
+ try {
+ int _type = EVENTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:37:18: ( 'event' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:37:20: 'event'
+ {
+ match("event");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "EVENTTOK"
+
+ // $ANTLR start "FLOATINGPOINTTOK"
+ public final void mFLOATINGPOINTTOK() throws RecognitionException {
+ try {
+ int _type = FLOATINGPOINTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:38:18: ( 'floating_point' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:38:20: 'floating_point'
+ {
+ match("floating_point");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "FLOATINGPOINTTOK"
+
+ // $ANTLR start "FLOATTOK"
+ public final void mFLOATTOK() throws RecognitionException {
+ try {
+ int _type = FLOATTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:39:18: ( 'float' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:39:20: 'float'
+ {
+ match("float");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "FLOATTOK"
+
+ // $ANTLR start "INTEGERTOK"
+ public final void mINTEGERTOK() throws RecognitionException {
+ try {
+ int _type = INTEGERTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:40:18: ( 'integer' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:40:20: 'integer'
+ {
+ match("integer");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INTEGERTOK"
+
+ // $ANTLR start "INTTOK"
+ public final void mINTTOK() throws RecognitionException {
+ try {
+ int _type = INTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:41:18: ( 'int' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:41:20: 'int'
+ {
+ match("int");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INTTOK"
+
+ // $ANTLR start "LONGTOK"
+ public final void mLONGTOK() throws RecognitionException {
+ try {
+ int _type = LONGTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:42:18: ( 'long' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:42:20: 'long'
+ {
+ match("long");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LONGTOK"
+
+ // $ANTLR start "SHORTTOK"
+ public final void mSHORTTOK() throws RecognitionException {
+ try {
+ int _type = SHORTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:43:18: ( 'short' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:43:20: 'short'
+ {
+ match("short");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "SHORTTOK"
+
+ // $ANTLR start "SIGNEDTOK"
+ public final void mSIGNEDTOK() throws RecognitionException {
+ try {
+ int _type = SIGNEDTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:44:18: ( 'signed' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:44:20: 'signed'
+ {
+ match("signed");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "SIGNEDTOK"
+
+ // $ANTLR start "STREAMTOK"
+ public final void mSTREAMTOK() throws RecognitionException {
+ try {
+ int _type = STREAMTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:45:18: ( 'stream' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:45:20: 'stream'
+ {
+ match("stream");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STREAMTOK"
+
+ // $ANTLR start "STRINGTOK"
+ public final void mSTRINGTOK() throws RecognitionException {
+ try {
+ int _type = STRINGTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:46:18: ( 'string' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:46:20: 'string'
+ {
+ match("string");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRINGTOK"
+
+ // $ANTLR start "STRUCTTOK"
+ public final void mSTRUCTTOK() throws RecognitionException {
+ try {
+ int _type = STRUCTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:47:18: ( 'struct' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:47:20: 'struct'
+ {
+ match("struct");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRUCTTOK"
+
+ // $ANTLR start "TRACETOK"
+ public final void mTRACETOK() throws RecognitionException {
+ try {
+ int _type = TRACETOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:48:18: ( 'trace' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:48:20: 'trace'
+ {
+ match("trace");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "TRACETOK"
+
+ // $ANTLR start "TYPEALIASTOK"
+ public final void mTYPEALIASTOK() throws RecognitionException {
+ try {
+ int _type = TYPEALIASTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:49:18: ( 'typealias' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:49:20: 'typealias'
+ {
+ match("typealias");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "TYPEALIASTOK"
+
+ // $ANTLR start "TYPEDEFTOK"
+ public final void mTYPEDEFTOK() throws RecognitionException {
+ try {
+ int _type = TYPEDEFTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:50:18: ( 'typedef' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:50:20: 'typedef'
+ {
+ match("typedef");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "TYPEDEFTOK"
+
+ // $ANTLR start "UNSIGNEDTOK"
+ public final void mUNSIGNEDTOK() throws RecognitionException {
+ try {
+ int _type = UNSIGNEDTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:51:18: ( 'unsigned' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:51:20: 'unsigned'
+ {
+ match("unsigned");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UNSIGNEDTOK"
+
+ // $ANTLR start "VARIANTTOK"
+ public final void mVARIANTTOK() throws RecognitionException {
+ try {
+ int _type = VARIANTTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:52:18: ( 'variant' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:52:20: 'variant'
+ {
+ match("variant");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "VARIANTTOK"
+
+ // $ANTLR start "VOIDTOK"
+ public final void mVOIDTOK() throws RecognitionException {
+ try {
+ int _type = VOIDTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:53:18: ( 'void' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:53:20: 'void'
+ {
+ match("void");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "VOIDTOK"
+
+ // $ANTLR start "BOOLTOK"
+ public final void mBOOLTOK() throws RecognitionException {
+ try {
+ int _type = BOOLTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:18: ( '_Bool' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:20: '_Bool'
+ {
+ match("_Bool");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "BOOLTOK"
+
+ // $ANTLR start "COMPLEXTOK"
+ public final void mCOMPLEXTOK() throws RecognitionException {
+ try {
+ int _type = COMPLEXTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:55:18: ( '_Complex' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:55:20: '_Complex'
+ {
+ match("_Complex");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COMPLEXTOK"
+
+ // $ANTLR start "IMAGINARYTOK"
+ public final void mIMAGINARYTOK() throws RecognitionException {
+ try {
+ int _type = IMAGINARYTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:56:18: ( '_Imaginary' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:56:20: '_Imaginary'
+ {
+ match("_Imaginary");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "IMAGINARYTOK"
+
+ // $ANTLR start "ENVTOK"
+ public final void mENVTOK() throws RecognitionException {
+ try {
+ int _type = ENVTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:57:18: ( 'env' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:57:20: 'env'
+ {
+ match("env");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ENVTOK"
+
+ // $ANTLR start "CLOCKTOK"
+ public final void mCLOCKTOK() throws RecognitionException {
+ try {
+ int _type = CLOCKTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:58:18: ( 'clock' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:58:20: 'clock'
+ {
+ match("clock");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CLOCKTOK"
+
+ // $ANTLR start "CALLSITETOK"
+ public final void mCALLSITETOK() throws RecognitionException {
+ try {
+ int _type = CALLSITETOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:62:18: ( 'callsite' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:62:20: 'callsite'
+ {
+ match("callsite");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CALLSITETOK"
+
+ // $ANTLR start "NANNUMBERTOK"
+ public final void mNANNUMBERTOK() throws RecognitionException {
+ try {
+ int _type = NANNUMBERTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:69:15: ( 'NaN' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:69:17: 'NaN'
+ {
+ match("NaN");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "NANNUMBERTOK"
+
+ // $ANTLR start "INFINITYTOK"
+ public final void mINFINITYTOK() throws RecognitionException {
+ try {
+ int _type = INFINITYTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:70:15: ( '+inf' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:70:17: '+inf'
+ {
+ match("+inf");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INFINITYTOK"
+
+ // $ANTLR start "NINFINITYTOK"
+ public final void mNINFINITYTOK() throws RecognitionException {
+ try {
+ int _type = NINFINITYTOK;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:71:15: ( '-inf' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:71:17: '-inf'
+ {
+ match("-inf");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "NINFINITYTOK"
+
+ // $ANTLR start "SEPARATOR"
+ public final void mSEPARATOR() throws RecognitionException {
+ try {
+ int _type = SEPARATOR;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:76:20: ( ',' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:76:22: ','
+ {
+ match(',');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "SEPARATOR"
+
+ // $ANTLR start "COLON"
+ public final void mCOLON() throws RecognitionException {
+ try {
+ int _type = COLON;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:77:20: ( ':' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:77:22: ':'
+ {
+ match(':');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COLON"
+
+ // $ANTLR start "ELIPSES"
+ public final void mELIPSES() throws RecognitionException {
+ try {
+ int _type = ELIPSES;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:78:20: ( '...' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:78:22: '...'
+ {
+ match("...");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ELIPSES"
+
+ // $ANTLR start "ASSIGNMENT"
+ public final void mASSIGNMENT() throws RecognitionException {
+ try {
+ int _type = ASSIGNMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:79:20: ( '=' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:79:22: '='
+ {
+ match('=');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ASSIGNMENT"
+
+ // $ANTLR start "TYPE_ASSIGNMENT"
+ public final void mTYPE_ASSIGNMENT() throws RecognitionException {
+ try {
+ int _type = TYPE_ASSIGNMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:80:20: ( ':=' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:80:22: ':='
+ {
+ match(":=");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "TYPE_ASSIGNMENT"
+
+ // $ANTLR start "LT"
+ public final void mLT() throws RecognitionException {
+ try {
+ int _type = LT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:81:20: ( '<' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:81:22: '<'
+ {
+ match('<');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LT"
+
+ // $ANTLR start "GT"
+ public final void mGT() throws RecognitionException {
+ try {
+ int _type = GT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:82:20: ( '>' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:82:22: '>'
+ {
+ match('>');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "GT"
+
+ // $ANTLR start "OPENBRAC"
+ public final void mOPENBRAC() throws RecognitionException {
+ try {
+ int _type = OPENBRAC;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:83:20: ( '[' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:83:22: '['
+ {
+ match('[');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OPENBRAC"
+
+ // $ANTLR start "CLOSEBRAC"
+ public final void mCLOSEBRAC() throws RecognitionException {
+ try {
+ int _type = CLOSEBRAC;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:84:20: ( ']' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:84:22: ']'
+ {
+ match(']');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CLOSEBRAC"
+
+ // $ANTLR start "LPAREN"
+ public final void mLPAREN() throws RecognitionException {
+ try {
+ int _type = LPAREN;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:85:20: ( '(' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:85:22: '('
+ {
+ match('(');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LPAREN"
+
+ // $ANTLR start "RPAREN"
+ public final void mRPAREN() throws RecognitionException {
+ try {
+ int _type = RPAREN;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:86:20: ( ')' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:86:22: ')'
+ {
+ match(')');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "RPAREN"
+
+ // $ANTLR start "LCURL"
+ public final void mLCURL() throws RecognitionException {
+ try {
+ int _type = LCURL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:87:20: ( '{' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:87:22: '{'
+ {
+ match('{');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LCURL"
+
+ // $ANTLR start "RCURL"
+ public final void mRCURL() throws RecognitionException {
+ try {
+ int _type = RCURL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:88:20: ( '}' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:88:22: '}'
+ {
+ match('}');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "RCURL"
+
+ // $ANTLR start "TERM"
+ public final void mTERM() throws RecognitionException {
+ try {
+ int _type = TERM;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:89:20: ( ';' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:89:22: ';'
+ {
+ match(';');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "TERM"
+
+ // $ANTLR start "POINTER"
+ public final void mPOINTER() throws RecognitionException {
+ try {
+ int _type = POINTER;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:90:20: ( '*' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:90:22: '*'
+ {
+ match('*');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "POINTER"
+
+ // $ANTLR start "SIGN"
+ public final void mSIGN() throws RecognitionException {
+ try {
+ int _type = SIGN;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:91:20: ( '+' | '-' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "SIGN"
+
+ // $ANTLR start "ARROW"
+ public final void mARROW() throws RecognitionException {
+ try {
+ int _type = ARROW;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:92:20: ( '->' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:92:22: '->'
+ {
+ match("->");
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ARROW"
+
+ // $ANTLR start "DOT"
+ public final void mDOT() throws RecognitionException {
+ try {
+ int _type = DOT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:93:20: ( '.' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:93:22: '.'
+ {
+ match('.');
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DOT"
+
+ // $ANTLR start "BACKSLASH"
+ public final void mBACKSLASH() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:94:20: ( '\\\\' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:94:22: '\\\\'
+ {
+ match('\\');
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "BACKSLASH"
+
+ // $ANTLR start "DIGIT"
+ public final void mDIGIT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:97:16: ( '0' .. '9' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DIGIT"
+
+ // $ANTLR start "OCT_DIGIT"
+ public final void mOCT_DIGIT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:98:20: ( '0' .. '7' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OCT_DIGIT"
+
+ // $ANTLR start "OCT_PREFIX"
+ public final void mOCT_PREFIX() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:99:21: ( '0' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:99:23: '0'
+ {
+ match('0');
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OCT_PREFIX"
+
+ // $ANTLR start "NONZERO_DIGIT"
+ public final void mNONZERO_DIGIT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:100:24: ( '1' .. '9' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '1' && input.LA(1) <= '9') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "NONZERO_DIGIT"
+
+ // $ANTLR start "HEX_DIGIT"
+ public final void mHEX_DIGIT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:101:20: ( DIGIT | ( 'a' .. 'f' ) | ( 'A' .. 'F' ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "HEX_DIGIT"
+
+ // $ANTLR start "HEX_PREFIX"
+ public final void mHEX_PREFIX() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:102:21: ( '0' ( 'x' | 'X' ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:102:23: '0' ( 'x' | 'X' )
+ {
+ match('0');
+ if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "HEX_PREFIX"
+
+ // $ANTLR start "OCTAL_LITERAL"
+ public final void mOCTAL_LITERAL() throws RecognitionException {
+ try {
+ int _type = OCTAL_LITERAL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:15: ( OCT_PREFIX ( OCT_DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:17: OCT_PREFIX ( OCT_DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
+ {
+ mOCT_PREFIX();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:28: ( OCT_DIGIT )+
+ int cnt1=0;
+ loop1:
+ while (true) {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+ if ( ((LA1_0 >= '0' && LA1_0 <= '7')) ) {
+ alt1=1;
+ }
+
+ switch (alt1) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt1 >= 1 ) break loop1;
+ EarlyExitException eee = new EarlyExitException(1, input);
+ throw eee;
+ }
+ cnt1++;
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:41: ( INTEGER_TYPES_SUFFIX )?
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+ if ( (LA2_0=='L'||LA2_0=='U'||LA2_0=='l'||LA2_0=='u') ) {
+ alt2=1;
+ }
+ switch (alt2) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:41: INTEGER_TYPES_SUFFIX
+ {
+ mINTEGER_TYPES_SUFFIX();
+
+ }
+ break;
+
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OCTAL_LITERAL"
+
+ // $ANTLR start "DECIMAL_LITERAL"
+ public final void mDECIMAL_LITERAL() throws RecognitionException {
+ try {
+ int _type = DECIMAL_LITERAL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:17: ( ( DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:19: ( DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:19: ( DIGIT )+
+ int cnt3=0;
+ loop3:
+ while (true) {
+ int alt3=2;
+ int LA3_0 = input.LA(1);
+ if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
+ alt3=1;
+ }
+
+ switch (alt3) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt3 >= 1 ) break loop3;
+ EarlyExitException eee = new EarlyExitException(3, input);
+ throw eee;
+ }
+ cnt3++;
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:26: ( INTEGER_TYPES_SUFFIX )?
+ int alt4=2;
+ int LA4_0 = input.LA(1);
+ if ( (LA4_0=='L'||LA4_0=='U'||LA4_0=='l'||LA4_0=='u') ) {
+ alt4=1;
+ }
+ switch (alt4) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:26: INTEGER_TYPES_SUFFIX
+ {
+ mINTEGER_TYPES_SUFFIX();
+
+ }
+ break;
+
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DECIMAL_LITERAL"
+
+ // $ANTLR start "HEX_LITERAL"
+ public final void mHEX_LITERAL() throws RecognitionException {
+ try {
+ int _type = HEX_LITERAL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:13: ( HEX_PREFIX ( HEX_DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:15: HEX_PREFIX ( HEX_DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
+ {
+ mHEX_PREFIX();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:26: ( HEX_DIGIT )+
+ int cnt5=0;
+ loop5:
+ while (true) {
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+ if ( ((LA5_0 >= '0' && LA5_0 <= '9')||(LA5_0 >= 'A' && LA5_0 <= 'F')||(LA5_0 >= 'a' && LA5_0 <= 'f')) ) {
+ alt5=1;
+ }
+
+ switch (alt5) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt5 >= 1 ) break loop5;
+ EarlyExitException eee = new EarlyExitException(5, input);
+ throw eee;
+ }
+ cnt5++;
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:37: ( INTEGER_TYPES_SUFFIX )?
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+ if ( (LA6_0=='L'||LA6_0=='U'||LA6_0=='l'||LA6_0=='u') ) {
+ alt6=1;
+ }
+ switch (alt6) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:37: INTEGER_TYPES_SUFFIX
+ {
+ mINTEGER_TYPES_SUFFIX();
+
+ }
+ break;
+
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "HEX_LITERAL"
+
+ // $ANTLR start "INTEGER_TYPES_SUFFIX"
+ public final void mINTEGER_TYPES_SUFFIX() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:3: ( ( 'l' ( 'l' )? | 'L' ( 'L' )? ) | ( 'u' | 'U' ) | ( 'u' | 'U' ) ( 'l' ( 'l' )? | 'L' ( 'L' )? ) | ( 'l' ( 'l' )? | 'L' ( 'L' )? ) ( 'u' | 'U' ) )
+ int alt16=4;
+ switch ( input.LA(1) ) {
+ case 'l':
+ {
+ switch ( input.LA(2) ) {
+ case 'l':
+ {
+ int LA16_4 = input.LA(3);
+ if ( (LA16_4=='U'||LA16_4=='u') ) {
+ alt16=4;
+ }
+
+ else {
+ alt16=1;
+ }
+
+ }
+ break;
+ case 'U':
+ case 'u':
+ {
+ alt16=4;
+ }
+ break;
+ default:
+ alt16=1;
+ }
+ }
+ break;
+ case 'L':
+ {
+ switch ( input.LA(2) ) {
+ case 'L':
+ {
+ int LA16_7 = input.LA(3);
+ if ( (LA16_7=='U'||LA16_7=='u') ) {
+ alt16=4;
+ }
+
+ else {
+ alt16=1;
+ }
+
+ }
+ break;
+ case 'U':
+ case 'u':
+ {
+ alt16=4;
+ }
+ break;
+ default:
+ alt16=1;
+ }
+ }
+ break;
+ case 'U':
+ case 'u':
+ {
+ int LA16_3 = input.LA(2);
+ if ( (LA16_3=='L'||LA16_3=='l') ) {
+ alt16=3;
+ }
+
+ else {
+ alt16=2;
+ }
+
+ }
+ break;
+ default:
+ NoViableAltException nvae =
+ new NoViableAltException("", 16, 0, input);
+ throw nvae;
+ }
+ switch (alt16) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
+ int alt9=2;
+ int LA9_0 = input.LA(1);
+ if ( (LA9_0=='l') ) {
+ alt9=1;
+ }
+ else if ( (LA9_0=='L') ) {
+ alt9=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 9, 0, input);
+ throw nvae;
+ }
+
+ switch (alt9) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:6: 'l' ( 'l' )?
+ {
+ match('l');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:10: ( 'l' )?
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+ if ( (LA7_0=='l') ) {
+ alt7=1;
+ }
+ switch (alt7) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:11: 'l'
+ {
+ match('l');
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:19: 'L' ( 'L' )?
+ {
+ match('L');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:23: ( 'L' )?
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+ if ( (LA8_0=='L') ) {
+ alt8=1;
+ }
+ switch (alt8) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:24: 'L'
+ {
+ match('L');
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:118:5: ( 'u' | 'U' )
+ {
+ if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:5: ( 'u' | 'U' ) ( 'l' ( 'l' )? | 'L' ( 'L' )? )
+ {
+ if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:17: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+ if ( (LA12_0=='l') ) {
+ alt12=1;
+ }
+ else if ( (LA12_0=='L') ) {
+ alt12=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 12, 0, input);
+ throw nvae;
+ }
+
+ switch (alt12) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:18: 'l' ( 'l' )?
+ {
+ match('l');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:22: ( 'l' )?
+ int alt10=2;
+ int LA10_0 = input.LA(1);
+ if ( (LA10_0=='l') ) {
+ alt10=1;
+ }
+ switch (alt10) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:23: 'l'
+ {
+ match('l');
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:31: 'L' ( 'L' )?
+ {
+ match('L');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:35: ( 'L' )?
+ int alt11=2;
+ int LA11_0 = input.LA(1);
+ if ( (LA11_0=='L') ) {
+ alt11=1;
+ }
+ switch (alt11) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:36: 'L'
+ {
+ match('L');
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? ) ( 'u' | 'U' )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+ if ( (LA15_0=='l') ) {
+ alt15=1;
+ }
+ else if ( (LA15_0=='L') ) {
+ alt15=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 15, 0, input);
+ throw nvae;
+ }
+
+ switch (alt15) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:6: 'l' ( 'l' )?
+ {
+ match('l');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:10: ( 'l' )?
+ int alt13=2;
+ int LA13_0 = input.LA(1);
+ if ( (LA13_0=='l') ) {
+ alt13=1;
+ }
+ switch (alt13) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:11: 'l'
+ {
+ match('l');
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:19: 'L' ( 'L' )?
+ {
+ match('L');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:23: ( 'L' )?
+ int alt14=2;
+ int LA14_0 = input.LA(1);
+ if ( (LA14_0=='L') ) {
+ alt14=1;
+ }
+ switch (alt14) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:24: 'L'
+ {
+ match('L');
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+
+ if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "INTEGER_TYPES_SUFFIX"
+
+ // $ANTLR start "ESCAPE_SEQUENCE"
+ public final void mESCAPE_SEQUENCE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:127:3: ( BACKSLASH ( '\\'' | '\"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' ) | OCTAL_ESCAPE | UNICODE_ESCAPE | HEXADECIMAL_ESCAPE )
+ int alt17=4;
+ int LA17_0 = input.LA(1);
+ if ( (LA17_0=='\\') ) {
+ switch ( input.LA(2) ) {
+ case '\"':
+ case '\'':
+ case '?':
+ case '\\':
+ case 'a':
+ case 'b':
+ case 'f':
+ case 'n':
+ case 'r':
+ case 't':
+ case 'v':
+ {
+ alt17=1;
+ }
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ alt17=2;
+ }
+ break;
+ case 'U':
+ case 'u':
+ {
+ alt17=3;
+ }
+ break;
+ case 'x':
+ {
+ alt17=4;
+ }
+ break;
+ default:
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 17, 1, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 17, 0, input);
+ throw nvae;
+ }
+
+ switch (alt17) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:127:5: BACKSLASH ( '\\'' | '\"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' )
+ {
+ mBACKSLASH();
+
+ if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='?'||input.LA(1)=='\\'||(input.LA(1) >= 'a' && input.LA(1) <= 'b')||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t'||input.LA(1)=='v' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:128:5: OCTAL_ESCAPE
+ {
+ mOCTAL_ESCAPE();
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:129:5: UNICODE_ESCAPE
+ {
+ mUNICODE_ESCAPE();
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:130:5: HEXADECIMAL_ESCAPE
+ {
+ mHEXADECIMAL_ESCAPE();
+
+ }
+ break;
+
+ }
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "ESCAPE_SEQUENCE"
+
+ // $ANTLR start "OCTAL_ESCAPE"
+ public final void mOCTAL_ESCAPE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:137:3: ( BACKSLASH ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | BACKSLASH ( '0' .. '7' ) ( '0' .. '7' ) | BACKSLASH ( '0' .. '7' ) )
+ int alt18=3;
+ int LA18_0 = input.LA(1);
+ if ( (LA18_0=='\\') ) {
+ int LA18_1 = input.LA(2);
+ if ( ((LA18_1 >= '0' && LA18_1 <= '3')) ) {
+ int LA18_2 = input.LA(3);
+ if ( ((LA18_2 >= '0' && LA18_2 <= '7')) ) {
+ int LA18_4 = input.LA(4);
+ if ( ((LA18_4 >= '0' && LA18_4 <= '7')) ) {
+ alt18=1;
+ }
+
+ else {
+ alt18=2;
+ }
+
+ }
+
+ else {
+ alt18=3;
+ }
+
+ }
+ else if ( ((LA18_1 >= '4' && LA18_1 <= '7')) ) {
+ int LA18_3 = input.LA(3);
+ if ( ((LA18_3 >= '0' && LA18_3 <= '7')) ) {
+ alt18=2;
+ }
+
+ else {
+ alt18=3;
+ }
+
+ }
+
+ else {
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 18, 1, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 18, 0, input);
+ throw nvae;
+ }
+
+ switch (alt18) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:137:5: BACKSLASH ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
+ {
+ mBACKSLASH();
+
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '3') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:138:5: BACKSLASH ( '0' .. '7' ) ( '0' .. '7' )
+ {
+ mBACKSLASH();
+
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:139:5: BACKSLASH ( '0' .. '7' )
+ {
+ mBACKSLASH();
+
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "OCTAL_ESCAPE"
+
+ // $ANTLR start "HEXADECIMAL_ESCAPE"
+ public final void mHEXADECIMAL_ESCAPE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:29: ( BACKSLASH 'x' ( HEX_DIGIT )+ )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:31: BACKSLASH 'x' ( HEX_DIGIT )+
+ {
+ mBACKSLASH();
+
+ match('x');
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:45: ( HEX_DIGIT )+
+ int cnt19=0;
+ loop19:
+ while (true) {
+ int alt19=2;
+ int LA19_0 = input.LA(1);
+ if ( ((LA19_0 >= '0' && LA19_0 <= '9')||(LA19_0 >= 'A' && LA19_0 <= 'F')||(LA19_0 >= 'a' && LA19_0 <= 'f')) ) {
+ alt19=1;
+ }
+
+ switch (alt19) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ if ( cnt19 >= 1 ) break loop19;
+ EarlyExitException eee = new EarlyExitException(19, input);
+ throw eee;
+ }
+ cnt19++;
+ }
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "HEXADECIMAL_ESCAPE"
+
+ // $ANTLR start "UNICODE_ESCAPE"
+ public final void mUNICODE_ESCAPE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:151:3: ( BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT | BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
+ int alt20=2;
+ int LA20_0 = input.LA(1);
+ if ( (LA20_0=='\\') ) {
+ int LA20_1 = input.LA(2);
+ if ( (LA20_1=='u') ) {
+ alt20=1;
+ }
+ else if ( (LA20_1=='U') ) {
+ alt20=2;
+ }
+
+ else {
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 20, 1, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 20, 0, input);
+ throw nvae;
+ }
+
+ switch (alt20) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:151:5: BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ {
+ mBACKSLASH();
+
+ match('u');
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:152:5: BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
+ {
+ mBACKSLASH();
+
+ match('U');
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ mHEX_DIGIT();
+
+ }
+ break;
+
+ }
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "UNICODE_ESCAPE"
+
+ // $ANTLR start "STRINGPREFIX"
+ public final void mSTRINGPREFIX() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:157:23: ( 'L' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:157:25: 'L'
+ {
+ match('L');
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRINGPREFIX"
+
+ // $ANTLR start "CHARACTER_LITERAL"
+ public final void mCHARACTER_LITERAL() throws RecognitionException {
+ try {
+ int _type = CHARACTER_LITERAL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:19: ( ( STRINGPREFIX )? SINGLEQUOTE ( CHAR_CONTENT )+ SINGLEQUOTE )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:21: ( STRINGPREFIX )? SINGLEQUOTE ( CHAR_CONTENT )+ SINGLEQUOTE
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:21: ( STRINGPREFIX )?
+ int alt21=2;
+ int LA21_0 = input.LA(1);
+ if ( (LA21_0=='L') ) {
+ alt21=1;
+ }
+ switch (alt21) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( input.LA(1)=='L' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ mSINGLEQUOTE();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:47: ( CHAR_CONTENT )+
+ int cnt22=0;
+ loop22:
+ while (true) {
+ int alt22=2;
+ int LA22_0 = input.LA(1);
+ if ( ((LA22_0 >= '\u0000' && LA22_0 <= '&')||(LA22_0 >= '(' && LA22_0 <= '\uFFFF')) ) {
+ alt22=1;
+ }
+
+ switch (alt22) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:47: CHAR_CONTENT
+ {
+ mCHAR_CONTENT();
+
+ }
+ break;
+
+ default :
+ if ( cnt22 >= 1 ) break loop22;
+ EarlyExitException eee = new EarlyExitException(22, input);
+ throw eee;
+ }
+ cnt22++;
+ }
+
+ mSINGLEQUOTE();
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CHARACTER_LITERAL"
+
+ // $ANTLR start "CHAR_CONTENT"
+ public final void mCHAR_CONTENT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:23: ( ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:25: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:25: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) )
+ int alt23=2;
+ int LA23_0 = input.LA(1);
+ if ( (LA23_0=='\\') ) {
+ alt23=1;
+ }
+ else if ( ((LA23_0 >= '\u0000' && LA23_0 <= '&')||(LA23_0 >= '(' && LA23_0 <= '[')||(LA23_0 >= ']' && LA23_0 <= '\uFFFF')) ) {
+ alt23=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 23, 0, input);
+ throw nvae;
+ }
+
+ switch (alt23) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:26: ESCAPE_SEQUENCE
+ {
+ mESCAPE_SEQUENCE();
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:44: ~ ( BACKSLASH | SINGLEQUOTE )
+ {
+ if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&')||(input.LA(1) >= '(' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "CHAR_CONTENT"
+
+ // $ANTLR start "SINGLEQUOTE"
+ public final void mSINGLEQUOTE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:164:22: ( '\\'' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:164:24: '\\''
+ {
+ match('\'');
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "SINGLEQUOTE"
+
+ // $ANTLR start "STRING_LITERAL"
+ public final void mSTRING_LITERAL() throws RecognitionException {
+ try {
+ int _type = STRING_LITERAL;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:16: ( ( STRINGPREFIX )? DOUBLEQUOTE ( STRING_CONTENT )* DOUBLEQUOTE )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:18: ( STRINGPREFIX )? DOUBLEQUOTE ( STRING_CONTENT )* DOUBLEQUOTE
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:18: ( STRINGPREFIX )?
+ int alt24=2;
+ int LA24_0 = input.LA(1);
+ if ( (LA24_0=='L') ) {
+ alt24=1;
+ }
+ switch (alt24) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( input.LA(1)=='L' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ mDOUBLEQUOTE();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:44: ( STRING_CONTENT )*
+ loop25:
+ while (true) {
+ int alt25=2;
+ int LA25_0 = input.LA(1);
+ if ( ((LA25_0 >= '\u0000' && LA25_0 <= '!')||(LA25_0 >= '#' && LA25_0 <= '\uFFFF')) ) {
+ alt25=1;
+ }
+
+ switch (alt25) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:44: STRING_CONTENT
+ {
+ mSTRING_CONTENT();
+
+ }
+ break;
+
+ default :
+ break loop25;
+ }
+ }
+
+ mDOUBLEQUOTE();
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRING_LITERAL"
+
+ // $ANTLR start "STRING_CONTENT"
+ public final void mSTRING_CONTENT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:25: ( ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:27: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:27: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) )
+ int alt26=2;
+ int LA26_0 = input.LA(1);
+ if ( (LA26_0=='\\') ) {
+ alt26=1;
+ }
+ else if ( ((LA26_0 >= '\u0000' && LA26_0 <= '!')||(LA26_0 >= '#' && LA26_0 <= '[')||(LA26_0 >= ']' && LA26_0 <= '\uFFFF')) ) {
+ alt26=2;
+ }
+
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("", 26, 0, input);
+ throw nvae;
+ }
+
+ switch (alt26) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:28: ESCAPE_SEQUENCE
+ {
+ mESCAPE_SEQUENCE();
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:46: ~ ( BACKSLASH | DOUBLEQUOTE )
+ {
+ if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "STRING_CONTENT"
+
+ // $ANTLR start "DOUBLEQUOTE"
+ public final void mDOUBLEQUOTE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:171:22: ( '\"' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:171:24: '\"'
+ {
+ match('\"');
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "DOUBLEQUOTE"
+
+ // $ANTLR start "WS"
+ public final void mWS() throws RecognitionException {
+ try {
+ int _type = WS;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:176:4: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:176:6: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )
+ {
+ if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n')||(input.LA(1) >= '\f' && input.LA(1) <= '\r')||input.LA(1)==' ' ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ _channel = HIDDEN;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "WS"
+
+ // $ANTLR start "COMMENT"
+ public final void mCOMMENT() throws RecognitionException {
+ try {
+ int _type = COMMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:9: ( COMMENT_OPEN ( . )* COMMENT_CLOSE )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:11: COMMENT_OPEN ( . )* COMMENT_CLOSE
+ {
+ mCOMMENT_OPEN();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:24: ( . )*
+ loop27:
+ while (true) {
+ int alt27=2;
+ int LA27_0 = input.LA(1);
+ if ( (LA27_0=='*') ) {
+ int LA27_1 = input.LA(2);
+ if ( (LA27_1=='/') ) {
+ alt27=2;
+ }
+ else if ( ((LA27_1 >= '\u0000' && LA27_1 <= '.')||(LA27_1 >= '0' && LA27_1 <= '\uFFFF')) ) {
+ alt27=1;
+ }
+
+ }
+ else if ( ((LA27_0 >= '\u0000' && LA27_0 <= ')')||(LA27_0 >= '+' && LA27_0 <= '\uFFFF')) ) {
+ alt27=1;
+ }
+
+ switch (alt27) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:24: .
+ {
+ matchAny();
+ }
+ break;
+
+ default :
+ break loop27;
+ }
+ }
+
+ mCOMMENT_CLOSE();
+
+ _channel = HIDDEN;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COMMENT"
+
+ // $ANTLR start "COMMENT_OPEN"
+ public final void mCOMMENT_OPEN() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:184:23: ( '/*' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:184:25: '/*'
+ {
+ match("/*");
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COMMENT_OPEN"
+
+ // $ANTLR start "COMMENT_CLOSE"
+ public final void mCOMMENT_CLOSE() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:185:24: ( '*/' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:185:26: '*/'
+ {
+ match("*/");
+
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "COMMENT_CLOSE"
+
+ // $ANTLR start "LINE_COMMENT"
+ public final void mLINE_COMMENT() throws RecognitionException {
+ try {
+ int _type = LINE_COMMENT;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:14: ( '//' (~ ( '\\n' ) )* '\\n' )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:16: '//' (~ ( '\\n' ) )* '\\n'
+ {
+ match("//");
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:21: (~ ( '\\n' ) )*
+ loop28:
+ while (true) {
+ int alt28=2;
+ int LA28_0 = input.LA(1);
+ if ( ((LA28_0 >= '\u0000' && LA28_0 <= '\t')||(LA28_0 >= '\u000B' && LA28_0 <= '\uFFFF')) ) {
+ alt28=1;
+ }
+
+ switch (alt28) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '\t')||(input.LA(1) >= '\u000B' && input.LA(1) <= '\uFFFF') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop28;
+ }
+ }
+
+ match('\n');
+ _channel = HIDDEN;
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "LINE_COMMENT"
+
+ // $ANTLR start "IDENTIFIER"
+ public final void mIDENTIFIER() throws RecognitionException {
+ try {
+ int _type = IDENTIFIER;
+ int _channel = DEFAULT_TOKEN_CHANNEL;
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:12: ( NONDIGIT ( NONDIGIT | DIGIT )* )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:14: NONDIGIT ( NONDIGIT | DIGIT )*
+ {
+ mNONDIGIT();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:23: ( NONDIGIT | DIGIT )*
+ loop29:
+ while (true) {
+ int alt29=2;
+ int LA29_0 = input.LA(1);
+ if ( ((LA29_0 >= '0' && LA29_0 <= '9')||(LA29_0 >= 'A' && LA29_0 <= 'Z')||LA29_0=='_'||(LA29_0 >= 'a' && LA29_0 <= 'z')) ) {
+ alt29=1;
+ }
+
+ switch (alt29) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+ break;
+
+ default :
+ break loop29;
+ }
+ }
+
+ }
+
+ state.type = _type;
+ state.channel = _channel;
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "IDENTIFIER"
+
+ // $ANTLR start "NONDIGIT"
+ public final void mNONDIGIT() throws RecognitionException {
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:196:19: ( ( '_' ) | ( 'A' .. 'Z' ) | ( 'a' .. 'z' ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
+ {
+ if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
+ input.consume();
+ }
+ else {
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ recover(mse);
+ throw mse;
+ }
+ }
+
+ }
+ finally {
+ // do for sure before leaving
+ }
+ }
+ // $ANTLR end "NONDIGIT"
+
+ @Override
+ public void mTokens() throws RecognitionException {
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:8: ( ALIGNTOK | CONSTTOK | CHARTOK | DOUBLETOK | ENUMTOK | EVENTTOK | FLOATINGPOINTTOK | FLOATTOK | INTEGERTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | STREAMTOK | STRINGTOK | STRUCTTOK | TRACETOK | TYPEALIASTOK | TYPEDEFTOK | UNSIGNEDTOK | VARIANTTOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | ENVTOK | CLOCKTOK | CALLSITETOK | NANNUMBERTOK | INFINITYTOK | NINFINITYTOK | SEPARATOR | COLON | ELIPSES | ASSIGNMENT | TYPE_ASSIGNMENT | LT | GT | OPENBRAC | CLOSEBRAC | LPAREN | RPAREN | LCURL | RCURL | TERM | POINTER | SIGN | ARROW | DOT | OCTAL_LITERAL | DECIMAL_LITERAL | HEX_LITERAL | CHARACTER_LITERAL | STRING_LITERAL | WS | COMMENT | LINE_COMMENT | IDENTIFIER )
+ int alt30=58;
+ alt30 = dfa30.predict(input);
+ switch (alt30) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:10: ALIGNTOK
+ {
+ mALIGNTOK();
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:19: CONSTTOK
+ {
+ mCONSTTOK();
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:28: CHARTOK
+ {
+ mCHARTOK();
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:36: DOUBLETOK
+ {
+ mDOUBLETOK();
+
+ }
+ break;
+ case 5 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:46: ENUMTOK
+ {
+ mENUMTOK();
+
+ }
+ break;
+ case 6 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:54: EVENTTOK
+ {
+ mEVENTTOK();
+
+ }
+ break;
+ case 7 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:63: FLOATINGPOINTTOK
+ {
+ mFLOATINGPOINTTOK();
+
+ }
+ break;
+ case 8 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:80: FLOATTOK
+ {
+ mFLOATTOK();
+
+ }
+ break;
+ case 9 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:89: INTEGERTOK
+ {
+ mINTEGERTOK();
+
+ }
+ break;
+ case 10 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:100: INTTOK
+ {
+ mINTTOK();
+
+ }
+ break;
+ case 11 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:107: LONGTOK
+ {
+ mLONGTOK();
+
+ }
+ break;
+ case 12 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:115: SHORTTOK
+ {
+ mSHORTTOK();
+
+ }
+ break;
+ case 13 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:124: SIGNEDTOK
+ {
+ mSIGNEDTOK();
+
+ }
+ break;
+ case 14 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:134: STREAMTOK
+ {
+ mSTREAMTOK();
+
+ }
+ break;
+ case 15 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:144: STRINGTOK
+ {
+ mSTRINGTOK();
+
+ }
+ break;
+ case 16 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:154: STRUCTTOK
+ {
+ mSTRUCTTOK();
+
+ }
+ break;
+ case 17 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:164: TRACETOK
+ {
+ mTRACETOK();
+
+ }
+ break;
+ case 18 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:173: TYPEALIASTOK
+ {
+ mTYPEALIASTOK();
+
+ }
+ break;
+ case 19 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:186: TYPEDEFTOK
+ {
+ mTYPEDEFTOK();
+
+ }
+ break;
+ case 20 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:197: UNSIGNEDTOK
+ {
+ mUNSIGNEDTOK();
+
+ }
+ break;
+ case 21 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:209: VARIANTTOK
+ {
+ mVARIANTTOK();
+
+ }
+ break;
+ case 22 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:220: VOIDTOK
+ {
+ mVOIDTOK();
+
+ }
+ break;
+ case 23 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:228: BOOLTOK
+ {
+ mBOOLTOK();
+
+ }
+ break;
+ case 24 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:236: COMPLEXTOK
+ {
+ mCOMPLEXTOK();
+
+ }
+ break;
+ case 25 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:247: IMAGINARYTOK
+ {
+ mIMAGINARYTOK();
+
+ }
+ break;
+ case 26 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:260: ENVTOK
+ {
+ mENVTOK();
+
+ }
+ break;
+ case 27 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:267: CLOCKTOK
+ {
+ mCLOCKTOK();
+
+ }
+ break;
+ case 28 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:276: CALLSITETOK
+ {
+ mCALLSITETOK();
+
+ }
+ break;
+ case 29 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:288: NANNUMBERTOK
+ {
+ mNANNUMBERTOK();
+
+ }
+ break;
+ case 30 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:301: INFINITYTOK
+ {
+ mINFINITYTOK();
+
+ }
+ break;
+ case 31 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:313: NINFINITYTOK
+ {
+ mNINFINITYTOK();
+
+ }
+ break;
+ case 32 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:326: SEPARATOR
+ {
+ mSEPARATOR();
+
+ }
+ break;
+ case 33 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:336: COLON
+ {
+ mCOLON();
+
+ }
+ break;
+ case 34 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:342: ELIPSES
+ {
+ mELIPSES();
+
+ }
+ break;
+ case 35 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:350: ASSIGNMENT
+ {
+ mASSIGNMENT();
+
+ }
+ break;
+ case 36 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:361: TYPE_ASSIGNMENT
+ {
+ mTYPE_ASSIGNMENT();
+
+ }
+ break;
+ case 37 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:377: LT
+ {
+ mLT();
+
+ }
+ break;
+ case 38 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:380: GT
+ {
+ mGT();
+
+ }
+ break;
+ case 39 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:383: OPENBRAC
+ {
+ mOPENBRAC();
+
+ }
+ break;
+ case 40 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:392: CLOSEBRAC
+ {
+ mCLOSEBRAC();
+
+ }
+ break;
+ case 41 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:402: LPAREN
+ {
+ mLPAREN();
+
+ }
+ break;
+ case 42 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:409: RPAREN
+ {
+ mRPAREN();
+
+ }
+ break;
+ case 43 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:416: LCURL
+ {
+ mLCURL();
+
+ }
+ break;
+ case 44 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:422: RCURL
+ {
+ mRCURL();
+
+ }
+ break;
+ case 45 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:428: TERM
+ {
+ mTERM();
+
+ }
+ break;
+ case 46 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:433: POINTER
+ {
+ mPOINTER();
+
+ }
+ break;
+ case 47 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:441: SIGN
+ {
+ mSIGN();
+
+ }
+ break;
+ case 48 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:446: ARROW
+ {
+ mARROW();
+
+ }
+ break;
+ case 49 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:452: DOT
+ {
+ mDOT();
+
+ }
+ break;
+ case 50 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:456: OCTAL_LITERAL
+ {
+ mOCTAL_LITERAL();
+
+ }
+ break;
+ case 51 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:470: DECIMAL_LITERAL
+ {
+ mDECIMAL_LITERAL();
+
+ }
+ break;
+ case 52 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:486: HEX_LITERAL
+ {
+ mHEX_LITERAL();
+
+ }
+ break;
+ case 53 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:498: CHARACTER_LITERAL
+ {
+ mCHARACTER_LITERAL();
+
+ }
+ break;
+ case 54 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:516: STRING_LITERAL
+ {
+ mSTRING_LITERAL();
+
+ }
+ break;
+ case 55 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:531: WS
+ {
+ mWS();
+
+ }
+ break;
+ case 56 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:534: COMMENT
+ {
+ mCOMMENT();
+
+ }
+ break;
+ case 57 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:542: LINE_COMMENT
+ {
+ mLINE_COMMENT();
+
+ }
+ break;
+ case 58 :
+ // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:555: IDENTIFIER
+ {
+ mIDENTIFIER();
+
+ }
+ break;
+
+ }
+ }
+
+
+ protected DFA30 dfa30 = new DFA30(this);
+ static final String DFA30_eotS =
+ "\1\uffff\15\45\2\76\1\uffff\1\102\1\104\13\uffff\1\37\1\uffff\1\45\5\uffff"+
+ "\27\45\11\uffff\1\144\2\uffff\7\45\1\154\2\45\1\160\14\45\1\177\3\144"+
+ "\1\uffff\2\45\1\u0087\3\45\1\u008b\1\uffff\3\45\1\uffff\1\u008f\11\45"+
+ "\1\u009a\3\45\1\uffff\1\144\1\uffff\3\144\1\u00a0\1\u00a1\1\uffff\1\u00a2"+
+ "\2\45\1\uffff\1\u00a5\1\u00a7\1\45\1\uffff\1\u00a9\4\45\1\u00ae\4\45\1"+
+ "\uffff\1\u00b3\2\45\5\uffff\1\45\1\u00b7\1\uffff\1\45\1\uffff\1\45\1\uffff"+
+ "\1\u00ba\1\u00bb\1\u00bc\1\u00bd\1\uffff\4\45\1\uffff\3\45\1\uffff\1\45"+
+ "\1\u00c6\4\uffff\1\45\1\u00c8\1\45\1\u00ca\2\45\1\u00cd\1\45\1\uffff\1"+
+ "\45\1\uffff\1\u00d0\1\uffff\1\u00d1\1\45\1\uffff\1\45\1\u00d4\2\uffff"+
+ "\2\45\1\uffff\1\u00d7\1\45\1\uffff\2\45\1\u00db\1\uffff";
+ static final String DFA30_eofS =
+ "\u00dc\uffff";
+ static final String DFA30_minS =
+ "\1\11\1\154\1\141\1\157\1\156\1\154\1\156\1\157\1\150\1\162\1\156\1\141"+
+ "\1\102\1\141\1\151\1\76\1\uffff\1\75\1\56\13\uffff\1\60\1\uffff\1\42\3"+
+ "\uffff\1\52\1\uffff\1\151\1\156\1\141\1\157\1\154\2\165\1\145\1\157\1"+
+ "\164\1\156\1\157\1\147\1\162\1\141\1\160\1\163\1\162\1\151\2\157\1\155"+
+ "\1\116\11\uffff\1\60\2\uffff\1\147\1\163\1\162\1\143\1\154\1\142\1\155"+
+ "\1\60\1\156\1\141\1\60\1\147\1\162\1\156\1\145\1\143\1\145\2\151\1\144"+
+ "\1\157\1\155\1\141\1\60\1\125\2\114\1\uffff\1\156\1\164\1\60\1\153\1\163"+
+ "\1\154\1\60\1\uffff\2\164\1\147\1\uffff\1\60\1\164\1\145\1\141\1\156\1"+
+ "\143\1\145\1\141\1\147\1\141\1\60\1\154\1\160\1\147\1\uffff\1\125\1\uffff"+
+ "\1\125\1\154\1\114\2\60\1\uffff\1\60\1\151\1\145\1\uffff\2\60\1\145\1"+
+ "\uffff\1\60\1\144\1\155\1\147\1\164\1\60\1\154\1\145\2\156\1\uffff\1\60"+
+ "\1\154\1\151\5\uffff\1\164\1\60\1\uffff\1\156\1\uffff\1\162\1\uffff\4"+
+ "\60\1\uffff\1\151\1\146\1\145\1\164\1\uffff\1\145\1\156\1\145\1\uffff"+
+ "\1\147\1\60\4\uffff\1\141\1\60\1\144\1\60\1\170\1\141\1\60\1\137\1\uffff"+
+ "\1\163\1\uffff\1\60\1\uffff\1\60\1\162\1\uffff\1\160\1\60\2\uffff\1\171"+
+ "\1\157\1\uffff\1\60\1\151\1\uffff\1\156\1\164\1\60\1\uffff";
+ static final String DFA30_maxS =
+ "\1\175\1\154\2\157\1\166\1\154\1\156\1\157\1\164\1\171\1\156\1\157\1\111"+
+ "\1\141\2\151\1\uffff\1\75\1\56\13\uffff\1\170\1\uffff\1\47\3\uffff\1\57"+
+ "\1\uffff\1\151\1\156\1\141\1\157\1\154\1\165\1\166\1\145\1\157\1\164\1"+
+ "\156\1\157\1\147\1\162\1\141\1\160\1\163\1\162\1\151\2\157\1\155\1\116"+
+ "\11\uffff\1\165\2\uffff\1\147\1\163\1\162\1\143\1\154\1\142\1\155\1\172"+
+ "\1\156\1\141\1\172\1\147\1\162\1\156\1\165\1\143\1\145\2\151\1\144\1\157"+
+ "\1\155\1\141\1\172\2\165\1\154\1\uffff\1\156\1\164\1\172\1\153\1\163\1"+
+ "\154\1\172\1\uffff\2\164\1\147\1\uffff\1\172\1\164\1\145\1\141\1\156\1"+
+ "\143\1\145\1\144\1\147\1\141\1\172\1\154\1\160\1\147\1\uffff\1\165\1\uffff"+
+ "\1\165\1\154\1\114\2\172\1\uffff\1\172\1\151\1\145\1\uffff\2\172\1\145"+
+ "\1\uffff\1\172\1\144\1\155\1\147\1\164\1\172\1\154\1\145\2\156\1\uffff"+
+ "\1\172\1\154\1\151\5\uffff\1\164\1\172\1\uffff\1\156\1\uffff\1\162\1\uffff"+
+ "\4\172\1\uffff\1\151\1\146\1\145\1\164\1\uffff\1\145\1\156\1\145\1\uffff"+
+ "\1\147\1\172\4\uffff\1\141\1\172\1\144\1\172\1\170\1\141\1\172\1\137\1"+
+ "\uffff\1\163\1\uffff\1\172\1\uffff\1\172\1\162\1\uffff\1\160\1\172\2\uffff"+
+ "\1\171\1\157\1\uffff\1\172\1\151\1\uffff\1\156\1\164\1\172\1\uffff";
+ static final String DFA30_acceptS =
+ "\20\uffff\1\40\2\uffff\1\43\1\45\1\46\1\47\1\50\1\51\1\52\1\53\1\54\1"+
+ "\55\1\56\1\uffff\1\63\1\uffff\1\65\1\66\1\67\1\uffff\1\72\27\uffff\1\36"+
+ "\1\57\1\37\1\60\1\44\1\41\1\42\1\61\1\64\1\uffff\1\70\1\71\33\uffff\1"+
+ "\62\7\uffff\1\32\3\uffff\1\12\16\uffff\1\35\1\uffff\1\62\5\uffff\1\3\3"+
+ "\uffff\1\5\3\uffff\1\13\12\uffff\1\26\3\uffff\2\62\1\1\1\2\1\33\2\uffff"+
+ "\1\6\1\uffff\1\10\1\uffff\1\14\4\uffff\1\21\4\uffff\1\27\3\uffff\1\4\2"+
+ "\uffff\1\15\1\16\1\17\1\20\10\uffff\1\11\1\uffff\1\23\1\uffff\1\25\2\uffff"+
+ "\1\34\2\uffff\1\24\1\30\2\uffff\1\22\2\uffff\1\31\3\uffff\1\7";
+ static final String DFA30_specialS =
+ "\u00dc\uffff}>";
+ static final String[] DFA30_transitionS = {
+ "\2\43\1\uffff\2\43\22\uffff\1\43\1\uffff\1\42\4\uffff\1\41\1\30\1\31"+
+ "\1\35\1\16\1\20\1\17\1\22\1\44\1\36\11\37\1\21\1\34\1\24\1\23\1\25\2"+
+ "\uffff\13\45\1\40\1\45\1\15\14\45\1\26\1\uffff\1\27\1\uffff\1\14\1\uffff"+
+ "\1\1\1\45\1\2\1\3\1\4\1\5\2\45\1\6\2\45\1\7\6\45\1\10\1\11\1\12\1\13"+
+ "\4\45\1\32\1\uffff\1\33",
+ "\1\46",
+ "\1\52\6\uffff\1\50\3\uffff\1\51\2\uffff\1\47",
+ "\1\53",
+ "\1\54\7\uffff\1\55",
+ "\1\56",
+ "\1\57",
+ "\1\60",
+ "\1\61\1\62\12\uffff\1\63",
+ "\1\64\6\uffff\1\65",
+ "\1\66",
+ "\1\67\15\uffff\1\70",
+ "\1\71\1\72\5\uffff\1\73",
+ "\1\74",
+ "\1\75",
+ "\1\100\52\uffff\1\77",
+ "",
+ "\1\101",
+ "\1\103",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\10\106\40\uffff\1\105\37\uffff\1\105",
+ "",
+ "\1\42\4\uffff\1\41",
+ "",
+ "",
+ "",
+ "\1\107\4\uffff\1\110",
+ "",
+ "\1\111",
+ "\1\112",
+ "\1\113",
+ "\1\114",
+ "\1\115",
+ "\1\116",
+ "\1\117\1\120",
+ "\1\121",
+ "\1\122",
+ "\1\123",
+ "\1\124",
+ "\1\125",
+ "\1\126",
+ "\1\127",
+ "\1\130",
+ "\1\131",
+ "\1\132",
+ "\1\133",
+ "\1\134",
+ "\1\135",
+ "\1\136",
+ "\1\137",
+ "\1\140",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\10\106\2\37\22\uffff\1\142\10\uffff\1\143\26\uffff\1\141\10\uffff\1"+
+ "\143",
+ "",
+ "",
+ "\1\145",
+ "\1\146",
+ "\1\147",
+ "\1\150",
+ "\1\151",
+ "\1\152",
+ "\1\153",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\155",
+ "\1\156",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\4\45\1\157\25\45",
+ "\1\161",
+ "\1\162",
+ "\1\163",
+ "\1\164\3\uffff\1\165\13\uffff\1\166",
+ "\1\167",
+ "\1\170",
+ "\1\171",
+ "\1\172",
+ "\1\173",
+ "\1\174",
+ "\1\175",
+ "\1\176",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u0081\26\uffff\1\u0080\10\uffff\1\u0081",
+ "\1\u0082\10\uffff\1\u0081\37\uffff\1\u0081",
+ "\1\u0084\37\uffff\1\u0083",
+ "",
+ "\1\u0085",
+ "\1\u0086",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u0088",
+ "\1\u0089",
+ "\1\u008a",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "\1\u008c",
+ "\1\u008d",
+ "\1\u008e",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u0090",
+ "\1\u0091",
+ "\1\u0092",
+ "\1\u0093",
+ "\1\u0094",
+ "\1\u0095",
+ "\1\u0096\2\uffff\1\u0097",
+ "\1\u0098",
+ "\1\u0099",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u009b",
+ "\1\u009c",
+ "\1\u009d",
+ "",
+ "\1\u0081\37\uffff\1\u0081",
+ "",
+ "\1\u0081\37\uffff\1\u0081",
+ "\1\u009e",
+ "\1\u009f",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00a3",
+ "\1\u00a4",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\10\45\1\u00a6\21\45",
+ "\1\u00a8",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00aa",
+ "\1\u00ab",
+ "\1\u00ac",
+ "\1\u00ad",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00af",
+ "\1\u00b0",
+ "\1\u00b1",
+ "\1\u00b2",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00b4",
+ "\1\u00b5",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "\1\u00b6",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "\1\u00b8",
+ "",
+ "\1\u00b9",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "\1\u00be",
+ "\1\u00bf",
+ "\1\u00c0",
+ "\1\u00c1",
+ "",
+ "\1\u00c2",
+ "\1\u00c3",
+ "\1\u00c4",
+ "",
+ "\1\u00c5",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "",
+ "",
+ "",
+ "\1\u00c7",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00c9",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00cb",
+ "\1\u00cc",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00ce",
+ "",
+ "\1\u00cf",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00d2",
+ "",
+ "\1\u00d3",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "",
+ "",
+ "\1\u00d5",
+ "\1\u00d6",
+ "",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ "\1\u00d8",
+ "",
+ "\1\u00d9",
+ "\1\u00da",
+ "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
+ ""
+ };
+
+ static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
+ static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
+ static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
+ static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
+ static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
+ static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
+ static final short[][] DFA30_transition;
+
+ static {
+ int numStates = DFA30_transitionS.length;
+ DFA30_transition = new short[numStates][];
+ for (int i=0; i<numStates; i++) {
+ DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
+ }
+ }
+
+ protected class DFA30 extends DFA {
+
+ public DFA30(BaseRecognizer recognizer) {
+ this.recognizer = recognizer;
+ this.decisionNumber = 30;
+ this.eot = DFA30_eot;
+ this.eof = DFA30_eof;
+ this.min = DFA30_min;
+ this.max = DFA30_max;
+ this.accept = DFA30_accept;
+ this.special = DFA30_special;
+ this.transition = DFA30_transition;
+ }
+ @Override
+ public String getDescription() {
+ return "1:1: Tokens : ( ALIGNTOK | CONSTTOK | CHARTOK | DOUBLETOK | ENUMTOK | EVENTTOK | FLOATINGPOINTTOK | FLOATTOK | INTEGERTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | STREAMTOK | STRINGTOK | STRUCTTOK | TRACETOK | TYPEALIASTOK | TYPEDEFTOK | UNSIGNEDTOK | VARIANTTOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | ENVTOK | CLOCKTOK | CALLSITETOK | NANNUMBERTOK | INFINITYTOK | NINFINITYTOK | SEPARATOR | COLON | ELIPSES | ASSIGNMENT | TYPE_ASSIGNMENT | LT | GT | OPENBRAC | CLOSEBRAC | LPAREN | RPAREN | LCURL | RCURL | TERM | POINTER | SIGN | ARROW | DOT | OCTAL_LITERAL | DECIMAL_LITERAL | HEX_LITERAL | CHARACTER_LITERAL | STRING_LITERAL | WS | COMMENT | LINE_COMMENT | IDENTIFIER );";
+ }
+ }
+
+}
--- /dev/null
+// $ANTLR 3.5.2 org/eclipse/tracecompass/ctf/parser/CTFParser.g 2014-10-20 18:17:49
+
+/*******************************************************************************
+ * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Etienne Bergeron - Update to Antlr 3.5 syntax
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.ctf.parser;
+
+import java.util.Set;
+import java.util.HashSet;
+
+
+import org.antlr.runtime.*;
+import java.util.Stack;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.antlr.runtime.tree.*;
+
+
+@SuppressWarnings("all")
+public class CTFParser extends Parser {
+ public static final String[] tokenNames = new String[] {
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ALIGNTOK", "ARROW", "ASSIGNMENT",
+ "BACKSLASH", "BOOLTOK", "CALLSITETOK", "CHARACTER_LITERAL", "CHARTOK",
+ "CHAR_CONTENT", "CLOCKTOK", "CLOSEBRAC", "COLON", "COMMENT", "COMMENT_CLOSE",
+ "COMMENT_OPEN", "COMPLEXTOK", "CONSTTOK", "DECIMAL_LITERAL", "DIGIT",
+ "DOT", "DOUBLEQUOTE", "DOUBLETOK", "ELIPSES", "ENUMTOK", "ENVTOK", "ESCAPE_SEQUENCE",
+ "EVENTTOK", "FLOATINGPOINTTOK", "FLOATTOK", "GT", "HEXADECIMAL_ESCAPE",
+ "HEX_DIGIT", "HEX_LITERAL", "HEX_PREFIX", "IDENTIFIER", "IMAGINARYTOK",
+ "INFINITYTOK", "INTEGERTOK", "INTEGER_TYPES_SUFFIX", "INTTOK", "LCURL",
+ "LINE_COMMENT", "LONGTOK", "LPAREN", "LT", "NANNUMBERTOK", "NINFINITYTOK",
+ "NONDIGIT", "NONZERO_DIGIT", "OCTAL_ESCAPE", "OCTAL_LITERAL", "OCT_DIGIT",
+ "OCT_PREFIX", "OPENBRAC", "POINTER", "RCURL", "RPAREN", "SEPARATOR", "SHORTTOK",
+ "SIGN", "SIGNEDTOK", "SINGLEQUOTE", "STREAMTOK", "STRINGPREFIX", "STRINGTOK",
+ "STRING_CONTENT", "STRING_LITERAL", "STRUCTTOK", "TERM", "TRACETOK", "TYPEALIASTOK",
+ "TYPEDEFTOK", "TYPE_ASSIGNMENT", "UNICODE_ESCAPE", "UNSIGNEDTOK", "VARIANTTOK",
+ "VOIDTOK", "WS", "ALIGN", "CALLSITE", "CLOCK", "CTF_EXPRESSION_TYPE",
+ "CTF_EXPRESSION_VAL", "CTF_LEFT", "CTF_RIGHT", "DECLARATION", "DECLARATOR",
+ "ENUM", "ENUM_BODY", "ENUM_CONTAINER_TYPE", "ENUM_ENUMERATOR", "ENUM_NAME",
+ "ENUM_VALUE", "ENUM_VALUE_RANGE", "ENV", "EVENT", "FLOATING_POINT", "INTEGER",
+ "LENGTH", "ROOT", "STREAM", "STRING", "STRUCT", "STRUCT_BODY", "STRUCT_NAME",
+ "SV_DECLARATION", "TRACE", "TYPEALIAS", "TYPEALIAS_ALIAS", "TYPEALIAS_TARGET",
+ "TYPEDEF", "TYPE_DECLARATOR", "TYPE_DECLARATOR_LIST", "TYPE_SPECIFIER_LIST",
+ "UNARY_EXPRESSION_DEC", "UNARY_EXPRESSION_HEX", "UNARY_EXPRESSION_OCT",
+ "UNARY_EXPRESSION_STRING", "UNARY_EXPRESSION_STRING_QUOTES", "VARIANT",
+ "VARIANT_BODY", "VARIANT_NAME", "VARIANT_TAG"
+ };
+ public static final int EOF=-1;
+ public static final int ALIGNTOK=4;
+ public static final int ARROW=5;
+ public static final int ASSIGNMENT=6;
+ public static final int BACKSLASH=7;
+ public static final int BOOLTOK=8;
+ public static final int CALLSITETOK=9;
+ public static final int CHARACTER_LITERAL=10;
+ public static final int CHARTOK=11;
+ public static final int CHAR_CONTENT=12;
+ public static final int CLOCKTOK=13;
+ public static final int CLOSEBRAC=14;
+ public static final int COLON=15;
+ public static final int COMMENT=16;
+ public static final int COMMENT_CLOSE=17;
+ public static final int COMMENT_OPEN=18;
+ public static final int COMPLEXTOK=19;
+ public static final int CONSTTOK=20;
+ public static final int DECIMAL_LITERAL=21;
+ public static final int DIGIT=22;
+ public static final int DOT=23;
+ public static final int DOUBLEQUOTE=24;
+ public static final int DOUBLETOK=25;
+ public static final int ELIPSES=26;
+ public static final int ENUMTOK=27;
+ public static final int ENVTOK=28;
+ public static final int ESCAPE_SEQUENCE=29;
+ public static final int EVENTTOK=30;
+ public static final int FLOATINGPOINTTOK=31;
+ public static final int FLOATTOK=32;
+ public static final int GT=33;
+ public static final int HEXADECIMAL_ESCAPE=34;
+ public static final int HEX_DIGIT=35;
+ public static final int HEX_LITERAL=36;
+ public static final int HEX_PREFIX=37;
+ public static final int IDENTIFIER=38;
+ public static final int IMAGINARYTOK=39;
+ public static final int INFINITYTOK=40;
+ public static final int INTEGERTOK=41;
+ public static final int INTEGER_TYPES_SUFFIX=42;
+ public static final int INTTOK=43;
+ public static final int LCURL=44;
+ public static final int LINE_COMMENT=45;
+ public static final int LONGTOK=46;
+ public static final int LPAREN=47;
+ public static final int LT=48;
+ public static final int NANNUMBERTOK=49;
+ public static final int NINFINITYTOK=50;
+ public static final int NONDIGIT=51;
+ public static final int NONZERO_DIGIT=52;
+ public static final int OCTAL_ESCAPE=53;
+ public static final int OCTAL_LITERAL=54;
+ public static final int OCT_DIGIT=55;
+ public static final int OCT_PREFIX=56;
+ public static final int OPENBRAC=57;
+ public static final int POINTER=58;
+ public static final int RCURL=59;
+ public static final int RPAREN=60;
+ public static final int SEPARATOR=61;
+ public static final int SHORTTOK=62;
+ public static final int SIGN=63;
+ public static final int SIGNEDTOK=64;
+ public static final int SINGLEQUOTE=65;
+ public static final int STREAMTOK=66;
+ public static final int STRINGPREFIX=67;
+ public static final int STRINGTOK=68;
+ public static final int STRING_CONTENT=69;
+ public static final int STRING_LITERAL=70;
+ public static final int STRUCTTOK=71;
+ public static final int TERM=72;
+ public static final int TRACETOK=73;
+ public static final int TYPEALIASTOK=74;
+ public static final int TYPEDEFTOK=75;
+ public static final int TYPE_ASSIGNMENT=76;
+ public static final int UNICODE_ESCAPE=77;
+ public static final int UNSIGNEDTOK=78;
+ public static final int VARIANTTOK=79;
+ public static final int VOIDTOK=80;
+ public static final int WS=81;
+ public static final int ALIGN=82;
+ public static final int CALLSITE=83;
+ public static final int CLOCK=84;
+ public static final int CTF_EXPRESSION_TYPE=85;
+ public static final int CTF_EXPRESSION_VAL=86;
+ public static final int CTF_LEFT=87;
+ public static final int CTF_RIGHT=88;
+ public static final int DECLARATION=89;
+ public static final int DECLARATOR=90;
+ public static final int ENUM=91;
+ public static final int ENUM_BODY=92;
+ public static final int ENUM_CONTAINER_TYPE=93;
+ public static final int ENUM_ENUMERATOR=94;
+ public static final int ENUM_NAME=95;
+ public static final int ENUM_VALUE=96;
+ public static final int ENUM_VALUE_RANGE=97;
+ public static final int ENV=98;
+ public static final int EVENT=99;
+ public static final int FLOATING_POINT=100;
+ public static final int INTEGER=101;
+ public static final int LENGTH=102;
+ public static final int ROOT=103;
+ public static final int STREAM=104;
+ public static final int STRING=105;
+ public static final int STRUCT=106;
+ public static final int STRUCT_BODY=107;
+ public static final int STRUCT_NAME=108;
+ public static final int SV_DECLARATION=109;
+ public static final int TRACE=110;
+ public static final int TYPEALIAS=111;
+ public static final int TYPEALIAS_ALIAS=112;
+ public static final int TYPEALIAS_TARGET=113;
+ public static final int TYPEDEF=114;
+ public static final int TYPE_DECLARATOR=115;
+ public static final int TYPE_DECLARATOR_LIST=116;
+ public static final int TYPE_SPECIFIER_LIST=117;
+ public static final int UNARY_EXPRESSION_DEC=118;
+ public static final int UNARY_EXPRESSION_HEX=119;
+ public static final int UNARY_EXPRESSION_OCT=120;
+ public static final int UNARY_EXPRESSION_STRING=121;
+ public static final int UNARY_EXPRESSION_STRING_QUOTES=122;
+ public static final int VARIANT=123;
+ public static final int VARIANT_BODY=124;
+ public static final int VARIANT_NAME=125;
+ public static final int VARIANT_TAG=126;
+
+ // delegates
+ public Parser[] getDelegates() {
+ return new Parser[] {};
+ }
+
+ // delegators
+
+ protected static class Symbols_scope {
+ Set<String> types;
+ }
+ protected Stack<Symbols_scope> Symbols_stack = new Stack<Symbols_scope>();
+
+
+ public CTFParser(TokenStream input) {
+ this(input, new RecognizerSharedState());
+ }
+ public CTFParser(TokenStream input, RecognizerSharedState state) {
+ super(input, state);
+ }
+
+ protected TreeAdaptor adaptor = new CommonTreeAdaptor();
+
+ public void setTreeAdaptor(TreeAdaptor adaptor) {
+ this.adaptor = adaptor;
+ }
+ public TreeAdaptor getTreeAdaptor() {
+ return adaptor;
+ }
+ @Override public String[] getTokenNames() { return CTFParser.tokenNames; }
+ @Override public String getGrammarFileName() { return "org/eclipse/tracecompass/ctf/parser/CTFParser.g"; }
+
+
+ public CTFParser(TokenStream input, boolean verbose) {
+ this(input);
+ this.verbose = verbose;
+ }
+
+ /**
+ * This method is overriden to disable automatic error recovery.
+ * On a mismatched token, it simply re-throw an exception.
+ */
+ @Override
+ protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
+ throw new MismatchedTokenException(ttype, input);
+ }
+
+ /**
+ * Checks if a given name has been defined has a type.
+ * From: http://www.antlr.org/grammar/1153358328744/C.g
+ *
+ * @param name The name to check.
+ * @return True if is is a type, false otherwise.
+ */
+ boolean isTypeName(String name) {
+ for (int i = Symbols_stack.size() - 1; i >= 0; i--) {
+ Symbols_scope scope = (Symbols_scope) Symbols_stack.get(i);
+ if (scope.types.contains(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void addTypeName(String name) {
+ Symbols_stack.peek().types.add(name);
+ if (verbose) {
+ debug_print("New type: " + name);
+ }
+ }
+
+ boolean _inTypedef = false;
+
+ void typedefOn() {
+ debug_print("typedefOn");
+ _inTypedef = true;
+ }
+
+ void typedefOff() {
+ debug_print("typedefOff");
+ _inTypedef = false;
+ }
+
+ boolean inTypedef() {
+ return _inTypedef;
+ }
+
+ boolean _inTypealiasAlias = false;
+
+ void typealiasAliasOn() {
+ debug_print("typealiasAliasOn");
+ _inTypealiasAlias = true;
+ }
+
+ void typealiasAliasOff() {
+ debug_print("typealiasAliasOff");
+ _inTypealiasAlias = false;
+ }
+
+ boolean inTypealiasAlias() {
+ return _inTypealiasAlias;
+ }
+
+ void debug_print(String str) {
+ if (verbose) {
+ System.out.println(str);
+ }
+ }
+
+ /* Prints rule entry and exit while parsing */
+ boolean verbose = false;
+
+
+ public static class parse_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "parse"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:192:1: parse : ( declaration )+ EOF -> ^( ROOT ( declaration )+ ) ;
+ public final CTFParser.parse_return parse() throws RecognitionException {
+ Symbols_stack.push(new Symbols_scope());
+
+ CTFParser.parse_return retval = new CTFParser.parse_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token EOF2=null;
+ ParserRuleReturnScope declaration1 =null;
+
+ CommonTree EOF2_tree=null;
+ RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
+ RewriteRuleSubtreeStream stream_declaration=new RewriteRuleSubtreeStream(adaptor,"rule declaration");
+
+
+ Symbols_stack.peek().types = new HashSet<String>();
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:3: ( ( declaration )+ EOF -> ^( ROOT ( declaration )+ ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: ( declaration )+ EOF
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: ( declaration )+
+ int cnt1=0;
+ loop1:
+ while (true) {
+ int alt1=2;
+ int LA1_0 = input.LA(1);
+ if ( (LA1_0==BOOLTOK||LA1_0==CHARTOK||(LA1_0 >= COMPLEXTOK && LA1_0 <= CONSTTOK)||LA1_0==DOUBLETOK||LA1_0==ENUMTOK||(LA1_0 >= FLOATINGPOINTTOK && LA1_0 <= FLOATTOK)||LA1_0==IMAGINARYTOK||LA1_0==INTEGERTOK||LA1_0==INTTOK||LA1_0==LONGTOK||LA1_0==SHORTTOK||LA1_0==SIGNEDTOK||LA1_0==STRINGTOK||LA1_0==STRUCTTOK||LA1_0==TYPEDEFTOK||(LA1_0 >= UNSIGNEDTOK && LA1_0 <= VOIDTOK)) ) {
+ alt1=1;
+ }
+ else if ( (LA1_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt1=1;
+ }
+ else if ( (LA1_0==CALLSITETOK||LA1_0==CLOCKTOK||LA1_0==ENVTOK||LA1_0==EVENTTOK||LA1_0==STREAMTOK||(LA1_0 >= TRACETOK && LA1_0 <= TYPEALIASTOK)) ) {
+ alt1=1;
+ }
+
+ switch (alt1) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: declaration
+ {
+ pushFollow(FOLLOW_declaration_in_parse449);
+ declaration1=declaration();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declaration.add(declaration1.getTree());
+ }
+ break;
+
+ default :
+ if ( cnt1 >= 1 ) break loop1;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(1, input);
+ throw eee;
+ }
+ cnt1++;
+ }
+
+ EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_parse452); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_EOF.add(EOF2);
+
+ // AST REWRITE
+ // elements: declaration
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 197:22: -> ^( ROOT ( declaration )+ )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:25: ^( ROOT ( declaration )+ )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ROOT, "ROOT"), root_1);
+ if ( !(stream_declaration.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_declaration.hasNext() ) {
+ adaptor.addChild(root_1, stream_declaration.nextTree());
+ }
+ stream_declaration.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ Symbols_stack.pop();
+
+ }
+ return retval;
+ }
+ // $ANTLR end "parse"
+
+
+ public static class numberLiteral_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "numberLiteral"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:200:1: numberLiteral : ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) ) ;
+ public final CTFParser.numberLiteral_return numberLiteral() throws RecognitionException {
+ CTFParser.numberLiteral_return retval = new CTFParser.numberLiteral_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token SIGN3=null;
+ Token HEX_LITERAL4=null;
+ Token DECIMAL_LITERAL5=null;
+ Token OCTAL_LITERAL6=null;
+
+ CommonTree SIGN3_tree=null;
+ CommonTree HEX_LITERAL4_tree=null;
+ CommonTree DECIMAL_LITERAL5_tree=null;
+ CommonTree OCTAL_LITERAL6_tree=null;
+ RewriteRuleTokenStream stream_SIGN=new RewriteRuleTokenStream(adaptor,"token SIGN");
+ RewriteRuleTokenStream stream_OCTAL_LITERAL=new RewriteRuleTokenStream(adaptor,"token OCTAL_LITERAL");
+ RewriteRuleTokenStream stream_HEX_LITERAL=new RewriteRuleTokenStream(adaptor,"token HEX_LITERAL");
+ RewriteRuleTokenStream stream_DECIMAL_LITERAL=new RewriteRuleTokenStream(adaptor,"token DECIMAL_LITERAL");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:3: ( ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: ( SIGN )*
+ loop2:
+ while (true) {
+ int alt2=2;
+ int LA2_0 = input.LA(1);
+ if ( (LA2_0==SIGN) ) {
+ alt2=1;
+ }
+
+ switch (alt2) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: SIGN
+ {
+ SIGN3=(Token)match(input,SIGN,FOLLOW_SIGN_in_numberLiteral474); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SIGN.add(SIGN3);
+
+ }
+ break;
+
+ default :
+ break loop2;
+ }
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:7: ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) )
+ int alt3=3;
+ switch ( input.LA(1) ) {
+ case HEX_LITERAL:
+ {
+ alt3=1;
+ }
+ break;
+ case DECIMAL_LITERAL:
+ {
+ alt3=2;
+ }
+ break;
+ case OCTAL_LITERAL:
+ {
+ alt3=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 3, 0, input);
+ throw nvae;
+ }
+ switch (alt3) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:9: HEX_LITERAL
+ {
+ HEX_LITERAL4=(Token)match(input,HEX_LITERAL,FOLLOW_HEX_LITERAL_in_numberLiteral485); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_HEX_LITERAL.add(HEX_LITERAL4);
+
+ // AST REWRITE
+ // elements: HEX_LITERAL, SIGN
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 202:21: -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:24: ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_HEX, "UNARY_EXPRESSION_HEX"), root_1);
+ adaptor.addChild(root_1, stream_HEX_LITERAL.nextNode());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:59: ( SIGN )*
+ while ( stream_SIGN.hasNext() ) {
+ adaptor.addChild(root_1, stream_SIGN.nextNode());
+ }
+ stream_SIGN.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:9: DECIMAL_LITERAL
+ {
+ DECIMAL_LITERAL5=(Token)match(input,DECIMAL_LITERAL,FOLLOW_DECIMAL_LITERAL_in_numberLiteral506); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_DECIMAL_LITERAL.add(DECIMAL_LITERAL5);
+
+ // AST REWRITE
+ // elements: SIGN, DECIMAL_LITERAL
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 203:25: -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:28: ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_DEC, "UNARY_EXPRESSION_DEC"), root_1);
+ adaptor.addChild(root_1, stream_DECIMAL_LITERAL.nextNode());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:67: ( SIGN )*
+ while ( stream_SIGN.hasNext() ) {
+ adaptor.addChild(root_1, stream_SIGN.nextNode());
+ }
+ stream_SIGN.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:9: OCTAL_LITERAL
+ {
+ OCTAL_LITERAL6=(Token)match(input,OCTAL_LITERAL,FOLLOW_OCTAL_LITERAL_in_numberLiteral527); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_OCTAL_LITERAL.add(OCTAL_LITERAL6);
+
+ // AST REWRITE
+ // elements: SIGN, OCTAL_LITERAL
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 204:23: -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:26: ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_OCT, "UNARY_EXPRESSION_OCT"), root_1);
+ adaptor.addChild(root_1, stream_OCTAL_LITERAL.nextNode());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:63: ( SIGN )*
+ while ( stream_SIGN.hasNext() ) {
+ adaptor.addChild(root_1, stream_SIGN.nextNode());
+ }
+ stream_SIGN.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "numberLiteral"
+
+
+ public static class primaryExpression_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "primaryExpression"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:208:1: primaryExpression : ( ( IDENTIFIER )=> IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ( ctfKeyword )=> ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) | ( STRING_LITERAL )=> STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | numberLiteral | enumConstant | CHARACTER_LITERAL );
+ public final CTFParser.primaryExpression_return primaryExpression() throws RecognitionException {
+ CTFParser.primaryExpression_return retval = new CTFParser.primaryExpression_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER7=null;
+ Token STRING_LITERAL9=null;
+ Token CHARACTER_LITERAL12=null;
+ ParserRuleReturnScope ctfKeyword8 =null;
+ ParserRuleReturnScope numberLiteral10 =null;
+ ParserRuleReturnScope enumConstant11 =null;
+
+ CommonTree IDENTIFIER7_tree=null;
+ CommonTree STRING_LITERAL9_tree=null;
+ CommonTree CHARACTER_LITERAL12_tree=null;
+ RewriteRuleTokenStream stream_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token STRING_LITERAL");
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+ RewriteRuleSubtreeStream stream_ctfKeyword=new RewriteRuleSubtreeStream(adaptor,"rule ctfKeyword");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:3: ( ( IDENTIFIER )=> IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ( ctfKeyword )=> ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) | ( STRING_LITERAL )=> STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | numberLiteral | enumConstant | CHARACTER_LITERAL )
+ int alt4=6;
+ switch ( input.LA(1) ) {
+ case IDENTIFIER:
+ {
+ int LA4_1 = input.LA(2);
+ if ( (synpred1_CTFParser()) ) {
+ alt4=1;
+ }
+ else if ( (true) ) {
+ alt4=5;
+ }
+
+ }
+ break;
+ case ALIGNTOK:
+ case EVENTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ {
+ int LA4_2 = input.LA(2);
+ if ( (synpred2_CTFParser()) ) {
+ alt4=2;
+ }
+ else if ( (true) ) {
+ alt4=5;
+ }
+
+ }
+ break;
+ case STRING_LITERAL:
+ {
+ int LA4_3 = input.LA(2);
+ if ( (synpred3_CTFParser()) ) {
+ alt4=3;
+ }
+ else if ( (true) ) {
+ alt4=5;
+ }
+
+ }
+ break;
+ case DECIMAL_LITERAL:
+ case HEX_LITERAL:
+ case OCTAL_LITERAL:
+ case SIGN:
+ {
+ alt4=4;
+ }
+ break;
+ case CHARACTER_LITERAL:
+ {
+ alt4=6;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 4, 0, input);
+ throw nvae;
+ }
+ switch (alt4) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:5: ( IDENTIFIER )=> IDENTIFIER
+ {
+ IDENTIFIER7=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_primaryExpression565); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER7);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 210:7: -> ^( UNARY_EXPRESSION_STRING IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:210:10: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:5: ( ctfKeyword )=> ctfKeyword
+ {
+ pushFollow(FOLLOW_ctfKeyword_in_primaryExpression591);
+ ctfKeyword8=ctfKeyword();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfKeyword.add(ctfKeyword8.getTree());
+ // AST REWRITE
+ // elements: ctfKeyword
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 211:32: -> ^( UNARY_EXPRESSION_STRING ctfKeyword )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:35: ^( UNARY_EXPRESSION_STRING ctfKeyword )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
+ adaptor.addChild(root_1, stream_ctfKeyword.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:5: ( STRING_LITERAL )=> STRING_LITERAL
+ {
+ STRING_LITERAL9=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_primaryExpression611); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_STRING_LITERAL.add(STRING_LITERAL9);
+
+ // AST REWRITE
+ // elements: STRING_LITERAL
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 213:7: -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:213:10: ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING_QUOTES, "UNARY_EXPRESSION_STRING_QUOTES"), root_1);
+ adaptor.addChild(root_1, stream_STRING_LITERAL.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:215:5: numberLiteral
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_numberLiteral_in_primaryExpression636);
+ numberLiteral10=numberLiteral();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, numberLiteral10.getTree());
+
+ }
+ break;
+ case 5 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:216:5: enumConstant
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_enumConstant_in_primaryExpression642);
+ enumConstant11=enumConstant();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, enumConstant11.getTree());
+
+ }
+ break;
+ case 6 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:217:5: CHARACTER_LITERAL
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ CHARACTER_LITERAL12=(Token)match(input,CHARACTER_LITERAL,FOLLOW_CHARACTER_LITERAL_in_primaryExpression648); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ CHARACTER_LITERAL12_tree = (CommonTree)adaptor.create(CHARACTER_LITERAL12);
+ adaptor.addChild(root_0, CHARACTER_LITERAL12_tree);
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "primaryExpression"
+
+
+ public static class postfixExpressionSuffix_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "postfixExpressionSuffix"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:220:1: postfixExpressionSuffix : ( OPENBRAC unaryExpression CLOSEBRAC !| (ref= DOT |ref= ARROW ) IDENTIFIER -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) ) );
+ public final CTFParser.postfixExpressionSuffix_return postfixExpressionSuffix() throws RecognitionException {
+ CTFParser.postfixExpressionSuffix_return retval = new CTFParser.postfixExpressionSuffix_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ref=null;
+ Token OPENBRAC13=null;
+ Token CLOSEBRAC15=null;
+ Token IDENTIFIER16=null;
+ ParserRuleReturnScope unaryExpression14 =null;
+
+ CommonTree ref_tree=null;
+ CommonTree OPENBRAC13_tree=null;
+ CommonTree CLOSEBRAC15_tree=null;
+ CommonTree IDENTIFIER16_tree=null;
+ RewriteRuleTokenStream stream_ARROW=new RewriteRuleTokenStream(adaptor,"token ARROW");
+ RewriteRuleTokenStream stream_DOT=new RewriteRuleTokenStream(adaptor,"token DOT");
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:221:3: ( OPENBRAC unaryExpression CLOSEBRAC !| (ref= DOT |ref= ARROW ) IDENTIFIER -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) ) )
+ int alt6=2;
+ int LA6_0 = input.LA(1);
+ if ( (LA6_0==OPENBRAC) ) {
+ alt6=1;
+ }
+ else if ( (LA6_0==ARROW||LA6_0==DOT) ) {
+ alt6=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 6, 0, input);
+ throw nvae;
+ }
+
+ switch (alt6) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:221:5: OPENBRAC unaryExpression CLOSEBRAC !
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ OPENBRAC13=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_postfixExpressionSuffix661); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ OPENBRAC13_tree = (CommonTree)adaptor.create(OPENBRAC13);
+ adaptor.addChild(root_0, OPENBRAC13_tree);
+ }
+
+ pushFollow(FOLLOW_unaryExpression_in_postfixExpressionSuffix663);
+ unaryExpression14=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression14.getTree());
+
+ CLOSEBRAC15=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_postfixExpressionSuffix665); if (state.failed) return retval;
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:5: (ref= DOT |ref= ARROW ) IDENTIFIER
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:5: (ref= DOT |ref= ARROW )
+ int alt5=2;
+ int LA5_0 = input.LA(1);
+ if ( (LA5_0==DOT) ) {
+ alt5=1;
+ }
+ else if ( (LA5_0==ARROW) ) {
+ alt5=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 5, 0, input);
+ throw nvae;
+ }
+
+ switch (alt5) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:6: ref= DOT
+ {
+ ref=(Token)match(input,DOT,FOLLOW_DOT_in_postfixExpressionSuffix675); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_DOT.add(ref);
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:16: ref= ARROW
+ {
+ ref=(Token)match(input,ARROW,FOLLOW_ARROW_in_postfixExpressionSuffix681); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ARROW.add(ref);
+
+ }
+ break;
+
+ }
+
+ IDENTIFIER16=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_postfixExpressionSuffix684); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER16);
+
+ // AST REWRITE
+ // elements: IDENTIFIER, ref
+ // token labels: ref
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleTokenStream stream_ref=new RewriteRuleTokenStream(adaptor,"token ref",ref);
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 223:7: -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:223:10: ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_ref.nextNode(), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:223:17: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_2);
+ adaptor.addChild(root_2, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "postfixExpressionSuffix"
+
+
+ public static class postfixExpression_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "postfixExpression"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:226:1: postfixExpression : ( primaryExpression ( postfixExpressionSuffix )* | ctfSpecifierHead ( postfixExpressionSuffix )+ );
+ public final CTFParser.postfixExpression_return postfixExpression() throws RecognitionException {
+ CTFParser.postfixExpression_return retval = new CTFParser.postfixExpression_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope primaryExpression17 =null;
+ ParserRuleReturnScope postfixExpressionSuffix18 =null;
+ ParserRuleReturnScope ctfSpecifierHead19 =null;
+ ParserRuleReturnScope postfixExpressionSuffix20 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:3: ( primaryExpression ( postfixExpressionSuffix )* | ctfSpecifierHead ( postfixExpressionSuffix )+ )
+ int alt9=2;
+ switch ( input.LA(1) ) {
+ case ALIGNTOK:
+ case CHARACTER_LITERAL:
+ case DECIMAL_LITERAL:
+ case HEX_LITERAL:
+ case IDENTIFIER:
+ case OCTAL_LITERAL:
+ case SIGN:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRING_LITERAL:
+ {
+ alt9=1;
+ }
+ break;
+ case EVENTTOK:
+ {
+ alt9=1;
+ }
+ break;
+ case CALLSITETOK:
+ case CLOCKTOK:
+ case ENVTOK:
+ case STREAMTOK:
+ case TRACETOK:
+ {
+ alt9=2;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 9, 0, input);
+ throw nvae;
+ }
+ switch (alt9) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:5: primaryExpression ( postfixExpressionSuffix )*
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_primaryExpression_in_postfixExpression716);
+ primaryExpression17=primaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, primaryExpression17.getTree());
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:23: ( postfixExpressionSuffix )*
+ loop7:
+ while (true) {
+ int alt7=2;
+ int LA7_0 = input.LA(1);
+ if ( (LA7_0==ARROW||LA7_0==DOT||LA7_0==OPENBRAC) ) {
+ alt7=1;
+ }
+
+ switch (alt7) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:23: postfixExpressionSuffix
+ {
+ pushFollow(FOLLOW_postfixExpressionSuffix_in_postfixExpression718);
+ postfixExpressionSuffix18=postfixExpressionSuffix();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpressionSuffix18.getTree());
+
+ }
+ break;
+
+ default :
+ break loop7;
+ }
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:5: ctfSpecifierHead ( postfixExpressionSuffix )+
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_ctfSpecifierHead_in_postfixExpression725);
+ ctfSpecifierHead19=ctfSpecifierHead();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfSpecifierHead19.getTree());
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:22: ( postfixExpressionSuffix )+
+ int cnt8=0;
+ loop8:
+ while (true) {
+ int alt8=2;
+ int LA8_0 = input.LA(1);
+ if ( (LA8_0==ARROW||LA8_0==DOT||LA8_0==OPENBRAC) ) {
+ alt8=1;
+ }
+
+ switch (alt8) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:22: postfixExpressionSuffix
+ {
+ pushFollow(FOLLOW_postfixExpressionSuffix_in_postfixExpression727);
+ postfixExpressionSuffix20=postfixExpressionSuffix();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpressionSuffix20.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt8 >= 1 ) break loop8;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(8, input);
+ throw eee;
+ }
+ cnt8++;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "postfixExpression"
+
+
+ public static class unaryExpression_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "unaryExpression"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:231:1: unaryExpression : postfixExpression ;
+ public final CTFParser.unaryExpression_return unaryExpression() throws RecognitionException {
+ CTFParser.unaryExpression_return retval = new CTFParser.unaryExpression_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope postfixExpression21 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:232:3: ( postfixExpression )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:232:5: postfixExpression
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_postfixExpression_in_unaryExpression743);
+ postfixExpression21=postfixExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpression21.getTree());
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "unaryExpression"
+
+
+ public static class enumConstant_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumConstant"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:236:1: enumConstant : ( STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) );
+ public final CTFParser.enumConstant_return enumConstant() throws RecognitionException {
+ CTFParser.enumConstant_return retval = new CTFParser.enumConstant_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token STRING_LITERAL22=null;
+ Token IDENTIFIER23=null;
+ ParserRuleReturnScope ctfKeyword24 =null;
+
+ CommonTree STRING_LITERAL22_tree=null;
+ CommonTree IDENTIFIER23_tree=null;
+ RewriteRuleTokenStream stream_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token STRING_LITERAL");
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+ RewriteRuleSubtreeStream stream_ctfKeyword=new RewriteRuleSubtreeStream(adaptor,"rule ctfKeyword");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:3: ( STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) )
+ int alt10=3;
+ switch ( input.LA(1) ) {
+ case STRING_LITERAL:
+ {
+ alt10=1;
+ }
+ break;
+ case IDENTIFIER:
+ {
+ alt10=2;
+ }
+ break;
+ case ALIGNTOK:
+ case EVENTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ {
+ alt10=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 10, 0, input);
+ throw nvae;
+ }
+ switch (alt10) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:5: STRING_LITERAL
+ {
+ STRING_LITERAL22=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_enumConstant760); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_STRING_LITERAL.add(STRING_LITERAL22);
+
+ // AST REWRITE
+ // elements: STRING_LITERAL
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 237:20: -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:23: ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING_QUOTES, "UNARY_EXPRESSION_STRING_QUOTES"), root_1);
+ adaptor.addChild(root_1, stream_STRING_LITERAL.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:238:5: IDENTIFIER
+ {
+ IDENTIFIER23=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_enumConstant774); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER23);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 238:16: -> ^( UNARY_EXPRESSION_STRING IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:238:19: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:239:5: ctfKeyword
+ {
+ pushFollow(FOLLOW_ctfKeyword_in_enumConstant788);
+ ctfKeyword24=ctfKeyword();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfKeyword.add(ctfKeyword24.getTree());
+ // AST REWRITE
+ // elements: ctfKeyword
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 239:16: -> ^( UNARY_EXPRESSION_STRING ctfKeyword )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:239:19: ^( UNARY_EXPRESSION_STRING ctfKeyword )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
+ adaptor.addChild(root_1, stream_ctfKeyword.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumConstant"
+
+
+ public static class declaration_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "declaration"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:244:1: declaration : ( declarationSpecifiers ( declaratorList )? TERM -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) ) -> ^( DECLARATION declarationSpecifiers ( declaratorList )? ) | ctfSpecifier TERM !);
+ public final CTFParser.declaration_return declaration() throws RecognitionException {
+ CTFParser.declaration_return retval = new CTFParser.declaration_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token TERM27=null;
+ Token TERM29=null;
+ ParserRuleReturnScope declarationSpecifiers25 =null;
+ ParserRuleReturnScope declaratorList26 =null;
+ ParserRuleReturnScope ctfSpecifier28 =null;
+
+ CommonTree TERM27_tree=null;
+ CommonTree TERM29_tree=null;
+ RewriteRuleTokenStream stream_TERM=new RewriteRuleTokenStream(adaptor,"token TERM");
+ RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
+ RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:3: ( declarationSpecifiers ( declaratorList )? TERM -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) ) -> ^( DECLARATION declarationSpecifiers ( declaratorList )? ) | ctfSpecifier TERM !)
+ int alt12=2;
+ int LA12_0 = input.LA(1);
+ if ( (LA12_0==BOOLTOK||LA12_0==CHARTOK||(LA12_0 >= COMPLEXTOK && LA12_0 <= CONSTTOK)||LA12_0==DOUBLETOK||LA12_0==ENUMTOK||(LA12_0 >= FLOATINGPOINTTOK && LA12_0 <= FLOATTOK)||LA12_0==IMAGINARYTOK||LA12_0==INTEGERTOK||LA12_0==INTTOK||LA12_0==LONGTOK||LA12_0==SHORTTOK||LA12_0==SIGNEDTOK||LA12_0==STRINGTOK||LA12_0==STRUCTTOK||LA12_0==TYPEDEFTOK||(LA12_0 >= UNSIGNEDTOK && LA12_0 <= VOIDTOK)) ) {
+ alt12=1;
+ }
+ else if ( (LA12_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt12=1;
+ }
+ else if ( (LA12_0==CALLSITETOK||LA12_0==CLOCKTOK||LA12_0==ENVTOK||LA12_0==EVENTTOK||LA12_0==STREAMTOK||(LA12_0 >= TRACETOK && LA12_0 <= TYPEALIASTOK)) ) {
+ alt12=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 12, 0, input);
+ throw nvae;
+ }
+
+ switch (alt12) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:5: declarationSpecifiers ( declaratorList )? TERM
+ {
+ pushFollow(FOLLOW_declarationSpecifiers_in_declaration816);
+ declarationSpecifiers25=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers25.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:27: ( declaratorList )?
+ int alt11=2;
+ int LA11_0 = input.LA(1);
+ if ( (LA11_0==IDENTIFIER||LA11_0==POINTER) ) {
+ alt11=1;
+ }
+ switch (alt11) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:27: declaratorList
+ {
+ pushFollow(FOLLOW_declaratorList_in_declaration818);
+ declaratorList26=declaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList26.getTree());
+ }
+ break;
+
+ }
+
+ TERM27=(Token)match(input,TERM,FOLLOW_TERM_in_declaration821); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TERM.add(TERM27);
+
+ // AST REWRITE
+ // elements: declaratorList, declaratorList, declarationSpecifiers, declarationSpecifiers
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 253:7: -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) )
+ if (inTypedef()) {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:254:10: ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:254:24: ^( TYPEDEF declaratorList declarationSpecifiers )
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_2);
+ adaptor.addChild(root_2, stream_declaratorList.nextTree());
+ adaptor.addChild(root_2, stream_declarationSpecifiers.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+ else // 255:7: -> ^( DECLARATION declarationSpecifiers ( declaratorList )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:255:10: ^( DECLARATION declarationSpecifiers ( declaratorList )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
+ adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:255:46: ( declaratorList )?
+ if ( stream_declaratorList.hasNext() ) {
+ adaptor.addChild(root_1, stream_declaratorList.nextTree());
+ }
+ stream_declaratorList.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:256:5: ctfSpecifier TERM !
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_ctfSpecifier_in_declaration889);
+ ctfSpecifier28=ctfSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfSpecifier28.getTree());
+
+ TERM29=(Token)match(input,TERM,FOLLOW_TERM_in_declaration891); if (state.failed) return retval;
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ if ( state.backtracking==0 ) {
+ if (inTypedef()) {
+ typedefOff();
+ }
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "declaration"
+
+
+ public static class declarationSpecifiers_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "declarationSpecifiers"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:259:1: declarationSpecifiers : ( storageClassSpecifier | typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) ;
+ public final CTFParser.declarationSpecifiers_return declarationSpecifiers() throws RecognitionException {
+ CTFParser.declarationSpecifiers_return retval = new CTFParser.declarationSpecifiers_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope storageClassSpecifier30 =null;
+ ParserRuleReturnScope typeQualifier31 =null;
+ ParserRuleReturnScope typeSpecifier32 =null;
+
+ RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
+ RewriteRuleSubtreeStream stream_typeQualifier=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifier");
+ RewriteRuleSubtreeStream stream_storageClassSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule storageClassSpecifier");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:3: ( ( storageClassSpecifier | typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:5: ( storageClassSpecifier | typeQualifier | typeSpecifier )+
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:5: ( storageClassSpecifier | typeQualifier | typeSpecifier )+
+ int cnt13=0;
+ loop13:
+ while (true) {
+ int alt13=4;
+ switch ( input.LA(1) ) {
+ case IDENTIFIER:
+ {
+ int LA13_2 = input.LA(2);
+ if ( ((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))) ) {
+ alt13=3;
+ }
+
+ }
+ break;
+ case TYPEDEFTOK:
+ {
+ alt13=1;
+ }
+ break;
+ case CONSTTOK:
+ {
+ alt13=2;
+ }
+ break;
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt13=3;
+ }
+ break;
+ }
+ switch (alt13) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:263:9: storageClassSpecifier
+ {
+ pushFollow(FOLLOW_storageClassSpecifier_in_declarationSpecifiers929);
+ storageClassSpecifier30=storageClassSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_storageClassSpecifier.add(storageClassSpecifier30.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:264:9: typeQualifier
+ {
+ pushFollow(FOLLOW_typeQualifier_in_declarationSpecifiers939);
+ typeQualifier31=typeQualifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeQualifier.add(typeQualifier31.getTree());
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:265:9: typeSpecifier
+ {
+ pushFollow(FOLLOW_typeSpecifier_in_declarationSpecifiers949);
+ typeSpecifier32=typeSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeSpecifier.add(typeSpecifier32.getTree());
+ }
+ break;
+
+ default :
+ if ( cnt13 >= 1 ) break loop13;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(13, input);
+ throw eee;
+ }
+ cnt13++;
+ }
+
+ // AST REWRITE
+ // elements: typeQualifier, typeSpecifier
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 266:6: -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:9: ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:31: ( typeQualifier )*
+ while ( stream_typeQualifier.hasNext() ) {
+ adaptor.addChild(root_1, stream_typeQualifier.nextTree());
+ }
+ stream_typeQualifier.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:46: ( typeSpecifier )*
+ while ( stream_typeSpecifier.hasNext() ) {
+ adaptor.addChild(root_1, stream_typeSpecifier.nextTree());
+ }
+ stream_typeSpecifier.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "declarationSpecifiers"
+
+
+ public static class declaratorList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "declaratorList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:269:1: declaratorList : declarator ( SEPARATOR declarator )* -> ^( TYPE_DECLARATOR_LIST ( declarator )+ ) ;
+ public final CTFParser.declaratorList_return declaratorList() throws RecognitionException {
+ CTFParser.declaratorList_return retval = new CTFParser.declaratorList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token SEPARATOR34=null;
+ ParserRuleReturnScope declarator33 =null;
+ ParserRuleReturnScope declarator35 =null;
+
+ CommonTree SEPARATOR34_tree=null;
+ RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
+ RewriteRuleSubtreeStream stream_declarator=new RewriteRuleSubtreeStream(adaptor,"rule declarator");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:3: ( declarator ( SEPARATOR declarator )* -> ^( TYPE_DECLARATOR_LIST ( declarator )+ ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:5: declarator ( SEPARATOR declarator )*
+ {
+ pushFollow(FOLLOW_declarator_in_declaratorList979);
+ declarator33=declarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarator.add(declarator33.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:16: ( SEPARATOR declarator )*
+ loop14:
+ while (true) {
+ int alt14=2;
+ int LA14_0 = input.LA(1);
+ if ( (LA14_0==SEPARATOR) ) {
+ alt14=1;
+ }
+
+ switch (alt14) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:17: SEPARATOR declarator
+ {
+ SEPARATOR34=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_declaratorList982); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR34);
+
+ pushFollow(FOLLOW_declarator_in_declaratorList984);
+ declarator35=declarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarator.add(declarator35.getTree());
+ }
+ break;
+
+ default :
+ break loop14;
+ }
+ }
+
+ // AST REWRITE
+ // elements: declarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 271:7: -> ^( TYPE_DECLARATOR_LIST ( declarator )+ )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:271:10: ^( TYPE_DECLARATOR_LIST ( declarator )+ )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
+ if ( !(stream_declarator.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_declarator.hasNext() ) {
+ adaptor.addChild(root_1, stream_declarator.nextTree());
+ }
+ stream_declarator.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "declaratorList"
+
+
+ public static class abstractDeclaratorList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "abstractDeclaratorList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:274:1: abstractDeclaratorList : abstractDeclarator ( SEPARATOR abstractDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ ) ;
+ public final CTFParser.abstractDeclaratorList_return abstractDeclaratorList() throws RecognitionException {
+ CTFParser.abstractDeclaratorList_return retval = new CTFParser.abstractDeclaratorList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token SEPARATOR37=null;
+ ParserRuleReturnScope abstractDeclarator36 =null;
+ ParserRuleReturnScope abstractDeclarator38 =null;
+
+ CommonTree SEPARATOR37_tree=null;
+ RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
+ RewriteRuleSubtreeStream stream_abstractDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule abstractDeclarator");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:3: ( abstractDeclarator ( SEPARATOR abstractDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:5: abstractDeclarator ( SEPARATOR abstractDeclarator )*
+ {
+ pushFollow(FOLLOW_abstractDeclarator_in_abstractDeclaratorList1014);
+ abstractDeclarator36=abstractDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_abstractDeclarator.add(abstractDeclarator36.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:24: ( SEPARATOR abstractDeclarator )*
+ loop15:
+ while (true) {
+ int alt15=2;
+ int LA15_0 = input.LA(1);
+ if ( (LA15_0==SEPARATOR) ) {
+ alt15=1;
+ }
+
+ switch (alt15) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:25: SEPARATOR abstractDeclarator
+ {
+ SEPARATOR37=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_abstractDeclaratorList1017); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR37);
+
+ pushFollow(FOLLOW_abstractDeclarator_in_abstractDeclaratorList1019);
+ abstractDeclarator38=abstractDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_abstractDeclarator.add(abstractDeclarator38.getTree());
+ }
+ break;
+
+ default :
+ break loop15;
+ }
+ }
+
+ // AST REWRITE
+ // elements: abstractDeclarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 276:7: -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:276:10: ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
+ if ( !(stream_abstractDeclarator.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_abstractDeclarator.hasNext() ) {
+ adaptor.addChild(root_1, stream_abstractDeclarator.nextTree());
+ }
+ stream_abstractDeclarator.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "abstractDeclaratorList"
+
+
+ public static class storageClassSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "storageClassSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:279:1: storageClassSpecifier : TYPEDEFTOK ;
+ public final CTFParser.storageClassSpecifier_return storageClassSpecifier() throws RecognitionException {
+ CTFParser.storageClassSpecifier_return retval = new CTFParser.storageClassSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token TYPEDEFTOK39=null;
+
+ CommonTree TYPEDEFTOK39_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:280:3: ( TYPEDEFTOK )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:280:5: TYPEDEFTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ TYPEDEFTOK39=(Token)match(input,TYPEDEFTOK,FOLLOW_TYPEDEFTOK_in_storageClassSpecifier1049); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ TYPEDEFTOK39_tree = (CommonTree)adaptor.create(TYPEDEFTOK39);
+ adaptor.addChild(root_0, TYPEDEFTOK39_tree);
+ }
+
+ if ( state.backtracking==0 ) { typedefOn(); }
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "storageClassSpecifier"
+
+
+ public static class typeSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typeSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:283:1: typeSpecifier : ( FLOATTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | UNSIGNEDTOK | CHARTOK | DOUBLETOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | structSpecifier | variantSpecifier | enumSpecifier | ctfTypeSpecifier |{...}? => typedefName );
+ public final CTFParser.typeSpecifier_return typeSpecifier() throws RecognitionException {
+ CTFParser.typeSpecifier_return retval = new CTFParser.typeSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token FLOATTOK40=null;
+ Token INTTOK41=null;
+ Token LONGTOK42=null;
+ Token SHORTTOK43=null;
+ Token SIGNEDTOK44=null;
+ Token UNSIGNEDTOK45=null;
+ Token CHARTOK46=null;
+ Token DOUBLETOK47=null;
+ Token VOIDTOK48=null;
+ Token BOOLTOK49=null;
+ Token COMPLEXTOK50=null;
+ Token IMAGINARYTOK51=null;
+ ParserRuleReturnScope structSpecifier52 =null;
+ ParserRuleReturnScope variantSpecifier53 =null;
+ ParserRuleReturnScope enumSpecifier54 =null;
+ ParserRuleReturnScope ctfTypeSpecifier55 =null;
+ ParserRuleReturnScope typedefName56 =null;
+
+ CommonTree FLOATTOK40_tree=null;
+ CommonTree INTTOK41_tree=null;
+ CommonTree LONGTOK42_tree=null;
+ CommonTree SHORTTOK43_tree=null;
+ CommonTree SIGNEDTOK44_tree=null;
+ CommonTree UNSIGNEDTOK45_tree=null;
+ CommonTree CHARTOK46_tree=null;
+ CommonTree DOUBLETOK47_tree=null;
+ CommonTree VOIDTOK48_tree=null;
+ CommonTree BOOLTOK49_tree=null;
+ CommonTree COMPLEXTOK50_tree=null;
+ CommonTree IMAGINARYTOK51_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:284:3: ( FLOATTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | UNSIGNEDTOK | CHARTOK | DOUBLETOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | structSpecifier | variantSpecifier | enumSpecifier | ctfTypeSpecifier |{...}? => typedefName )
+ int alt16=17;
+ int LA16_0 = input.LA(1);
+ if ( (LA16_0==FLOATTOK) ) {
+ alt16=1;
+ }
+ else if ( (LA16_0==INTTOK) ) {
+ alt16=2;
+ }
+ else if ( (LA16_0==LONGTOK) ) {
+ alt16=3;
+ }
+ else if ( (LA16_0==SHORTTOK) ) {
+ alt16=4;
+ }
+ else if ( (LA16_0==SIGNEDTOK) ) {
+ alt16=5;
+ }
+ else if ( (LA16_0==UNSIGNEDTOK) ) {
+ alt16=6;
+ }
+ else if ( (LA16_0==CHARTOK) ) {
+ alt16=7;
+ }
+ else if ( (LA16_0==DOUBLETOK) ) {
+ alt16=8;
+ }
+ else if ( (LA16_0==VOIDTOK) ) {
+ alt16=9;
+ }
+ else if ( (LA16_0==BOOLTOK) ) {
+ alt16=10;
+ }
+ else if ( (LA16_0==COMPLEXTOK) ) {
+ alt16=11;
+ }
+ else if ( (LA16_0==IMAGINARYTOK) ) {
+ alt16=12;
+ }
+ else if ( (LA16_0==STRUCTTOK) ) {
+ alt16=13;
+ }
+ else if ( (LA16_0==VARIANTTOK) ) {
+ alt16=14;
+ }
+ else if ( (LA16_0==ENUMTOK) ) {
+ alt16=15;
+ }
+ else if ( (LA16_0==FLOATINGPOINTTOK||LA16_0==INTEGERTOK||LA16_0==STRINGTOK) ) {
+ alt16=16;
+ }
+ else if ( (LA16_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt16=17;
+ }
+
+ switch (alt16) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:284:5: FLOATTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ FLOATTOK40=(Token)match(input,FLOATTOK,FOLLOW_FLOATTOK_in_typeSpecifier1065); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ FLOATTOK40_tree = (CommonTree)adaptor.create(FLOATTOK40);
+ adaptor.addChild(root_0, FLOATTOK40_tree);
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:285:5: INTTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ INTTOK41=(Token)match(input,INTTOK,FOLLOW_INTTOK_in_typeSpecifier1071); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ INTTOK41_tree = (CommonTree)adaptor.create(INTTOK41);
+ adaptor.addChild(root_0, INTTOK41_tree);
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:286:5: LONGTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ LONGTOK42=(Token)match(input,LONGTOK,FOLLOW_LONGTOK_in_typeSpecifier1077); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ LONGTOK42_tree = (CommonTree)adaptor.create(LONGTOK42);
+ adaptor.addChild(root_0, LONGTOK42_tree);
+ }
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:287:5: SHORTTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ SHORTTOK43=(Token)match(input,SHORTTOK,FOLLOW_SHORTTOK_in_typeSpecifier1083); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ SHORTTOK43_tree = (CommonTree)adaptor.create(SHORTTOK43);
+ adaptor.addChild(root_0, SHORTTOK43_tree);
+ }
+
+ }
+ break;
+ case 5 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:288:5: SIGNEDTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ SIGNEDTOK44=(Token)match(input,SIGNEDTOK,FOLLOW_SIGNEDTOK_in_typeSpecifier1089); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ SIGNEDTOK44_tree = (CommonTree)adaptor.create(SIGNEDTOK44);
+ adaptor.addChild(root_0, SIGNEDTOK44_tree);
+ }
+
+ }
+ break;
+ case 6 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:289:5: UNSIGNEDTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ UNSIGNEDTOK45=(Token)match(input,UNSIGNEDTOK,FOLLOW_UNSIGNEDTOK_in_typeSpecifier1095); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ UNSIGNEDTOK45_tree = (CommonTree)adaptor.create(UNSIGNEDTOK45);
+ adaptor.addChild(root_0, UNSIGNEDTOK45_tree);
+ }
+
+ }
+ break;
+ case 7 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:290:5: CHARTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ CHARTOK46=(Token)match(input,CHARTOK,FOLLOW_CHARTOK_in_typeSpecifier1101); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ CHARTOK46_tree = (CommonTree)adaptor.create(CHARTOK46);
+ adaptor.addChild(root_0, CHARTOK46_tree);
+ }
+
+ }
+ break;
+ case 8 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:291:5: DOUBLETOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ DOUBLETOK47=(Token)match(input,DOUBLETOK,FOLLOW_DOUBLETOK_in_typeSpecifier1107); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ DOUBLETOK47_tree = (CommonTree)adaptor.create(DOUBLETOK47);
+ adaptor.addChild(root_0, DOUBLETOK47_tree);
+ }
+
+ }
+ break;
+ case 9 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:292:5: VOIDTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ VOIDTOK48=(Token)match(input,VOIDTOK,FOLLOW_VOIDTOK_in_typeSpecifier1113); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ VOIDTOK48_tree = (CommonTree)adaptor.create(VOIDTOK48);
+ adaptor.addChild(root_0, VOIDTOK48_tree);
+ }
+
+ }
+ break;
+ case 10 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:293:5: BOOLTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ BOOLTOK49=(Token)match(input,BOOLTOK,FOLLOW_BOOLTOK_in_typeSpecifier1119); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ BOOLTOK49_tree = (CommonTree)adaptor.create(BOOLTOK49);
+ adaptor.addChild(root_0, BOOLTOK49_tree);
+ }
+
+ }
+ break;
+ case 11 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:294:5: COMPLEXTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ COMPLEXTOK50=(Token)match(input,COMPLEXTOK,FOLLOW_COMPLEXTOK_in_typeSpecifier1125); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ COMPLEXTOK50_tree = (CommonTree)adaptor.create(COMPLEXTOK50);
+ adaptor.addChild(root_0, COMPLEXTOK50_tree);
+ }
+
+ }
+ break;
+ case 12 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:295:5: IMAGINARYTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ IMAGINARYTOK51=(Token)match(input,IMAGINARYTOK,FOLLOW_IMAGINARYTOK_in_typeSpecifier1131); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ IMAGINARYTOK51_tree = (CommonTree)adaptor.create(IMAGINARYTOK51);
+ adaptor.addChild(root_0, IMAGINARYTOK51_tree);
+ }
+
+ }
+ break;
+ case 13 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:296:5: structSpecifier
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_structSpecifier_in_typeSpecifier1137);
+ structSpecifier52=structSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, structSpecifier52.getTree());
+
+ }
+ break;
+ case 14 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:297:5: variantSpecifier
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_variantSpecifier_in_typeSpecifier1143);
+ variantSpecifier53=variantSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, variantSpecifier53.getTree());
+
+ }
+ break;
+ case 15 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:298:5: enumSpecifier
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_enumSpecifier_in_typeSpecifier1149);
+ enumSpecifier54=enumSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, enumSpecifier54.getTree());
+
+ }
+ break;
+ case 16 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:299:5: ctfTypeSpecifier
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_ctfTypeSpecifier_in_typeSpecifier1155);
+ ctfTypeSpecifier55=ctfTypeSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfTypeSpecifier55.getTree());
+
+ }
+ break;
+ case 17 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:300:5: {...}? => typedefName
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ if ( !(( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )) ) {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ throw new FailedPredicateException(input, "typeSpecifier", " inTypealiasAlias() || isTypeName(input.LT(1).getText()) ");
+ }
+ pushFollow(FOLLOW_typedefName_in_typeSpecifier1165);
+ typedefName56=typedefName();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, typedefName56.getTree());
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typeSpecifier"
+
+
+ public static class typeQualifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typeQualifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:303:1: typeQualifier : CONSTTOK ;
+ public final CTFParser.typeQualifier_return typeQualifier() throws RecognitionException {
+ CTFParser.typeQualifier_return retval = new CTFParser.typeQualifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token CONSTTOK57=null;
+
+ CommonTree CONSTTOK57_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:304:3: ( CONSTTOK )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:304:5: CONSTTOK
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ CONSTTOK57=(Token)match(input,CONSTTOK,FOLLOW_CONSTTOK_in_typeQualifier1178); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ CONSTTOK57_tree = (CommonTree)adaptor.create(CONSTTOK57);
+ adaptor.addChild(root_0, CONSTTOK57_tree);
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typeQualifier"
+
+
+ public static class alignAttribute_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "alignAttribute"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:307:1: alignAttribute : ALIGNTOK LPAREN unaryExpression RPAREN -> ^( ALIGN unaryExpression ) ;
+ public final CTFParser.alignAttribute_return alignAttribute() throws RecognitionException {
+ CTFParser.alignAttribute_return retval = new CTFParser.alignAttribute_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ALIGNTOK58=null;
+ Token LPAREN59=null;
+ Token RPAREN61=null;
+ ParserRuleReturnScope unaryExpression60 =null;
+
+ CommonTree ALIGNTOK58_tree=null;
+ CommonTree LPAREN59_tree=null;
+ CommonTree RPAREN61_tree=null;
+ RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
+ RewriteRuleTokenStream stream_ALIGNTOK=new RewriteRuleTokenStream(adaptor,"token ALIGNTOK");
+ RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
+ RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:3: ( ALIGNTOK LPAREN unaryExpression RPAREN -> ^( ALIGN unaryExpression ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:5: ALIGNTOK LPAREN unaryExpression RPAREN
+ {
+ ALIGNTOK58=(Token)match(input,ALIGNTOK,FOLLOW_ALIGNTOK_in_alignAttribute1191); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ALIGNTOK.add(ALIGNTOK58);
+
+ LPAREN59=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_alignAttribute1193); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN59);
+
+ pushFollow(FOLLOW_unaryExpression_in_alignAttribute1195);
+ unaryExpression60=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_unaryExpression.add(unaryExpression60.getTree());
+ RPAREN61=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_alignAttribute1197); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN61);
+
+ // AST REWRITE
+ // elements: unaryExpression
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 308:44: -> ^( ALIGN unaryExpression )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:47: ^( ALIGN unaryExpression )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ALIGN, "ALIGN"), root_1);
+ adaptor.addChild(root_1, stream_unaryExpression.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "alignAttribute"
+
+
+ public static class structBody_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structBody"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:312:1: structBody : LCURL ( structOrVariantDeclarationList )? RCURL -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? ) ;
+ public final CTFParser.structBody_return structBody() throws RecognitionException {
+ Symbols_stack.push(new Symbols_scope());
+
+ CTFParser.structBody_return retval = new CTFParser.structBody_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token LCURL62=null;
+ Token RCURL64=null;
+ ParserRuleReturnScope structOrVariantDeclarationList63 =null;
+
+ CommonTree LCURL62_tree=null;
+ CommonTree RCURL64_tree=null;
+ RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
+ RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
+ RewriteRuleSubtreeStream stream_structOrVariantDeclarationList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarationList");
+
+
+ Symbols_stack.peek().types = new HashSet<String>();
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:3: ( LCURL ( structOrVariantDeclarationList )? RCURL -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:5: LCURL ( structOrVariantDeclarationList )? RCURL
+ {
+ LCURL62=(Token)match(input,LCURL,FOLLOW_LCURL_in_structBody1231); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LCURL.add(LCURL62);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:11: ( structOrVariantDeclarationList )?
+ int alt17=2;
+ int LA17_0 = input.LA(1);
+ if ( (LA17_0==BOOLTOK||LA17_0==CHARTOK||(LA17_0 >= COMPLEXTOK && LA17_0 <= CONSTTOK)||LA17_0==DOUBLETOK||LA17_0==ENUMTOK||(LA17_0 >= FLOATINGPOINTTOK && LA17_0 <= FLOATTOK)||LA17_0==IMAGINARYTOK||LA17_0==INTEGERTOK||LA17_0==INTTOK||LA17_0==LONGTOK||LA17_0==SHORTTOK||LA17_0==SIGNEDTOK||LA17_0==STRINGTOK||LA17_0==STRUCTTOK||LA17_0==TYPEDEFTOK||(LA17_0 >= UNSIGNEDTOK && LA17_0 <= VOIDTOK)) ) {
+ alt17=1;
+ }
+ else if ( (LA17_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt17=1;
+ }
+ else if ( (LA17_0==TYPEALIASTOK) ) {
+ alt17=1;
+ }
+ switch (alt17) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:11: structOrVariantDeclarationList
+ {
+ pushFollow(FOLLOW_structOrVariantDeclarationList_in_structBody1233);
+ structOrVariantDeclarationList63=structOrVariantDeclarationList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structOrVariantDeclarationList.add(structOrVariantDeclarationList63.getTree());
+ }
+ break;
+
+ }
+
+ RCURL64=(Token)match(input,RCURL,FOLLOW_RCURL_in_structBody1236); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_RCURL.add(RCURL64);
+
+ // AST REWRITE
+ // elements: structOrVariantDeclarationList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 318:7: -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:318:10: ^( STRUCT_BODY ( structOrVariantDeclarationList )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT_BODY, "STRUCT_BODY"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:318:24: ( structOrVariantDeclarationList )?
+ if ( stream_structOrVariantDeclarationList.hasNext() ) {
+ adaptor.addChild(root_1, stream_structOrVariantDeclarationList.nextTree());
+ }
+ stream_structOrVariantDeclarationList.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ Symbols_stack.pop();
+
+ }
+ return retval;
+ }
+ // $ANTLR end "structBody"
+
+
+ public static class structSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:321:1: structSpecifier : STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) ) -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? ) ;
+ public final CTFParser.structSpecifier_return structSpecifier() throws RecognitionException {
+ CTFParser.structSpecifier_return retval = new CTFParser.structSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token STRUCTTOK65=null;
+ ParserRuleReturnScope structName66 =null;
+ ParserRuleReturnScope alignAttribute67 =null;
+ ParserRuleReturnScope structBody68 =null;
+ ParserRuleReturnScope alignAttribute69 =null;
+ ParserRuleReturnScope structBody70 =null;
+ ParserRuleReturnScope alignAttribute71 =null;
+
+ CommonTree STRUCTTOK65_tree=null;
+ RewriteRuleTokenStream stream_STRUCTTOK=new RewriteRuleTokenStream(adaptor,"token STRUCTTOK");
+ RewriteRuleSubtreeStream stream_structName=new RewriteRuleSubtreeStream(adaptor,"rule structName");
+ RewriteRuleSubtreeStream stream_structBody=new RewriteRuleSubtreeStream(adaptor,"rule structBody");
+ RewriteRuleSubtreeStream stream_alignAttribute=new RewriteRuleSubtreeStream(adaptor,"rule alignAttribute");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:322:3: ( STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) ) -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:322:5: STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) )
+ {
+ STRUCTTOK65=(Token)match(input,STRUCTTOK,FOLLOW_STRUCTTOK_in_structSpecifier1264); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_STRUCTTOK.add(STRUCTTOK65);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:323:3: ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) )
+ int alt21=2;
+ int LA21_0 = input.LA(1);
+ if ( (LA21_0==IDENTIFIER) ) {
+ alt21=1;
+ }
+ else if ( (LA21_0==LCURL) ) {
+ alt21=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 21, 0, input);
+ throw nvae;
+ }
+
+ switch (alt21) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:325:5: ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:325:5: ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:326:9: structName ( alignAttribute | ( structBody ( alignAttribute |) ) |)
+ {
+ pushFollow(FOLLOW_structName_in_structSpecifier1289);
+ structName66=structName();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structName.add(structName66.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:327:9: ( alignAttribute | ( structBody ( alignAttribute |) ) |)
+ int alt19=3;
+ switch ( input.LA(1) ) {
+ case ALIGNTOK:
+ {
+ alt19=1;
+ }
+ break;
+ case LCURL:
+ {
+ switch ( input.LA(2) ) {
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case RCURL:
+ case SHORTTOK:
+ case STRUCTTOK:
+ case TYPEALIASTOK:
+ case TYPEDEFTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt19=2;
+ }
+ break;
+ case SIGNEDTOK:
+ {
+ int LA19_5 = input.LA(3);
+ if ( (LA19_5==BOOLTOK||LA19_5==CHARTOK||(LA19_5 >= COMPLEXTOK && LA19_5 <= CONSTTOK)||LA19_5==DOUBLETOK||LA19_5==ENUMTOK||(LA19_5 >= FLOATINGPOINTTOK && LA19_5 <= FLOATTOK)||(LA19_5 >= IDENTIFIER && LA19_5 <= IMAGINARYTOK)||LA19_5==INTEGERTOK||LA19_5==INTTOK||LA19_5==LONGTOK||LA19_5==POINTER||LA19_5==SHORTTOK||LA19_5==SIGNEDTOK||LA19_5==STRINGTOK||LA19_5==STRUCTTOK||LA19_5==TYPEDEFTOK||(LA19_5 >= UNSIGNEDTOK && LA19_5 <= VOIDTOK)) ) {
+ alt19=2;
+ }
+ else if ( (LA19_5==ASSIGNMENT||LA19_5==RCURL||LA19_5==SEPARATOR) ) {
+ alt19=3;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 19, 5, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case STRINGTOK:
+ {
+ int LA19_6 = input.LA(3);
+ if ( (LA19_6==BOOLTOK||LA19_6==CHARTOK||(LA19_6 >= COMPLEXTOK && LA19_6 <= CONSTTOK)||LA19_6==DOUBLETOK||LA19_6==ENUMTOK||(LA19_6 >= FLOATINGPOINTTOK && LA19_6 <= FLOATTOK)||(LA19_6 >= IDENTIFIER && LA19_6 <= IMAGINARYTOK)||LA19_6==INTEGERTOK||(LA19_6 >= INTTOK && LA19_6 <= LCURL)||LA19_6==LONGTOK||LA19_6==POINTER||LA19_6==SHORTTOK||LA19_6==SIGNEDTOK||LA19_6==STRINGTOK||LA19_6==STRUCTTOK||LA19_6==TYPEDEFTOK||(LA19_6 >= UNSIGNEDTOK && LA19_6 <= VOIDTOK)) ) {
+ alt19=2;
+ }
+ else if ( (LA19_6==ASSIGNMENT||LA19_6==RCURL||LA19_6==SEPARATOR) ) {
+ alt19=3;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 19, 6, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case IDENTIFIER:
+ {
+ int LA19_7 = input.LA(3);
+ if ( (LA19_7==BOOLTOK||LA19_7==CHARTOK||(LA19_7 >= COMPLEXTOK && LA19_7 <= CONSTTOK)||LA19_7==DOUBLETOK||LA19_7==ENUMTOK||(LA19_7 >= FLOATINGPOINTTOK && LA19_7 <= FLOATTOK)||(LA19_7 >= IDENTIFIER && LA19_7 <= IMAGINARYTOK)||LA19_7==INTEGERTOK||LA19_7==INTTOK||LA19_7==LONGTOK||LA19_7==POINTER||LA19_7==SHORTTOK||LA19_7==SIGNEDTOK||LA19_7==STRINGTOK||LA19_7==STRUCTTOK||LA19_7==TYPEDEFTOK||(LA19_7 >= UNSIGNEDTOK && LA19_7 <= VOIDTOK)) ) {
+ alt19=2;
+ }
+ else if ( (LA19_7==ASSIGNMENT||LA19_7==RCURL||LA19_7==SEPARATOR) ) {
+ alt19=3;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 19, 7, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case ALIGNTOK:
+ case EVENTTOK:
+ case STRING_LITERAL:
+ {
+ alt19=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 19, 2, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+ }
+ break;
+ case EOF:
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IDENTIFIER:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case LPAREN:
+ case POINTER:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case TERM:
+ case TYPEDEFTOK:
+ case TYPE_ASSIGNMENT:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt19=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 19, 0, input);
+ throw nvae;
+ }
+ switch (alt19) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:328:11: alignAttribute
+ {
+ pushFollow(FOLLOW_alignAttribute_in_structSpecifier1311);
+ alignAttribute67=alignAttribute();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute67.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:330:11: ( structBody ( alignAttribute |) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:330:11: ( structBody ( alignAttribute |) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:331:13: structBody ( alignAttribute |)
+ {
+ pushFollow(FOLLOW_structBody_in_structSpecifier1347);
+ structBody68=structBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structBody.add(structBody68.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:332:13: ( alignAttribute |)
+ int alt18=2;
+ int LA18_0 = input.LA(1);
+ if ( (LA18_0==ALIGNTOK) ) {
+ alt18=1;
+ }
+ else if ( (LA18_0==EOF||LA18_0==BOOLTOK||LA18_0==CHARTOK||(LA18_0 >= COMPLEXTOK && LA18_0 <= CONSTTOK)||LA18_0==DOUBLETOK||LA18_0==ENUMTOK||(LA18_0 >= FLOATINGPOINTTOK && LA18_0 <= FLOATTOK)||(LA18_0 >= IDENTIFIER && LA18_0 <= IMAGINARYTOK)||LA18_0==INTEGERTOK||(LA18_0 >= INTTOK && LA18_0 <= LCURL)||(LA18_0 >= LONGTOK && LA18_0 <= LPAREN)||LA18_0==POINTER||LA18_0==SHORTTOK||LA18_0==SIGNEDTOK||LA18_0==STRINGTOK||(LA18_0 >= STRUCTTOK && LA18_0 <= TERM)||(LA18_0 >= TYPEDEFTOK && LA18_0 <= TYPE_ASSIGNMENT)||(LA18_0 >= UNSIGNEDTOK && LA18_0 <= VOIDTOK)) ) {
+ alt18=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 18, 0, input);
+ throw nvae;
+ }
+
+ switch (alt18) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:333:14: alignAttribute
+ {
+ pushFollow(FOLLOW_alignAttribute_in_structSpecifier1378);
+ alignAttribute69=alignAttribute();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute69.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:336:13:
+ {
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:340:9:
+ {
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:344:5: ( structBody ( alignAttribute |) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:344:5: ( structBody ( alignAttribute |) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:345:7: structBody ( alignAttribute |)
+ {
+ pushFollow(FOLLOW_structBody_in_structSpecifier1494);
+ structBody70=structBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structBody.add(structBody70.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:346:7: ( alignAttribute |)
+ int alt20=2;
+ int LA20_0 = input.LA(1);
+ if ( (LA20_0==ALIGNTOK) ) {
+ alt20=1;
+ }
+ else if ( (LA20_0==EOF||LA20_0==BOOLTOK||LA20_0==CHARTOK||(LA20_0 >= COMPLEXTOK && LA20_0 <= CONSTTOK)||LA20_0==DOUBLETOK||LA20_0==ENUMTOK||(LA20_0 >= FLOATINGPOINTTOK && LA20_0 <= FLOATTOK)||(LA20_0 >= IDENTIFIER && LA20_0 <= IMAGINARYTOK)||LA20_0==INTEGERTOK||(LA20_0 >= INTTOK && LA20_0 <= LCURL)||(LA20_0 >= LONGTOK && LA20_0 <= LPAREN)||LA20_0==POINTER||LA20_0==SHORTTOK||LA20_0==SIGNEDTOK||LA20_0==STRINGTOK||(LA20_0 >= STRUCTTOK && LA20_0 <= TERM)||(LA20_0 >= TYPEDEFTOK && LA20_0 <= TYPE_ASSIGNMENT)||(LA20_0 >= UNSIGNEDTOK && LA20_0 <= VOIDTOK)) ) {
+ alt20=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 20, 0, input);
+ throw nvae;
+ }
+
+ switch (alt20) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:347:9: alignAttribute
+ {
+ pushFollow(FOLLOW_alignAttribute_in_structSpecifier1512);
+ alignAttribute71=alignAttribute();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute71.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:350:7:
+ {
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: alignAttribute, structBody, structName
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 352:5: -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:8: ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT, "STRUCT"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:17: ( structName )?
+ if ( stream_structName.hasNext() ) {
+ adaptor.addChild(root_1, stream_structName.nextTree());
+ }
+ stream_structName.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:29: ( structBody )?
+ if ( stream_structBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_structBody.nextTree());
+ }
+ stream_structBody.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:41: ( alignAttribute )?
+ if ( stream_alignAttribute.hasNext() ) {
+ adaptor.addChild(root_1, stream_alignAttribute.nextTree());
+ }
+ stream_alignAttribute.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structSpecifier"
+
+
+ public static class structName_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structName"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:355:1: structName : IDENTIFIER -> ^( STRUCT_NAME IDENTIFIER ) ;
+ public final CTFParser.structName_return structName() throws RecognitionException {
+ CTFParser.structName_return retval = new CTFParser.structName_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER72=null;
+
+ CommonTree IDENTIFIER72_tree=null;
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:3: ( IDENTIFIER -> ^( STRUCT_NAME IDENTIFIER ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:5: IDENTIFIER
+ {
+ IDENTIFIER72=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_structName1578); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER72);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 356:16: -> ^( STRUCT_NAME IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:19: ^( STRUCT_NAME IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT_NAME, "STRUCT_NAME"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structName"
+
+
+ public static class structOrVariantDeclarationList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structOrVariantDeclarationList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:359:1: structOrVariantDeclarationList : ( structOrVariantDeclaration )+ ;
+ public final CTFParser.structOrVariantDeclarationList_return structOrVariantDeclarationList() throws RecognitionException {
+ CTFParser.structOrVariantDeclarationList_return retval = new CTFParser.structOrVariantDeclarationList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope structOrVariantDeclaration73 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:3: ( ( structOrVariantDeclaration )+ )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: ( structOrVariantDeclaration )+
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: ( structOrVariantDeclaration )+
+ int cnt22=0;
+ loop22:
+ while (true) {
+ int alt22=2;
+ int LA22_0 = input.LA(1);
+ if ( (LA22_0==BOOLTOK||LA22_0==CHARTOK||(LA22_0 >= COMPLEXTOK && LA22_0 <= CONSTTOK)||LA22_0==DOUBLETOK||LA22_0==ENUMTOK||(LA22_0 >= FLOATINGPOINTTOK && LA22_0 <= FLOATTOK)||LA22_0==IMAGINARYTOK||LA22_0==INTEGERTOK||LA22_0==INTTOK||LA22_0==LONGTOK||LA22_0==SHORTTOK||LA22_0==SIGNEDTOK||LA22_0==STRINGTOK||LA22_0==STRUCTTOK||LA22_0==TYPEDEFTOK||(LA22_0 >= UNSIGNEDTOK && LA22_0 <= VOIDTOK)) ) {
+ alt22=1;
+ }
+ else if ( (LA22_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt22=1;
+ }
+ else if ( (LA22_0==TYPEALIASTOK) ) {
+ alt22=1;
+ }
+
+ switch (alt22) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: structOrVariantDeclaration
+ {
+ pushFollow(FOLLOW_structOrVariantDeclaration_in_structOrVariantDeclarationList1599);
+ structOrVariantDeclaration73=structOrVariantDeclaration();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, structOrVariantDeclaration73.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt22 >= 1 ) break loop22;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(22, input);
+ throw eee;
+ }
+ cnt22++;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structOrVariantDeclarationList"
+
+
+ public static class structOrVariantDeclaration_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structOrVariantDeclaration"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:363:1: structOrVariantDeclaration : ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM ;
+ public final CTFParser.structOrVariantDeclaration_return structOrVariantDeclaration() throws RecognitionException {
+ CTFParser.structOrVariantDeclaration_return retval = new CTFParser.structOrVariantDeclaration_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token TERM78=null;
+ ParserRuleReturnScope declarationSpecifiers74 =null;
+ ParserRuleReturnScope declaratorList75 =null;
+ ParserRuleReturnScope structOrVariantDeclaratorList76 =null;
+ ParserRuleReturnScope typealiasDecl77 =null;
+
+ CommonTree TERM78_tree=null;
+ RewriteRuleTokenStream stream_TERM=new RewriteRuleTokenStream(adaptor,"token TERM");
+ RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
+ RewriteRuleSubtreeStream stream_typealiasDecl=new RewriteRuleSubtreeStream(adaptor,"rule typealiasDecl");
+ RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
+ RewriteRuleSubtreeStream stream_structOrVariantDeclaratorList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclaratorList");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:364:3: ( ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:365:3: ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:365:3: ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl )
+ int alt24=2;
+ int LA24_0 = input.LA(1);
+ if ( (LA24_0==BOOLTOK||LA24_0==CHARTOK||(LA24_0 >= COMPLEXTOK && LA24_0 <= CONSTTOK)||LA24_0==DOUBLETOK||LA24_0==ENUMTOK||(LA24_0 >= FLOATINGPOINTTOK && LA24_0 <= FLOATTOK)||LA24_0==IMAGINARYTOK||LA24_0==INTEGERTOK||LA24_0==INTTOK||LA24_0==LONGTOK||LA24_0==SHORTTOK||LA24_0==SIGNEDTOK||LA24_0==STRINGTOK||LA24_0==STRUCTTOK||LA24_0==TYPEDEFTOK||(LA24_0 >= UNSIGNEDTOK && LA24_0 <= VOIDTOK)) ) {
+ alt24=1;
+ }
+ else if ( (LA24_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt24=1;
+ }
+ else if ( (LA24_0==TYPEALIASTOK) ) {
+ alt24=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 24, 0, input);
+ throw nvae;
+ }
+
+ switch (alt24) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:366:7: ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:366:7: ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:367:8: declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )
+ {
+ pushFollow(FOLLOW_declarationSpecifiers_in_structOrVariantDeclaration1632);
+ declarationSpecifiers74=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers74.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:368:10: ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )
+ int alt23=2;
+ alt23 = dfa23.predict(input);
+ switch (alt23) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:370:12: {...}? => declaratorList
+ {
+ if ( !((inTypedef())) ) {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ throw new FailedPredicateException(input, "structOrVariantDeclaration", "inTypedef()");
+ }
+ pushFollow(FOLLOW_declaratorList_in_structOrVariantDeclaration1673);
+ declaratorList75=declaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList75.getTree());
+ if ( state.backtracking==0 ) {typedefOff();}
+ // AST REWRITE
+ // elements: declaratorList, declarationSpecifiers
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 371:14: -> ^( TYPEDEF declaratorList declarationSpecifiers )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:371:17: ^( TYPEDEF declaratorList declarationSpecifiers )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_1);
+ adaptor.addChild(root_1, stream_declaratorList.nextTree());
+ adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:372:14: structOrVariantDeclaratorList
+ {
+ pushFollow(FOLLOW_structOrVariantDeclaratorList_in_structOrVariantDeclaration1713);
+ structOrVariantDeclaratorList76=structOrVariantDeclaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structOrVariantDeclaratorList.add(structOrVariantDeclaratorList76.getTree());
+ // AST REWRITE
+ // elements: structOrVariantDeclaratorList, declarationSpecifiers
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 373:14: -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:373:17: ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(SV_DECLARATION, "SV_DECLARATION"), root_1);
+ adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
+ adaptor.addChild(root_1, stream_structOrVariantDeclaratorList.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:378:5: typealiasDecl
+ {
+ pushFollow(FOLLOW_typealiasDecl_in_structOrVariantDeclaration1772);
+ typealiasDecl77=typealiasDecl();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typealiasDecl.add(typealiasDecl77.getTree());
+ // AST REWRITE
+ // elements: typealiasDecl
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 378:19: -> typealiasDecl
+ {
+ adaptor.addChild(root_0, stream_typealiasDecl.nextTree());
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+
+ TERM78=(Token)match(input,TERM,FOLLOW_TERM_in_structOrVariantDeclaration1784); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TERM.add(TERM78);
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structOrVariantDeclaration"
+
+
+ public static class specifierQualifierList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "specifierQualifierList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:383:1: specifierQualifierList : ( typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) ;
+ public final CTFParser.specifierQualifierList_return specifierQualifierList() throws RecognitionException {
+ CTFParser.specifierQualifierList_return retval = new CTFParser.specifierQualifierList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope typeQualifier79 =null;
+ ParserRuleReturnScope typeSpecifier80 =null;
+
+ RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
+ RewriteRuleSubtreeStream stream_typeQualifier=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifier");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:3: ( ( typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:5: ( typeQualifier | typeSpecifier )+
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:5: ( typeQualifier | typeSpecifier )+
+ int cnt25=0;
+ loop25:
+ while (true) {
+ int alt25=3;
+ int LA25_0 = input.LA(1);
+ if ( (LA25_0==CONSTTOK) ) {
+ alt25=1;
+ }
+ else if ( (LA25_0==BOOLTOK||LA25_0==CHARTOK||LA25_0==COMPLEXTOK||LA25_0==DOUBLETOK||LA25_0==ENUMTOK||(LA25_0 >= FLOATINGPOINTTOK && LA25_0 <= FLOATTOK)||LA25_0==IMAGINARYTOK||LA25_0==INTEGERTOK||LA25_0==INTTOK||LA25_0==LONGTOK||LA25_0==SHORTTOK||LA25_0==SIGNEDTOK||LA25_0==STRINGTOK||LA25_0==STRUCTTOK||(LA25_0 >= UNSIGNEDTOK && LA25_0 <= VOIDTOK)) ) {
+ alt25=2;
+ }
+ else if ( (LA25_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt25=2;
+ }
+
+ switch (alt25) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:6: typeQualifier
+ {
+ pushFollow(FOLLOW_typeQualifier_in_specifierQualifierList1798);
+ typeQualifier79=typeQualifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeQualifier.add(typeQualifier79.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:22: typeSpecifier
+ {
+ pushFollow(FOLLOW_typeSpecifier_in_specifierQualifierList1802);
+ typeSpecifier80=typeSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeSpecifier.add(typeSpecifier80.getTree());
+ }
+ break;
+
+ default :
+ if ( cnt25 >= 1 ) break loop25;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(25, input);
+ throw eee;
+ }
+ cnt25++;
+ }
+
+ // AST REWRITE
+ // elements: typeQualifier, typeSpecifier
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 385:7: -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:10: ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:32: ( typeQualifier )*
+ while ( stream_typeQualifier.hasNext() ) {
+ adaptor.addChild(root_1, stream_typeQualifier.nextTree());
+ }
+ stream_typeQualifier.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:47: ( typeSpecifier )*
+ while ( stream_typeSpecifier.hasNext() ) {
+ adaptor.addChild(root_1, stream_typeSpecifier.nextTree());
+ }
+ stream_typeSpecifier.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "specifierQualifierList"
+
+
+ public static class structOrVariantDeclaratorList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structOrVariantDeclaratorList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:388:1: structOrVariantDeclaratorList : structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ ) ;
+ public final CTFParser.structOrVariantDeclaratorList_return structOrVariantDeclaratorList() throws RecognitionException {
+ CTFParser.structOrVariantDeclaratorList_return retval = new CTFParser.structOrVariantDeclaratorList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token SEPARATOR82=null;
+ ParserRuleReturnScope structOrVariantDeclarator81 =null;
+ ParserRuleReturnScope structOrVariantDeclarator83 =null;
+
+ CommonTree SEPARATOR82_tree=null;
+ RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
+ RewriteRuleSubtreeStream stream_structOrVariantDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarator");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:3: ( structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:5: structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )*
+ {
+ pushFollow(FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1835);
+ structOrVariantDeclarator81=structOrVariantDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structOrVariantDeclarator.add(structOrVariantDeclarator81.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:31: ( SEPARATOR structOrVariantDeclarator )*
+ loop26:
+ while (true) {
+ int alt26=2;
+ int LA26_0 = input.LA(1);
+ if ( (LA26_0==SEPARATOR) ) {
+ alt26=1;
+ }
+
+ switch (alt26) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:32: SEPARATOR structOrVariantDeclarator
+ {
+ SEPARATOR82=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_structOrVariantDeclaratorList1838); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR82);
+
+ pushFollow(FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1840);
+ structOrVariantDeclarator83=structOrVariantDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structOrVariantDeclarator.add(structOrVariantDeclarator83.getTree());
+ }
+ break;
+
+ default :
+ break loop26;
+ }
+ }
+
+ // AST REWRITE
+ // elements: structOrVariantDeclarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 390:7: -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:390:10: ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
+ if ( !(stream_structOrVariantDeclarator.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_structOrVariantDeclarator.hasNext() ) {
+ adaptor.addChild(root_1, stream_structOrVariantDeclarator.nextTree());
+ }
+ stream_structOrVariantDeclarator.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structOrVariantDeclaratorList"
+
+
+ public static class structOrVariantDeclarator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "structOrVariantDeclarator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:393:1: structOrVariantDeclarator : ( declarator ( COLON numberLiteral )? ) -> declarator ;
+ public final CTFParser.structOrVariantDeclarator_return structOrVariantDeclarator() throws RecognitionException {
+ CTFParser.structOrVariantDeclarator_return retval = new CTFParser.structOrVariantDeclarator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token COLON85=null;
+ ParserRuleReturnScope declarator84 =null;
+ ParserRuleReturnScope numberLiteral86 =null;
+
+ CommonTree COLON85_tree=null;
+ RewriteRuleTokenStream stream_COLON=new RewriteRuleTokenStream(adaptor,"token COLON");
+ RewriteRuleSubtreeStream stream_declarator=new RewriteRuleSubtreeStream(adaptor,"rule declarator");
+ RewriteRuleSubtreeStream stream_numberLiteral=new RewriteRuleSubtreeStream(adaptor,"rule numberLiteral");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:394:3: ( ( declarator ( COLON numberLiteral )? ) -> declarator )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:5: ( declarator ( COLON numberLiteral )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:5: ( declarator ( COLON numberLiteral )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:6: declarator ( COLON numberLiteral )?
+ {
+ pushFollow(FOLLOW_declarator_in_structOrVariantDeclarator1879);
+ declarator84=declarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarator.add(declarator84.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:17: ( COLON numberLiteral )?
+ int alt27=2;
+ int LA27_0 = input.LA(1);
+ if ( (LA27_0==COLON) ) {
+ alt27=1;
+ }
+ switch (alt27) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:18: COLON numberLiteral
+ {
+ COLON85=(Token)match(input,COLON,FOLLOW_COLON_in_structOrVariantDeclarator1882); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_COLON.add(COLON85);
+
+ pushFollow(FOLLOW_numberLiteral_in_structOrVariantDeclarator1884);
+ numberLiteral86=numberLiteral();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_numberLiteral.add(numberLiteral86.getTree());
+ }
+ break;
+
+ }
+
+ }
+
+ // AST REWRITE
+ // elements: declarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 396:41: -> declarator
+ {
+ adaptor.addChild(root_0, stream_declarator.nextTree());
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "structOrVariantDeclarator"
+
+
+ public static class variantSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "variantSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:400:1: variantSpecifier : VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody ) -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? ) ;
+ public final CTFParser.variantSpecifier_return variantSpecifier() throws RecognitionException {
+ CTFParser.variantSpecifier_return retval = new CTFParser.variantSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token VARIANTTOK87=null;
+ ParserRuleReturnScope variantName88 =null;
+ ParserRuleReturnScope variantTag89 =null;
+ ParserRuleReturnScope variantBody90 =null;
+ ParserRuleReturnScope variantBody91 =null;
+ ParserRuleReturnScope variantTag92 =null;
+ ParserRuleReturnScope variantBody93 =null;
+ ParserRuleReturnScope variantBody94 =null;
+
+ CommonTree VARIANTTOK87_tree=null;
+ RewriteRuleTokenStream stream_VARIANTTOK=new RewriteRuleTokenStream(adaptor,"token VARIANTTOK");
+ RewriteRuleSubtreeStream stream_variantName=new RewriteRuleSubtreeStream(adaptor,"rule variantName");
+ RewriteRuleSubtreeStream stream_variantTag=new RewriteRuleSubtreeStream(adaptor,"rule variantTag");
+ RewriteRuleSubtreeStream stream_variantBody=new RewriteRuleSubtreeStream(adaptor,"rule variantBody");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:401:3: ( VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody ) -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:401:5: VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody )
+ {
+ VARIANTTOK87=(Token)match(input,VARIANTTOK,FOLLOW_VARIANTTOK_in_variantSpecifier1908); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_VARIANTTOK.add(VARIANTTOK87);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:402:3: ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody )
+ int alt30=3;
+ switch ( input.LA(1) ) {
+ case IDENTIFIER:
+ {
+ alt30=1;
+ }
+ break;
+ case LT:
+ {
+ alt30=2;
+ }
+ break;
+ case LCURL:
+ {
+ alt30=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 30, 0, input);
+ throw nvae;
+ }
+ switch (alt30) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:403:5: ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:403:5: ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:404:7: variantName ( ( variantTag ( variantBody |) ) | variantBody )
+ {
+ pushFollow(FOLLOW_variantName_in_variantSpecifier1926);
+ variantName88=variantName();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantName.add(variantName88.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:405:7: ( ( variantTag ( variantBody |) ) | variantBody )
+ int alt29=2;
+ int LA29_0 = input.LA(1);
+ if ( (LA29_0==LT) ) {
+ alt29=1;
+ }
+ else if ( (LA29_0==LCURL) ) {
+ alt29=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 29, 0, input);
+ throw nvae;
+ }
+
+ switch (alt29) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:406:9: ( variantTag ( variantBody |) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:406:9: ( variantTag ( variantBody |) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:407:11: variantTag ( variantBody |)
+ {
+ pushFollow(FOLLOW_variantTag_in_variantSpecifier1956);
+ variantTag89=variantTag();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantTag.add(variantTag89.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:408:11: ( variantBody |)
+ int alt28=2;
+ int LA28_0 = input.LA(1);
+ if ( (LA28_0==LCURL) ) {
+ switch ( input.LA(2) ) {
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case SHORTTOK:
+ case STRUCTTOK:
+ case TYPEALIASTOK:
+ case TYPEDEFTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt28=1;
+ }
+ break;
+ case SIGNEDTOK:
+ {
+ int LA28_4 = input.LA(3);
+ if ( (LA28_4==BOOLTOK||LA28_4==CHARTOK||(LA28_4 >= COMPLEXTOK && LA28_4 <= CONSTTOK)||LA28_4==DOUBLETOK||LA28_4==ENUMTOK||(LA28_4 >= FLOATINGPOINTTOK && LA28_4 <= FLOATTOK)||(LA28_4 >= IDENTIFIER && LA28_4 <= IMAGINARYTOK)||LA28_4==INTEGERTOK||LA28_4==INTTOK||LA28_4==LONGTOK||LA28_4==POINTER||LA28_4==SHORTTOK||LA28_4==SIGNEDTOK||LA28_4==STRINGTOK||LA28_4==STRUCTTOK||LA28_4==TYPEDEFTOK||(LA28_4 >= UNSIGNEDTOK && LA28_4 <= VOIDTOK)) ) {
+ alt28=1;
+ }
+ else if ( (LA28_4==ASSIGNMENT||LA28_4==RCURL||LA28_4==SEPARATOR) ) {
+ alt28=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 28, 4, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case STRINGTOK:
+ {
+ int LA28_5 = input.LA(3);
+ if ( (LA28_5==BOOLTOK||LA28_5==CHARTOK||(LA28_5 >= COMPLEXTOK && LA28_5 <= CONSTTOK)||LA28_5==DOUBLETOK||LA28_5==ENUMTOK||(LA28_5 >= FLOATINGPOINTTOK && LA28_5 <= FLOATTOK)||(LA28_5 >= IDENTIFIER && LA28_5 <= IMAGINARYTOK)||LA28_5==INTEGERTOK||(LA28_5 >= INTTOK && LA28_5 <= LCURL)||LA28_5==LONGTOK||LA28_5==POINTER||LA28_5==SHORTTOK||LA28_5==SIGNEDTOK||LA28_5==STRINGTOK||LA28_5==STRUCTTOK||LA28_5==TYPEDEFTOK||(LA28_5 >= UNSIGNEDTOK && LA28_5 <= VOIDTOK)) ) {
+ alt28=1;
+ }
+ else if ( (LA28_5==ASSIGNMENT||LA28_5==RCURL||LA28_5==SEPARATOR) ) {
+ alt28=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 28, 5, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case IDENTIFIER:
+ {
+ int LA28_6 = input.LA(3);
+ if ( (LA28_6==BOOLTOK||LA28_6==CHARTOK||(LA28_6 >= COMPLEXTOK && LA28_6 <= CONSTTOK)||LA28_6==DOUBLETOK||LA28_6==ENUMTOK||(LA28_6 >= FLOATINGPOINTTOK && LA28_6 <= FLOATTOK)||(LA28_6 >= IDENTIFIER && LA28_6 <= IMAGINARYTOK)||LA28_6==INTEGERTOK||LA28_6==INTTOK||LA28_6==LONGTOK||LA28_6==POINTER||LA28_6==SHORTTOK||LA28_6==SIGNEDTOK||LA28_6==STRINGTOK||LA28_6==STRUCTTOK||LA28_6==TYPEDEFTOK||(LA28_6 >= UNSIGNEDTOK && LA28_6 <= VOIDTOK)) ) {
+ alt28=1;
+ }
+ else if ( (LA28_6==ASSIGNMENT||LA28_6==RCURL||LA28_6==SEPARATOR) ) {
+ alt28=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
+ input.consume();
+ }
+ NoViableAltException nvae =
+ new NoViableAltException("", 28, 6, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case ALIGNTOK:
+ case EVENTTOK:
+ case STRING_LITERAL:
+ {
+ alt28=2;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 28, 1, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+ }
+ else if ( (LA28_0==EOF||LA28_0==BOOLTOK||LA28_0==CHARTOK||(LA28_0 >= COMPLEXTOK && LA28_0 <= CONSTTOK)||LA28_0==DOUBLETOK||LA28_0==ENUMTOK||(LA28_0 >= FLOATINGPOINTTOK && LA28_0 <= FLOATTOK)||(LA28_0 >= IDENTIFIER && LA28_0 <= IMAGINARYTOK)||LA28_0==INTEGERTOK||LA28_0==INTTOK||(LA28_0 >= LONGTOK && LA28_0 <= LPAREN)||LA28_0==POINTER||LA28_0==SHORTTOK||LA28_0==SIGNEDTOK||LA28_0==STRINGTOK||(LA28_0 >= STRUCTTOK && LA28_0 <= TERM)||(LA28_0 >= TYPEDEFTOK && LA28_0 <= TYPE_ASSIGNMENT)||(LA28_0 >= UNSIGNEDTOK && LA28_0 <= VOIDTOK)) ) {
+ alt28=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 28, 0, input);
+ throw nvae;
+ }
+
+ switch (alt28) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:409:13: variantBody
+ {
+ pushFollow(FOLLOW_variantBody_in_variantSpecifier1982);
+ variantBody90=variantBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantBody.add(variantBody90.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:412:11:
+ {
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:415:9: variantBody
+ {
+ pushFollow(FOLLOW_variantBody_in_variantSpecifier2050);
+ variantBody91=variantBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantBody.add(variantBody91.getTree());
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:5: ( variantTag variantBody )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:5: ( variantTag variantBody )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:6: variantTag variantBody
+ {
+ pushFollow(FOLLOW_variantTag_in_variantSpecifier2071);
+ variantTag92=variantTag();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantTag.add(variantTag92.getTree());
+ pushFollow(FOLLOW_variantBody_in_variantSpecifier2073);
+ variantBody93=variantBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantBody.add(variantBody93.getTree());
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:419:5: variantBody
+ {
+ pushFollow(FOLLOW_variantBody_in_variantSpecifier2080);
+ variantBody94=variantBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_variantBody.add(variantBody94.getTree());
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: variantBody, variantName, variantTag
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 420:5: -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:8: ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT, "VARIANT"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:18: ( variantName )?
+ if ( stream_variantName.hasNext() ) {
+ adaptor.addChild(root_1, stream_variantName.nextTree());
+ }
+ stream_variantName.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:31: ( variantTag )?
+ if ( stream_variantTag.hasNext() ) {
+ adaptor.addChild(root_1, stream_variantTag.nextTree());
+ }
+ stream_variantTag.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:43: ( variantBody )?
+ if ( stream_variantBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_variantBody.nextTree());
+ }
+ stream_variantBody.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "variantSpecifier"
+
+
+ public static class variantName_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "variantName"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:423:1: variantName : IDENTIFIER -> ^( VARIANT_NAME IDENTIFIER ) ;
+ public final CTFParser.variantName_return variantName() throws RecognitionException {
+ CTFParser.variantName_return retval = new CTFParser.variantName_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER95=null;
+
+ CommonTree IDENTIFIER95_tree=null;
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:3: ( IDENTIFIER -> ^( VARIANT_NAME IDENTIFIER ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:5: IDENTIFIER
+ {
+ IDENTIFIER95=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_variantName2112); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER95);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 424:16: -> ^( VARIANT_NAME IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:19: ^( VARIANT_NAME IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_NAME, "VARIANT_NAME"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "variantName"
+
+
+ public static class variantBody_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "variantBody"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:427:1: variantBody : LCURL structOrVariantDeclarationList RCURL -> ^( VARIANT_BODY structOrVariantDeclarationList ) ;
+ public final CTFParser.variantBody_return variantBody() throws RecognitionException {
+ Symbols_stack.push(new Symbols_scope());
+
+ CTFParser.variantBody_return retval = new CTFParser.variantBody_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token LCURL96=null;
+ Token RCURL98=null;
+ ParserRuleReturnScope structOrVariantDeclarationList97 =null;
+
+ CommonTree LCURL96_tree=null;
+ CommonTree RCURL98_tree=null;
+ RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
+ RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
+ RewriteRuleSubtreeStream stream_structOrVariantDeclarationList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarationList");
+
+
+ Symbols_stack.peek().types = new HashSet<String>();
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:432:3: ( LCURL structOrVariantDeclarationList RCURL -> ^( VARIANT_BODY structOrVariantDeclarationList ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:432:5: LCURL structOrVariantDeclarationList RCURL
+ {
+ LCURL96=(Token)match(input,LCURL,FOLLOW_LCURL_in_variantBody2143); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LCURL.add(LCURL96);
+
+ pushFollow(FOLLOW_structOrVariantDeclarationList_in_variantBody2145);
+ structOrVariantDeclarationList97=structOrVariantDeclarationList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_structOrVariantDeclarationList.add(structOrVariantDeclarationList97.getTree());
+ RCURL98=(Token)match(input,RCURL,FOLLOW_RCURL_in_variantBody2147); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_RCURL.add(RCURL98);
+
+ // AST REWRITE
+ // elements: structOrVariantDeclarationList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 433:7: -> ^( VARIANT_BODY structOrVariantDeclarationList )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:433:10: ^( VARIANT_BODY structOrVariantDeclarationList )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_BODY, "VARIANT_BODY"), root_1);
+ adaptor.addChild(root_1, stream_structOrVariantDeclarationList.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ Symbols_stack.pop();
+
+ }
+ return retval;
+ }
+ // $ANTLR end "variantBody"
+
+
+ public static class variantTag_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "variantTag"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:436:1: variantTag : LT IDENTIFIER GT -> ^( VARIANT_TAG IDENTIFIER ) ;
+ public final CTFParser.variantTag_return variantTag() throws RecognitionException {
+ CTFParser.variantTag_return retval = new CTFParser.variantTag_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token LT99=null;
+ Token IDENTIFIER100=null;
+ Token GT101=null;
+
+ CommonTree LT99_tree=null;
+ CommonTree IDENTIFIER100_tree=null;
+ CommonTree GT101_tree=null;
+ RewriteRuleTokenStream stream_GT=new RewriteRuleTokenStream(adaptor,"token GT");
+ RewriteRuleTokenStream stream_LT=new RewriteRuleTokenStream(adaptor,"token LT");
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:3: ( LT IDENTIFIER GT -> ^( VARIANT_TAG IDENTIFIER ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:5: LT IDENTIFIER GT
+ {
+ LT99=(Token)match(input,LT,FOLLOW_LT_in_variantTag2174); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LT.add(LT99);
+
+ IDENTIFIER100=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_variantTag2176); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER100);
+
+ GT101=(Token)match(input,GT,FOLLOW_GT_in_variantTag2178); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_GT.add(GT101);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 437:22: -> ^( VARIANT_TAG IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:25: ^( VARIANT_TAG IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_TAG, "VARIANT_TAG"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "variantTag"
+
+
+ public static class enumSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:440:1: enumSpecifier : ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) ) -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? ) ;
+ public final CTFParser.enumSpecifier_return enumSpecifier() throws RecognitionException {
+ CTFParser.enumSpecifier_return retval = new CTFParser.enumSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ENUMTOK102=null;
+ ParserRuleReturnScope enumName103 =null;
+ ParserRuleReturnScope enumContainerType104 =null;
+ ParserRuleReturnScope enumBody105 =null;
+ ParserRuleReturnScope enumBody106 =null;
+ ParserRuleReturnScope enumContainerType107 =null;
+ ParserRuleReturnScope enumBody108 =null;
+ ParserRuleReturnScope enumBody109 =null;
+
+ CommonTree ENUMTOK102_tree=null;
+ RewriteRuleTokenStream stream_ENUMTOK=new RewriteRuleTokenStream(adaptor,"token ENUMTOK");
+ RewriteRuleSubtreeStream stream_enumName=new RewriteRuleSubtreeStream(adaptor,"rule enumName");
+ RewriteRuleSubtreeStream stream_enumContainerType=new RewriteRuleSubtreeStream(adaptor,"rule enumContainerType");
+ RewriteRuleSubtreeStream stream_enumBody=new RewriteRuleSubtreeStream(adaptor,"rule enumBody");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:441:3: ( ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) ) -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:441:5: ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) )
+ {
+ ENUMTOK102=(Token)match(input,ENUMTOK,FOLLOW_ENUMTOK_in_enumSpecifier2199); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ENUMTOK.add(ENUMTOK102);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:442:5: ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) )
+ int alt33=2;
+ int LA33_0 = input.LA(1);
+ if ( (LA33_0==IDENTIFIER) ) {
+ alt33=1;
+ }
+ else if ( (LA33_0==COLON||LA33_0==LCURL) ) {
+ alt33=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 33, 0, input);
+ throw nvae;
+ }
+
+ switch (alt33) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:444:9: ( enumName ( enumContainerType enumBody | enumBody |) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:444:9: ( enumName ( enumContainerType enumBody | enumBody |) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:445:13: enumName ( enumContainerType enumBody | enumBody |)
+ {
+ pushFollow(FOLLOW_enumName_in_enumSpecifier2238);
+ enumName103=enumName();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumName.add(enumName103.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:446:13: ( enumContainerType enumBody | enumBody |)
+ int alt31=3;
+ switch ( input.LA(1) ) {
+ case COLON:
+ {
+ alt31=1;
+ }
+ break;
+ case LCURL:
+ {
+ alt31=2;
+ }
+ break;
+ case EOF:
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IDENTIFIER:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case LPAREN:
+ case POINTER:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case TERM:
+ case TYPEDEFTOK:
+ case TYPE_ASSIGNMENT:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt31=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 31, 0, input);
+ throw nvae;
+ }
+ switch (alt31) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:447:17: enumContainerType enumBody
+ {
+ pushFollow(FOLLOW_enumContainerType_in_enumSpecifier2270);
+ enumContainerType104=enumContainerType();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumContainerType.add(enumContainerType104.getTree());
+ pushFollow(FOLLOW_enumBody_in_enumSpecifier2272);
+ enumBody105=enumBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumBody.add(enumBody105.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:449:17: enumBody
+ {
+ pushFollow(FOLLOW_enumBody_in_enumSpecifier2302);
+ enumBody106=enumBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumBody.add(enumBody106.getTree());
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:452:13:
+ {
+ }
+ break;
+
+ }
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:456:9: ( enumContainerType enumBody | enumBody )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:456:9: ( enumContainerType enumBody | enumBody )
+ int alt32=2;
+ int LA32_0 = input.LA(1);
+ if ( (LA32_0==COLON) ) {
+ alt32=1;
+ }
+ else if ( (LA32_0==LCURL) ) {
+ alt32=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 32, 0, input);
+ throw nvae;
+ }
+
+ switch (alt32) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:457:13: enumContainerType enumBody
+ {
+ pushFollow(FOLLOW_enumContainerType_in_enumSpecifier2394);
+ enumContainerType107=enumContainerType();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumContainerType.add(enumContainerType107.getTree());
+ pushFollow(FOLLOW_enumBody_in_enumSpecifier2396);
+ enumBody108=enumBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumBody.add(enumBody108.getTree());
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:459:13: enumBody
+ {
+ pushFollow(FOLLOW_enumBody_in_enumSpecifier2420);
+ enumBody109=enumBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumBody.add(enumBody109.getTree());
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: enumContainerType, enumName, enumBody
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 461:7: -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:10: ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM, "ENUM"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:17: ( enumName )?
+ if ( stream_enumName.hasNext() ) {
+ adaptor.addChild(root_1, stream_enumName.nextTree());
+ }
+ stream_enumName.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:27: ( enumContainerType )?
+ if ( stream_enumContainerType.hasNext() ) {
+ adaptor.addChild(root_1, stream_enumContainerType.nextTree());
+ }
+ stream_enumContainerType.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:46: ( enumBody )?
+ if ( stream_enumBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_enumBody.nextTree());
+ }
+ stream_enumBody.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumSpecifier"
+
+
+ public static class enumName_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumName"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:464:1: enumName : IDENTIFIER -> ^( ENUM_NAME IDENTIFIER ) ;
+ public final CTFParser.enumName_return enumName() throws RecognitionException {
+ CTFParser.enumName_return retval = new CTFParser.enumName_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER110=null;
+
+ CommonTree IDENTIFIER110_tree=null;
+ RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:3: ( IDENTIFIER -> ^( ENUM_NAME IDENTIFIER ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:5: IDENTIFIER
+ {
+ IDENTIFIER110=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_enumName2464); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER110);
+
+ // AST REWRITE
+ // elements: IDENTIFIER
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 465:16: -> ^( ENUM_NAME IDENTIFIER )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:19: ^( ENUM_NAME IDENTIFIER )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_NAME, "ENUM_NAME"), root_1);
+ adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumName"
+
+
+ public static class enumBody_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumBody"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:468:1: enumBody : LCURL enumeratorList ( SEPARATOR )? RCURL -> ^( ENUM_BODY enumeratorList ) ;
+ public final CTFParser.enumBody_return enumBody() throws RecognitionException {
+ CTFParser.enumBody_return retval = new CTFParser.enumBody_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token LCURL111=null;
+ Token SEPARATOR113=null;
+ Token RCURL114=null;
+ ParserRuleReturnScope enumeratorList112 =null;
+
+ CommonTree LCURL111_tree=null;
+ CommonTree SEPARATOR113_tree=null;
+ CommonTree RCURL114_tree=null;
+ RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
+ RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
+ RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
+ RewriteRuleSubtreeStream stream_enumeratorList=new RewriteRuleSubtreeStream(adaptor,"rule enumeratorList");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:3: ( LCURL enumeratorList ( SEPARATOR )? RCURL -> ^( ENUM_BODY enumeratorList ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:5: LCURL enumeratorList ( SEPARATOR )? RCURL
+ {
+ LCURL111=(Token)match(input,LCURL,FOLLOW_LCURL_in_enumBody2485); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LCURL.add(LCURL111);
+
+ pushFollow(FOLLOW_enumeratorList_in_enumBody2487);
+ enumeratorList112=enumeratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumeratorList.add(enumeratorList112.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:26: ( SEPARATOR )?
+ int alt34=2;
+ int LA34_0 = input.LA(1);
+ if ( (LA34_0==SEPARATOR) ) {
+ alt34=1;
+ }
+ switch (alt34) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:26: SEPARATOR
+ {
+ SEPARATOR113=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_enumBody2489); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR113);
+
+ }
+ break;
+
+ }
+
+ RCURL114=(Token)match(input,RCURL,FOLLOW_RCURL_in_enumBody2492); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_RCURL.add(RCURL114);
+
+ // AST REWRITE
+ // elements: enumeratorList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 469:43: -> ^( ENUM_BODY enumeratorList )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:46: ^( ENUM_BODY enumeratorList )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_BODY, "ENUM_BODY"), root_1);
+ adaptor.addChild(root_1, stream_enumeratorList.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumBody"
+
+
+ public static class enumContainerType_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumContainerType"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:472:1: enumContainerType : COLON declarationSpecifiers -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers ) ;
+ public final CTFParser.enumContainerType_return enumContainerType() throws RecognitionException {
+ CTFParser.enumContainerType_return retval = new CTFParser.enumContainerType_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token COLON115=null;
+ ParserRuleReturnScope declarationSpecifiers116 =null;
+
+ CommonTree COLON115_tree=null;
+ RewriteRuleTokenStream stream_COLON=new RewriteRuleTokenStream(adaptor,"token COLON");
+ RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:3: ( COLON declarationSpecifiers -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:5: COLON declarationSpecifiers
+ {
+ COLON115=(Token)match(input,COLON,FOLLOW_COLON_in_enumContainerType2513); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_COLON.add(COLON115);
+
+ pushFollow(FOLLOW_declarationSpecifiers_in_enumContainerType2515);
+ declarationSpecifiers116=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers116.getTree());
+ // AST REWRITE
+ // elements: declarationSpecifiers
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 473:33: -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:36: ^( ENUM_CONTAINER_TYPE declarationSpecifiers )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_CONTAINER_TYPE, "ENUM_CONTAINER_TYPE"), root_1);
+ adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumContainerType"
+
+
+ public static class enumeratorList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumeratorList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:476:1: enumeratorList : enumerator ( SEPARATOR enumerator )* -> ( ^( ENUM_ENUMERATOR enumerator ) )+ ;
+ public final CTFParser.enumeratorList_return enumeratorList() throws RecognitionException {
+ CTFParser.enumeratorList_return retval = new CTFParser.enumeratorList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token SEPARATOR118=null;
+ ParserRuleReturnScope enumerator117 =null;
+ ParserRuleReturnScope enumerator119 =null;
+
+ CommonTree SEPARATOR118_tree=null;
+ RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
+ RewriteRuleSubtreeStream stream_enumerator=new RewriteRuleSubtreeStream(adaptor,"rule enumerator");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:3: ( enumerator ( SEPARATOR enumerator )* -> ( ^( ENUM_ENUMERATOR enumerator ) )+ )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:5: enumerator ( SEPARATOR enumerator )*
+ {
+ pushFollow(FOLLOW_enumerator_in_enumeratorList2536);
+ enumerator117=enumerator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumerator.add(enumerator117.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:16: ( SEPARATOR enumerator )*
+ loop35:
+ while (true) {
+ int alt35=2;
+ int LA35_0 = input.LA(1);
+ if ( (LA35_0==SEPARATOR) ) {
+ int LA35_1 = input.LA(2);
+ if ( (LA35_1==ALIGNTOK||LA35_1==EVENTTOK||LA35_1==IDENTIFIER||LA35_1==SIGNEDTOK||LA35_1==STRINGTOK||LA35_1==STRING_LITERAL) ) {
+ alt35=1;
+ }
+
+ }
+
+ switch (alt35) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:17: SEPARATOR enumerator
+ {
+ SEPARATOR118=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_enumeratorList2539); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR118);
+
+ pushFollow(FOLLOW_enumerator_in_enumeratorList2541);
+ enumerator119=enumerator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_enumerator.add(enumerator119.getTree());
+ }
+ break;
+
+ default :
+ break loop35;
+ }
+ }
+
+ // AST REWRITE
+ // elements: enumerator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 477:40: -> ( ^( ENUM_ENUMERATOR enumerator ) )+
+ {
+ if ( !(stream_enumerator.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_enumerator.hasNext() ) {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:44: ^( ENUM_ENUMERATOR enumerator )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_ENUMERATOR, "ENUM_ENUMERATOR"), root_1);
+ adaptor.addChild(root_1, stream_enumerator.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+ stream_enumerator.reset();
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumeratorList"
+
+
+ public static class enumerator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumerator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:480:1: enumerator : enumConstant ( enumeratorValue )? ;
+ public final CTFParser.enumerator_return enumerator() throws RecognitionException {
+ CTFParser.enumerator_return retval = new CTFParser.enumerator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope enumConstant120 =null;
+ ParserRuleReturnScope enumeratorValue121 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:3: ( enumConstant ( enumeratorValue )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:5: enumConstant ( enumeratorValue )?
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_enumConstant_in_enumerator2567);
+ enumConstant120=enumConstant();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, enumConstant120.getTree());
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:18: ( enumeratorValue )?
+ int alt36=2;
+ int LA36_0 = input.LA(1);
+ if ( (LA36_0==ASSIGNMENT) ) {
+ alt36=1;
+ }
+ switch (alt36) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:18: enumeratorValue
+ {
+ pushFollow(FOLLOW_enumeratorValue_in_enumerator2569);
+ enumeratorValue121=enumeratorValue();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, enumeratorValue121.getTree());
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumerator"
+
+
+ public static class enumeratorValue_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "enumeratorValue"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:484:1: enumeratorValue : ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) ) ;
+ public final CTFParser.enumeratorValue_return enumeratorValue() throws RecognitionException {
+ CTFParser.enumeratorValue_return retval = new CTFParser.enumeratorValue_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token ASSIGNMENT122=null;
+ Token ELIPSES123=null;
+ ParserRuleReturnScope e1 =null;
+ ParserRuleReturnScope e2 =null;
+
+ CommonTree ASSIGNMENT122_tree=null;
+ CommonTree ELIPSES123_tree=null;
+ RewriteRuleTokenStream stream_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token ASSIGNMENT");
+ RewriteRuleTokenStream stream_ELIPSES=new RewriteRuleTokenStream(adaptor,"token ELIPSES");
+ RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:485:3: ( ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:485:5: ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) )
+ {
+ ASSIGNMENT122=(Token)match(input,ASSIGNMENT,FOLLOW_ASSIGNMENT_in_enumeratorValue2583); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ASSIGNMENT.add(ASSIGNMENT122);
+
+ pushFollow(FOLLOW_unaryExpression_in_enumeratorValue2587);
+ e1=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_unaryExpression.add(e1.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:486:7: ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) )
+ int alt37=2;
+ int LA37_0 = input.LA(1);
+ if ( (LA37_0==RCURL||LA37_0==SEPARATOR) ) {
+ alt37=1;
+ }
+ else if ( (LA37_0==ELIPSES) ) {
+ alt37=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 37, 0, input);
+ throw nvae;
+ }
+
+ switch (alt37) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:487:11:
+ {
+ // AST REWRITE
+ // elements: e1
+ // token labels:
+ // rule labels: retval, e1
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+ RewriteRuleSubtreeStream stream_e1=new RewriteRuleSubtreeStream(adaptor,"rule e1",e1!=null?e1.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 487:11: -> ^( ENUM_VALUE $e1)
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:487:14: ^( ENUM_VALUE $e1)
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_VALUE, "ENUM_VALUE"), root_1);
+ adaptor.addChild(root_1, stream_e1.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:488:9: ELIPSES e2= unaryExpression
+ {
+ ELIPSES123=(Token)match(input,ELIPSES,FOLLOW_ELIPSES_in_enumeratorValue2626); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ELIPSES.add(ELIPSES123);
+
+ pushFollow(FOLLOW_unaryExpression_in_enumeratorValue2630);
+ e2=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_unaryExpression.add(e2.getTree());
+ // AST REWRITE
+ // elements: e1, e2
+ // token labels:
+ // rule labels: retval, e1, e2
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+ RewriteRuleSubtreeStream stream_e1=new RewriteRuleSubtreeStream(adaptor,"rule e1",e1!=null?e1.getTree():null);
+ RewriteRuleSubtreeStream stream_e2=new RewriteRuleSubtreeStream(adaptor,"rule e2",e2!=null?e2.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 489:11: -> ^( ENUM_VALUE_RANGE $e1 $e2)
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:489:14: ^( ENUM_VALUE_RANGE $e1 $e2)
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_VALUE_RANGE, "ENUM_VALUE_RANGE"), root_1);
+ adaptor.addChild(root_1, stream_e1.nextTree());
+ adaptor.addChild(root_1, stream_e2.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "enumeratorValue"
+
+
+ public static class declarator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "declarator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:493:1: declarator : ( pointer )* directDeclarator -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator ) ;
+ public final CTFParser.declarator_return declarator() throws RecognitionException {
+ CTFParser.declarator_return retval = new CTFParser.declarator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope pointer124 =null;
+ ParserRuleReturnScope directDeclarator125 =null;
+
+ RewriteRuleSubtreeStream stream_directDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule directDeclarator");
+ RewriteRuleSubtreeStream stream_pointer=new RewriteRuleSubtreeStream(adaptor,"rule pointer");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:3: ( ( pointer )* directDeclarator -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: ( pointer )* directDeclarator
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: ( pointer )*
+ loop38:
+ while (true) {
+ int alt38=2;
+ int LA38_0 = input.LA(1);
+ if ( (LA38_0==POINTER) ) {
+ alt38=1;
+ }
+
+ switch (alt38) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: pointer
+ {
+ pushFollow(FOLLOW_pointer_in_declarator2673);
+ pointer124=pointer();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_pointer.add(pointer124.getTree());
+ }
+ break;
+
+ default :
+ break loop38;
+ }
+ }
+
+ pushFollow(FOLLOW_directDeclarator_in_declarator2676);
+ directDeclarator125=directDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_directDeclarator.add(directDeclarator125.getTree());
+ // AST REWRITE
+ // elements: directDeclarator, pointer
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 495:7: -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:495:10: ^( TYPE_DECLARATOR ( pointer )* directDeclarator )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:495:28: ( pointer )*
+ while ( stream_pointer.hasNext() ) {
+ adaptor.addChild(root_1, stream_pointer.nextTree());
+ }
+ stream_pointer.reset();
+
+ adaptor.addChild(root_1, stream_directDeclarator.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "declarator"
+
+
+ public static class directDeclarator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "directDeclarator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:498:1: directDeclarator : ( IDENTIFIER ) ( directDeclaratorSuffix )* ;
+ public final CTFParser.directDeclarator_return directDeclarator() throws RecognitionException {
+ CTFParser.directDeclarator_return retval = new CTFParser.directDeclarator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER126=null;
+ ParserRuleReturnScope directDeclaratorSuffix127 =null;
+
+ CommonTree IDENTIFIER126_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:3: ( ( IDENTIFIER ) ( directDeclaratorSuffix )* )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:5: ( IDENTIFIER ) ( directDeclaratorSuffix )*
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:5: ( IDENTIFIER )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:500:7: IDENTIFIER
+ {
+ IDENTIFIER126=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_directDeclarator2714); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ IDENTIFIER126_tree = (CommonTree)adaptor.create(IDENTIFIER126);
+ adaptor.addChild(root_0, IDENTIFIER126_tree);
+ }
+
+ if ( state.backtracking==0 ) { if (inTypedef()) addTypeName((IDENTIFIER126!=null?IDENTIFIER126.getText():null)); }
+ if ( state.backtracking==0 ) { debug_print((IDENTIFIER126!=null?IDENTIFIER126.getText():null)); }
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:505:5: ( directDeclaratorSuffix )*
+ loop39:
+ while (true) {
+ int alt39=2;
+ int LA39_0 = input.LA(1);
+ if ( (LA39_0==OPENBRAC) ) {
+ alt39=1;
+ }
+
+ switch (alt39) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:505:5: directDeclaratorSuffix
+ {
+ pushFollow(FOLLOW_directDeclaratorSuffix_in_directDeclarator2754);
+ directDeclaratorSuffix127=directDeclaratorSuffix();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, directDeclaratorSuffix127.getTree());
+
+ }
+ break;
+
+ default :
+ break loop39;
+ }
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "directDeclarator"
+
+
+ public static class directDeclaratorSuffix_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "directDeclaratorSuffix"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:508:1: directDeclaratorSuffix : OPENBRAC directDeclaratorLength CLOSEBRAC -> ^( LENGTH directDeclaratorLength ) ;
+ public final CTFParser.directDeclaratorSuffix_return directDeclaratorSuffix() throws RecognitionException {
+ CTFParser.directDeclaratorSuffix_return retval = new CTFParser.directDeclaratorSuffix_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token OPENBRAC128=null;
+ Token CLOSEBRAC130=null;
+ ParserRuleReturnScope directDeclaratorLength129 =null;
+
+ CommonTree OPENBRAC128_tree=null;
+ CommonTree CLOSEBRAC130_tree=null;
+ RewriteRuleTokenStream stream_OPENBRAC=new RewriteRuleTokenStream(adaptor,"token OPENBRAC");
+ RewriteRuleTokenStream stream_CLOSEBRAC=new RewriteRuleTokenStream(adaptor,"token CLOSEBRAC");
+ RewriteRuleSubtreeStream stream_directDeclaratorLength=new RewriteRuleSubtreeStream(adaptor,"rule directDeclaratorLength");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:509:3: ( OPENBRAC directDeclaratorLength CLOSEBRAC -> ^( LENGTH directDeclaratorLength ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:509:5: OPENBRAC directDeclaratorLength CLOSEBRAC
+ {
+ OPENBRAC128=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_directDeclaratorSuffix2768); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_OPENBRAC.add(OPENBRAC128);
+
+ pushFollow(FOLLOW_directDeclaratorLength_in_directDeclaratorSuffix2770);
+ directDeclaratorLength129=directDeclaratorLength();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_directDeclaratorLength.add(directDeclaratorLength129.getTree());
+ CLOSEBRAC130=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_directDeclaratorSuffix2772); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_CLOSEBRAC.add(CLOSEBRAC130);
+
+ // AST REWRITE
+ // elements: directDeclaratorLength
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 510:7: -> ^( LENGTH directDeclaratorLength )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:510:10: ^( LENGTH directDeclaratorLength )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(LENGTH, "LENGTH"), root_1);
+ adaptor.addChild(root_1, stream_directDeclaratorLength.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "directDeclaratorSuffix"
+
+
+ public static class directDeclaratorLength_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "directDeclaratorLength"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:513:1: directDeclaratorLength : unaryExpression ;
+ public final CTFParser.directDeclaratorLength_return directDeclaratorLength() throws RecognitionException {
+ CTFParser.directDeclaratorLength_return retval = new CTFParser.directDeclaratorLength_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope unaryExpression131 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:514:3: ( unaryExpression )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:514:5: unaryExpression
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_unaryExpression_in_directDeclaratorLength2800);
+ unaryExpression131=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression131.getTree());
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "directDeclaratorLength"
+
+
+ public static class abstractDeclarator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "abstractDeclarator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:517:1: abstractDeclarator : ( ( pointer )+ ( directAbstractDeclarator )? -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? ) | directAbstractDeclarator -> ^( TYPE_DECLARATOR directAbstractDeclarator ) );
+ public final CTFParser.abstractDeclarator_return abstractDeclarator() throws RecognitionException {
+ CTFParser.abstractDeclarator_return retval = new CTFParser.abstractDeclarator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope pointer132 =null;
+ ParserRuleReturnScope directAbstractDeclarator133 =null;
+ ParserRuleReturnScope directAbstractDeclarator134 =null;
+
+ RewriteRuleSubtreeStream stream_pointer=new RewriteRuleSubtreeStream(adaptor,"rule pointer");
+ RewriteRuleSubtreeStream stream_directAbstractDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule directAbstractDeclarator");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:3: ( ( pointer )+ ( directAbstractDeclarator )? -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? ) | directAbstractDeclarator -> ^( TYPE_DECLARATOR directAbstractDeclarator ) )
+ int alt42=2;
+ int LA42_0 = input.LA(1);
+ if ( (LA42_0==POINTER) ) {
+ alt42=1;
+ }
+ else if ( (LA42_0==IDENTIFIER||LA42_0==LPAREN) ) {
+ alt42=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 42, 0, input);
+ throw nvae;
+ }
+
+ switch (alt42) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: ( pointer )+ ( directAbstractDeclarator )?
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: ( pointer )+
+ int cnt40=0;
+ loop40:
+ while (true) {
+ int alt40=2;
+ int LA40_0 = input.LA(1);
+ if ( (LA40_0==POINTER) ) {
+ alt40=1;
+ }
+
+ switch (alt40) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: pointer
+ {
+ pushFollow(FOLLOW_pointer_in_abstractDeclarator2813);
+ pointer132=pointer();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_pointer.add(pointer132.getTree());
+ }
+ break;
+
+ default :
+ if ( cnt40 >= 1 ) break loop40;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(40, input);
+ throw eee;
+ }
+ cnt40++;
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:14: ( directAbstractDeclarator )?
+ int alt41=2;
+ int LA41_0 = input.LA(1);
+ if ( (LA41_0==IDENTIFIER||LA41_0==LPAREN) ) {
+ alt41=1;
+ }
+ switch (alt41) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:14: directAbstractDeclarator
+ {
+ pushFollow(FOLLOW_directAbstractDeclarator_in_abstractDeclarator2816);
+ directAbstractDeclarator133=directAbstractDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_directAbstractDeclarator.add(directAbstractDeclarator133.getTree());
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: pointer, directAbstractDeclarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 519:7: -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:519:10: ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
+ if ( !(stream_pointer.hasNext()) ) {
+ throw new RewriteEarlyExitException();
+ }
+ while ( stream_pointer.hasNext() ) {
+ adaptor.addChild(root_1, stream_pointer.nextTree());
+ }
+ stream_pointer.reset();
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:519:37: ( directAbstractDeclarator )?
+ if ( stream_directAbstractDeclarator.hasNext() ) {
+ adaptor.addChild(root_1, stream_directAbstractDeclarator.nextTree());
+ }
+ stream_directAbstractDeclarator.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:520:5: directAbstractDeclarator
+ {
+ pushFollow(FOLLOW_directAbstractDeclarator_in_abstractDeclarator2841);
+ directAbstractDeclarator134=directAbstractDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_directAbstractDeclarator.add(directAbstractDeclarator134.getTree());
+ // AST REWRITE
+ // elements: directAbstractDeclarator
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 521:7: -> ^( TYPE_DECLARATOR directAbstractDeclarator )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:521:10: ^( TYPE_DECLARATOR directAbstractDeclarator )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
+ adaptor.addChild(root_1, stream_directAbstractDeclarator.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "abstractDeclarator"
+
+
+ public static class directAbstractDeclarator_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "directAbstractDeclarator"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:529:1: directAbstractDeclarator : ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )? ;
+ public final CTFParser.directAbstractDeclarator_return directAbstractDeclarator() throws RecognitionException {
+ CTFParser.directAbstractDeclarator_return retval = new CTFParser.directAbstractDeclarator_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER135=null;
+ Token LPAREN136=null;
+ Token RPAREN138=null;
+ Token OPENBRAC139=null;
+ Token CLOSEBRAC141=null;
+ ParserRuleReturnScope abstractDeclarator137 =null;
+ ParserRuleReturnScope unaryExpression140 =null;
+
+ CommonTree IDENTIFIER135_tree=null;
+ CommonTree LPAREN136_tree=null;
+ CommonTree RPAREN138_tree=null;
+ CommonTree OPENBRAC139_tree=null;
+ CommonTree CLOSEBRAC141_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:3: ( ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:5: ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )?
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:5: ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) )
+ int alt43=2;
+ int LA43_0 = input.LA(1);
+ if ( (LA43_0==IDENTIFIER) ) {
+ alt43=1;
+ }
+ else if ( (LA43_0==LPAREN) ) {
+ alt43=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 43, 0, input);
+ throw nvae;
+ }
+
+ switch (alt43) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:531:7: IDENTIFIER
+ {
+ IDENTIFIER135=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_directAbstractDeclarator2878); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ IDENTIFIER135_tree = (CommonTree)adaptor.create(IDENTIFIER135);
+ adaptor.addChild(root_0, IDENTIFIER135_tree);
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:9: ( LPAREN abstractDeclarator RPAREN )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:9: ( LPAREN abstractDeclarator RPAREN )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:10: LPAREN abstractDeclarator RPAREN
+ {
+ LPAREN136=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_directAbstractDeclarator2889); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ LPAREN136_tree = (CommonTree)adaptor.create(LPAREN136);
+ adaptor.addChild(root_0, LPAREN136_tree);
+ }
+
+ pushFollow(FOLLOW_abstractDeclarator_in_directAbstractDeclarator2891);
+ abstractDeclarator137=abstractDeclarator();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclarator137.getTree());
+
+ RPAREN138=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_directAbstractDeclarator2893); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ RPAREN138_tree = (CommonTree)adaptor.create(RPAREN138);
+ adaptor.addChild(root_0, RPAREN138_tree);
+ }
+
+ }
+
+ }
+ break;
+
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:533:5: ( OPENBRAC ( unaryExpression )? CLOSEBRAC )?
+ int alt45=2;
+ int LA45_0 = input.LA(1);
+ if ( (LA45_0==OPENBRAC) ) {
+ alt45=1;
+ }
+ switch (alt45) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:7: OPENBRAC ( unaryExpression )? CLOSEBRAC
+ {
+ OPENBRAC139=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_directAbstractDeclarator2908); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ OPENBRAC139_tree = (CommonTree)adaptor.create(OPENBRAC139);
+ adaptor.addChild(root_0, OPENBRAC139_tree);
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:16: ( unaryExpression )?
+ int alt44=2;
+ int LA44_0 = input.LA(1);
+ if ( (LA44_0==ALIGNTOK||(LA44_0 >= CALLSITETOK && LA44_0 <= CHARACTER_LITERAL)||LA44_0==CLOCKTOK||LA44_0==DECIMAL_LITERAL||LA44_0==ENVTOK||LA44_0==EVENTTOK||LA44_0==HEX_LITERAL||LA44_0==IDENTIFIER||LA44_0==OCTAL_LITERAL||(LA44_0 >= SIGN && LA44_0 <= SIGNEDTOK)||LA44_0==STREAMTOK||LA44_0==STRINGTOK||LA44_0==STRING_LITERAL||LA44_0==TRACETOK) ) {
+ alt44=1;
+ }
+ switch (alt44) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:16: unaryExpression
+ {
+ pushFollow(FOLLOW_unaryExpression_in_directAbstractDeclarator2910);
+ unaryExpression140=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression140.getTree());
+
+ }
+ break;
+
+ }
+
+ CLOSEBRAC141=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_directAbstractDeclarator2913); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ CLOSEBRAC141_tree = (CommonTree)adaptor.create(CLOSEBRAC141);
+ adaptor.addChild(root_0, CLOSEBRAC141_tree);
+ }
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "directAbstractDeclarator"
+
+
+ public static class pointer_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "pointer"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:538:1: pointer : POINTER ( typeQualifierList )? -> ^( POINTER ( typeQualifierList )? ) ;
+ public final CTFParser.pointer_return pointer() throws RecognitionException {
+ CTFParser.pointer_return retval = new CTFParser.pointer_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token POINTER142=null;
+ ParserRuleReturnScope typeQualifierList143 =null;
+
+ CommonTree POINTER142_tree=null;
+ RewriteRuleTokenStream stream_POINTER=new RewriteRuleTokenStream(adaptor,"token POINTER");
+ RewriteRuleSubtreeStream stream_typeQualifierList=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifierList");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:3: ( POINTER ( typeQualifierList )? -> ^( POINTER ( typeQualifierList )? ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:5: POINTER ( typeQualifierList )?
+ {
+ POINTER142=(Token)match(input,POINTER,FOLLOW_POINTER_in_pointer2931); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_POINTER.add(POINTER142);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:13: ( typeQualifierList )?
+ int alt46=2;
+ int LA46_0 = input.LA(1);
+ if ( (LA46_0==CONSTTOK) ) {
+ alt46=1;
+ }
+ switch (alt46) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:13: typeQualifierList
+ {
+ pushFollow(FOLLOW_typeQualifierList_in_pointer2933);
+ typeQualifierList143=typeQualifierList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeQualifierList.add(typeQualifierList143.getTree());
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: POINTER, typeQualifierList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 539:32: -> ^( POINTER ( typeQualifierList )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:35: ^( POINTER ( typeQualifierList )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_POINTER.nextNode(), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:45: ( typeQualifierList )?
+ if ( stream_typeQualifierList.hasNext() ) {
+ adaptor.addChild(root_1, stream_typeQualifierList.nextTree());
+ }
+ stream_typeQualifierList.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "pointer"
+
+
+ public static class typeQualifierList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typeQualifierList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:542:1: typeQualifierList : ( typeQualifier )+ ;
+ public final CTFParser.typeQualifierList_return typeQualifierList() throws RecognitionException {
+ CTFParser.typeQualifierList_return retval = new CTFParser.typeQualifierList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope typeQualifier144 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:3: ( ( typeQualifier )+ )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: ( typeQualifier )+
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: ( typeQualifier )+
+ int cnt47=0;
+ loop47:
+ while (true) {
+ int alt47=2;
+ int LA47_0 = input.LA(1);
+ if ( (LA47_0==CONSTTOK) ) {
+ alt47=1;
+ }
+
+ switch (alt47) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: typeQualifier
+ {
+ pushFollow(FOLLOW_typeQualifier_in_typeQualifierList2956);
+ typeQualifier144=typeQualifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, typeQualifier144.getTree());
+
+ }
+ break;
+
+ default :
+ if ( cnt47 >= 1 ) break loop47;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(47, input);
+ throw eee;
+ }
+ cnt47++;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typeQualifierList"
+
+
+ public static class typedefName_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typedefName"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:546:1: typedefName :{...}? IDENTIFIER ;
+ public final CTFParser.typedefName_return typedefName() throws RecognitionException {
+ CTFParser.typedefName_return retval = new CTFParser.typedefName_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token IDENTIFIER145=null;
+
+ CommonTree IDENTIFIER145_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:547:3: ({...}? IDENTIFIER )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:547:5: {...}? IDENTIFIER
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ if ( !((inTypealiasAlias() || isTypeName(input.LT(1).getText()))) ) {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ throw new FailedPredicateException(input, "typedefName", "inTypealiasAlias() || isTypeName(input.LT(1).getText())");
+ }
+ IDENTIFIER145=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_typedefName2972); if (state.failed) return retval;
+ if ( state.backtracking==0 ) {
+ IDENTIFIER145_tree = (CommonTree)adaptor.create(IDENTIFIER145);
+ adaptor.addChild(root_0, IDENTIFIER145_tree);
+ }
+
+ if ( state.backtracking==0 ) { if ((inTypedef() || inTypealiasAlias()) && !isTypeName((IDENTIFIER145!=null?IDENTIFIER145.getText():null))) { addTypeName((IDENTIFIER145!=null?IDENTIFIER145.getText():null)); } }
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typedefName"
+
+
+ public static class typealiasTarget_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typealiasTarget"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:556:1: typealiasTarget : declarationSpecifiers ( abstractDeclaratorList )? ;
+ public final CTFParser.typealiasTarget_return typealiasTarget() throws RecognitionException {
+ CTFParser.typealiasTarget_return retval = new CTFParser.typealiasTarget_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope declarationSpecifiers146 =null;
+ ParserRuleReturnScope abstractDeclaratorList147 =null;
+
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:3: ( declarationSpecifiers ( abstractDeclaratorList )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:5: declarationSpecifiers ( abstractDeclaratorList )?
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_declarationSpecifiers_in_typealiasTarget2989);
+ declarationSpecifiers146=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, declarationSpecifiers146.getTree());
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:27: ( abstractDeclaratorList )?
+ int alt48=2;
+ int LA48_0 = input.LA(1);
+ if ( (LA48_0==IDENTIFIER||LA48_0==LPAREN||LA48_0==POINTER) ) {
+ alt48=1;
+ }
+ switch (alt48) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:27: abstractDeclaratorList
+ {
+ pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasTarget2991);
+ abstractDeclaratorList147=abstractDeclaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList147.getTree());
+
+ }
+ break;
+
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typealiasTarget"
+
+
+ public static class typealiasAlias_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typealiasAlias"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:566:1: typealiasAlias : ( abstractDeclaratorList | declarationSpecifiers ( abstractDeclaratorList )? );
+ public final CTFParser.typealiasAlias_return typealiasAlias() throws RecognitionException {
+ CTFParser.typealiasAlias_return retval = new CTFParser.typealiasAlias_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope abstractDeclaratorList148 =null;
+ ParserRuleReturnScope declarationSpecifiers149 =null;
+ ParserRuleReturnScope abstractDeclaratorList150 =null;
+
+
+
+ typealiasAliasOn();
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:573:3: ( abstractDeclaratorList | declarationSpecifiers ( abstractDeclaratorList )? )
+ int alt50=2;
+ switch ( input.LA(1) ) {
+ case LPAREN:
+ case POINTER:
+ {
+ alt50=1;
+ }
+ break;
+ case IDENTIFIER:
+ {
+ int LA50_2 = input.LA(2);
+ if ( (!(((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))))) ) {
+ alt50=1;
+ }
+ else if ( ((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))) ) {
+ alt50=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 50, 2, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+
+ }
+ break;
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case TYPEDEFTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt50=2;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 50, 0, input);
+ throw nvae;
+ }
+ switch (alt50) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:573:5: abstractDeclaratorList
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasAlias3017);
+ abstractDeclaratorList148=abstractDeclaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList148.getTree());
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:5: declarationSpecifiers ( abstractDeclaratorList )?
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_declarationSpecifiers_in_typealiasAlias3023);
+ declarationSpecifiers149=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, declarationSpecifiers149.getTree());
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:27: ( abstractDeclaratorList )?
+ int alt49=2;
+ int LA49_0 = input.LA(1);
+ if ( (LA49_0==IDENTIFIER||LA49_0==LPAREN||LA49_0==POINTER) ) {
+ alt49=1;
+ }
+ switch (alt49) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:27: abstractDeclaratorList
+ {
+ pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasAlias3025);
+ abstractDeclaratorList150=abstractDeclaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList150.getTree());
+
+ }
+ break;
+
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ if ( state.backtracking==0 ) {
+ typealiasAliasOff();
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typealiasAlias"
+
+
+ public static class typealiasDecl_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "typealiasDecl"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:577:1: typealiasDecl : TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) ) ;
+ public final CTFParser.typealiasDecl_return typealiasDecl() throws RecognitionException {
+ CTFParser.typealiasDecl_return retval = new CTFParser.typealiasDecl_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token TYPEALIASTOK151=null;
+ Token TYPE_ASSIGNMENT153=null;
+ ParserRuleReturnScope typealiasTarget152 =null;
+ ParserRuleReturnScope typealiasAlias154 =null;
+
+ CommonTree TYPEALIASTOK151_tree=null;
+ CommonTree TYPE_ASSIGNMENT153_tree=null;
+ RewriteRuleTokenStream stream_TYPE_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token TYPE_ASSIGNMENT");
+ RewriteRuleTokenStream stream_TYPEALIASTOK=new RewriteRuleTokenStream(adaptor,"token TYPEALIASTOK");
+ RewriteRuleSubtreeStream stream_typealiasAlias=new RewriteRuleSubtreeStream(adaptor,"rule typealiasAlias");
+ RewriteRuleSubtreeStream stream_typealiasTarget=new RewriteRuleSubtreeStream(adaptor,"rule typealiasTarget");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:578:3: ( TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) ) )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:578:5: TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias
+ {
+ TYPEALIASTOK151=(Token)match(input,TYPEALIASTOK,FOLLOW_TYPEALIASTOK_in_typealiasDecl3039); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TYPEALIASTOK.add(TYPEALIASTOK151);
+
+ pushFollow(FOLLOW_typealiasTarget_in_typealiasDecl3041);
+ typealiasTarget152=typealiasTarget();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typealiasTarget.add(typealiasTarget152.getTree());
+ TYPE_ASSIGNMENT153=(Token)match(input,TYPE_ASSIGNMENT,FOLLOW_TYPE_ASSIGNMENT_in_typealiasDecl3043); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TYPE_ASSIGNMENT.add(TYPE_ASSIGNMENT153);
+
+ pushFollow(FOLLOW_typealiasAlias_in_typealiasDecl3045);
+ typealiasAlias154=typealiasAlias();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typealiasAlias.add(typealiasAlias154.getTree());
+ // AST REWRITE
+ // elements: typealiasTarget, typealiasAlias
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 579:7: -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:579:10: ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS, "TYPEALIAS"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:580:14: ^( TYPEALIAS_TARGET typealiasTarget )
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS_TARGET, "TYPEALIAS_TARGET"), root_2);
+ adaptor.addChild(root_2, stream_typealiasTarget.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:581:14: ^( TYPEALIAS_ALIAS typealiasAlias )
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS_ALIAS, "TYPEALIAS_ALIAS"), root_2);
+ adaptor.addChild(root_2, stream_typealiasAlias.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "typealiasDecl"
+
+
+ public static class ctfKeyword_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfKeyword"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:587:1: ctfKeyword : ( ALIGNTOK | EVENTTOK | SIGNEDTOK | STRINGTOK );
+ public final CTFParser.ctfKeyword_return ctfKeyword() throws RecognitionException {
+ CTFParser.ctfKeyword_return retval = new CTFParser.ctfKeyword_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token set155=null;
+
+ CommonTree set155_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:588:3: ( ALIGNTOK | EVENTTOK | SIGNEDTOK | STRINGTOK )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ set155=input.LT(1);
+ if ( input.LA(1)==ALIGNTOK||input.LA(1)==EVENTTOK||input.LA(1)==SIGNEDTOK||input.LA(1)==STRINGTOK ) {
+ input.consume();
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set155));
+ state.errorRecovery=false;
+ state.failed=false;
+ }
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ MismatchedSetException mse = new MismatchedSetException(null,input);
+ throw mse;
+ }
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfKeyword"
+
+
+ public static class ctfSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:594:1: ctfSpecifier : ( ctfSpecifierHead ctfBody -> ^( ctfSpecifierHead ctfBody ) | typealiasDecl -> ^( DECLARATION typealiasDecl ) );
+ public final CTFParser.ctfSpecifier_return ctfSpecifier() throws RecognitionException {
+ CTFParser.ctfSpecifier_return retval = new CTFParser.ctfSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ ParserRuleReturnScope ctfSpecifierHead156 =null;
+ ParserRuleReturnScope ctfBody157 =null;
+ ParserRuleReturnScope typealiasDecl158 =null;
+
+ RewriteRuleSubtreeStream stream_ctfSpecifierHead=new RewriteRuleSubtreeStream(adaptor,"rule ctfSpecifierHead");
+ RewriteRuleSubtreeStream stream_typealiasDecl=new RewriteRuleSubtreeStream(adaptor,"rule typealiasDecl");
+ RewriteRuleSubtreeStream stream_ctfBody=new RewriteRuleSubtreeStream(adaptor,"rule ctfBody");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:3: ( ctfSpecifierHead ctfBody -> ^( ctfSpecifierHead ctfBody ) | typealiasDecl -> ^( DECLARATION typealiasDecl ) )
+ int alt51=2;
+ int LA51_0 = input.LA(1);
+ if ( (LA51_0==CALLSITETOK||LA51_0==CLOCKTOK||LA51_0==ENVTOK||LA51_0==EVENTTOK||LA51_0==STREAMTOK||LA51_0==TRACETOK) ) {
+ alt51=1;
+ }
+ else if ( (LA51_0==TYPEALIASTOK) ) {
+ alt51=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 51, 0, input);
+ throw nvae;
+ }
+
+ switch (alt51) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:5: ctfSpecifierHead ctfBody
+ {
+ pushFollow(FOLLOW_ctfSpecifierHead_in_ctfSpecifier3145);
+ ctfSpecifierHead156=ctfSpecifierHead();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfSpecifierHead.add(ctfSpecifierHead156.getTree());
+ pushFollow(FOLLOW_ctfBody_in_ctfSpecifier3147);
+ ctfBody157=ctfBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody157.getTree());
+ // AST REWRITE
+ // elements: ctfSpecifierHead, ctfBody
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 596:30: -> ^( ctfSpecifierHead ctfBody )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:33: ^( ctfSpecifierHead ctfBody )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot(stream_ctfSpecifierHead.nextNode(), root_1);
+ adaptor.addChild(root_1, stream_ctfBody.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:598:5: typealiasDecl
+ {
+ pushFollow(FOLLOW_typealiasDecl_in_ctfSpecifier3164);
+ typealiasDecl158=typealiasDecl();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typealiasDecl.add(typealiasDecl158.getTree());
+ // AST REWRITE
+ // elements: typealiasDecl
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 598:19: -> ^( DECLARATION typealiasDecl )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:598:22: ^( DECLARATION typealiasDecl )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
+ adaptor.addChild(root_1, stream_typealiasDecl.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfSpecifier"
+
+
+ public static class ctfSpecifierHead_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfSpecifierHead"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:601:1: ctfSpecifierHead : ( EVENTTOK -> EVENT | STREAMTOK -> STREAM | TRACETOK -> TRACE | ENVTOK -> ENV | CLOCKTOK -> CLOCK | CALLSITETOK -> CALLSITE );
+ public final CTFParser.ctfSpecifierHead_return ctfSpecifierHead() throws RecognitionException {
+ CTFParser.ctfSpecifierHead_return retval = new CTFParser.ctfSpecifierHead_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token EVENTTOK159=null;
+ Token STREAMTOK160=null;
+ Token TRACETOK161=null;
+ Token ENVTOK162=null;
+ Token CLOCKTOK163=null;
+ Token CALLSITETOK164=null;
+
+ CommonTree EVENTTOK159_tree=null;
+ CommonTree STREAMTOK160_tree=null;
+ CommonTree TRACETOK161_tree=null;
+ CommonTree ENVTOK162_tree=null;
+ CommonTree CLOCKTOK163_tree=null;
+ CommonTree CALLSITETOK164_tree=null;
+ RewriteRuleTokenStream stream_EVENTTOK=new RewriteRuleTokenStream(adaptor,"token EVENTTOK");
+ RewriteRuleTokenStream stream_CALLSITETOK=new RewriteRuleTokenStream(adaptor,"token CALLSITETOK");
+ RewriteRuleTokenStream stream_STREAMTOK=new RewriteRuleTokenStream(adaptor,"token STREAMTOK");
+ RewriteRuleTokenStream stream_ENVTOK=new RewriteRuleTokenStream(adaptor,"token ENVTOK");
+ RewriteRuleTokenStream stream_CLOCKTOK=new RewriteRuleTokenStream(adaptor,"token CLOCKTOK");
+ RewriteRuleTokenStream stream_TRACETOK=new RewriteRuleTokenStream(adaptor,"token TRACETOK");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:602:3: ( EVENTTOK -> EVENT | STREAMTOK -> STREAM | TRACETOK -> TRACE | ENVTOK -> ENV | CLOCKTOK -> CLOCK | CALLSITETOK -> CALLSITE )
+ int alt52=6;
+ switch ( input.LA(1) ) {
+ case EVENTTOK:
+ {
+ alt52=1;
+ }
+ break;
+ case STREAMTOK:
+ {
+ alt52=2;
+ }
+ break;
+ case TRACETOK:
+ {
+ alt52=3;
+ }
+ break;
+ case ENVTOK:
+ {
+ alt52=4;
+ }
+ break;
+ case CLOCKTOK:
+ {
+ alt52=5;
+ }
+ break;
+ case CALLSITETOK:
+ {
+ alt52=6;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 52, 0, input);
+ throw nvae;
+ }
+ switch (alt52) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:602:5: EVENTTOK
+ {
+ EVENTTOK159=(Token)match(input,EVENTTOK,FOLLOW_EVENTTOK_in_ctfSpecifierHead3185); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_EVENTTOK.add(EVENTTOK159);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 602:14: -> EVENT
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(EVENT, "EVENT"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:603:5: STREAMTOK
+ {
+ STREAMTOK160=(Token)match(input,STREAMTOK,FOLLOW_STREAMTOK_in_ctfSpecifierHead3195); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_STREAMTOK.add(STREAMTOK160);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 603:15: -> STREAM
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(STREAM, "STREAM"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:604:5: TRACETOK
+ {
+ TRACETOK161=(Token)match(input,TRACETOK,FOLLOW_TRACETOK_in_ctfSpecifierHead3205); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TRACETOK.add(TRACETOK161);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 604:14: -> TRACE
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(TRACE, "TRACE"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 4 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:605:5: ENVTOK
+ {
+ ENVTOK162=(Token)match(input,ENVTOK,FOLLOW_ENVTOK_in_ctfSpecifierHead3215); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ENVTOK.add(ENVTOK162);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 605:12: -> ENV
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(ENV, "ENV"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 5 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:606:5: CLOCKTOK
+ {
+ CLOCKTOK163=(Token)match(input,CLOCKTOK,FOLLOW_CLOCKTOK_in_ctfSpecifierHead3225); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_CLOCKTOK.add(CLOCKTOK163);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 606:14: -> CLOCK
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(CLOCK, "CLOCK"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 6 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:607:5: CALLSITETOK
+ {
+ CALLSITETOK164=(Token)match(input,CALLSITETOK,FOLLOW_CALLSITETOK_in_ctfSpecifierHead3235); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_CALLSITETOK.add(CALLSITETOK164);
+
+ // AST REWRITE
+ // elements:
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 607:17: -> CALLSITE
+ {
+ adaptor.addChild(root_0, (CommonTree)adaptor.create(CALLSITE, "CALLSITE"));
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfSpecifierHead"
+
+
+ public static class ctfTypeSpecifier_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfTypeSpecifier"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:610:1: ctfTypeSpecifier : ( FLOATINGPOINTTOK ctfBody -> ^( FLOATING_POINT ( ctfBody )? ) | INTEGERTOK ctfBody -> ^( INTEGER ( ctfBody )? ) | STRINGTOK ( ctfBody )? -> ^( STRING ( ctfBody )? ) );
+ public final CTFParser.ctfTypeSpecifier_return ctfTypeSpecifier() throws RecognitionException {
+ CTFParser.ctfTypeSpecifier_return retval = new CTFParser.ctfTypeSpecifier_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token FLOATINGPOINTTOK165=null;
+ Token INTEGERTOK167=null;
+ Token STRINGTOK169=null;
+ ParserRuleReturnScope ctfBody166 =null;
+ ParserRuleReturnScope ctfBody168 =null;
+ ParserRuleReturnScope ctfBody170 =null;
+
+ CommonTree FLOATINGPOINTTOK165_tree=null;
+ CommonTree INTEGERTOK167_tree=null;
+ CommonTree STRINGTOK169_tree=null;
+ RewriteRuleTokenStream stream_FLOATINGPOINTTOK=new RewriteRuleTokenStream(adaptor,"token FLOATINGPOINTTOK");
+ RewriteRuleTokenStream stream_STRINGTOK=new RewriteRuleTokenStream(adaptor,"token STRINGTOK");
+ RewriteRuleTokenStream stream_INTEGERTOK=new RewriteRuleTokenStream(adaptor,"token INTEGERTOK");
+ RewriteRuleSubtreeStream stream_ctfBody=new RewriteRuleSubtreeStream(adaptor,"rule ctfBody");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:3: ( FLOATINGPOINTTOK ctfBody -> ^( FLOATING_POINT ( ctfBody )? ) | INTEGERTOK ctfBody -> ^( INTEGER ( ctfBody )? ) | STRINGTOK ( ctfBody )? -> ^( STRING ( ctfBody )? ) )
+ int alt54=3;
+ switch ( input.LA(1) ) {
+ case FLOATINGPOINTTOK:
+ {
+ alt54=1;
+ }
+ break;
+ case INTEGERTOK:
+ {
+ alt54=2;
+ }
+ break;
+ case STRINGTOK:
+ {
+ alt54=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 54, 0, input);
+ throw nvae;
+ }
+ switch (alt54) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:5: FLOATINGPOINTTOK ctfBody
+ {
+ FLOATINGPOINTTOK165=(Token)match(input,FLOATINGPOINTTOK,FOLLOW_FLOATINGPOINTTOK_in_ctfTypeSpecifier3258); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_FLOATINGPOINTTOK.add(FLOATINGPOINTTOK165);
+
+ pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3260);
+ ctfBody166=ctfBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody166.getTree());
+ // AST REWRITE
+ // elements: ctfBody
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 612:30: -> ^( FLOATING_POINT ( ctfBody )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:33: ^( FLOATING_POINT ( ctfBody )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FLOATING_POINT, "FLOATING_POINT"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:50: ( ctfBody )?
+ if ( stream_ctfBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_ctfBody.nextTree());
+ }
+ stream_ctfBody.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:5: INTEGERTOK ctfBody
+ {
+ INTEGERTOK167=(Token)match(input,INTEGERTOK,FOLLOW_INTEGERTOK_in_ctfTypeSpecifier3275); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_INTEGERTOK.add(INTEGERTOK167);
+
+ pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3277);
+ ctfBody168=ctfBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody168.getTree());
+ // AST REWRITE
+ // elements: ctfBody
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 613:24: -> ^( INTEGER ( ctfBody )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:27: ^( INTEGER ( ctfBody )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(INTEGER, "INTEGER"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:37: ( ctfBody )?
+ if ( stream_ctfBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_ctfBody.nextTree());
+ }
+ stream_ctfBody.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:5: STRINGTOK ( ctfBody )?
+ {
+ STRINGTOK169=(Token)match(input,STRINGTOK,FOLLOW_STRINGTOK_in_ctfTypeSpecifier3292); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_STRINGTOK.add(STRINGTOK169);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:15: ( ctfBody )?
+ int alt53=2;
+ int LA53_0 = input.LA(1);
+ if ( (LA53_0==LCURL) ) {
+ alt53=1;
+ }
+ switch (alt53) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:15: ctfBody
+ {
+ pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3294);
+ ctfBody170=ctfBody();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody170.getTree());
+ }
+ break;
+
+ }
+
+ // AST REWRITE
+ // elements: ctfBody
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 614:24: -> ^( STRING ( ctfBody )? )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:27: ^( STRING ( ctfBody )? )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRING, "STRING"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:36: ( ctfBody )?
+ if ( stream_ctfBody.hasNext() ) {
+ adaptor.addChild(root_1, stream_ctfBody.nextTree());
+ }
+ stream_ctfBody.reset();
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfTypeSpecifier"
+
+
+ public static class ctfBody_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfBody"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:617:1: ctfBody : LCURL ( ctfAssignmentExpressionList )? RCURL -> ( ctfAssignmentExpressionList )? ;
+ public final CTFParser.ctfBody_return ctfBody() throws RecognitionException {
+ Symbols_stack.push(new Symbols_scope());
+
+ CTFParser.ctfBody_return retval = new CTFParser.ctfBody_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token LCURL171=null;
+ Token RCURL173=null;
+ ParserRuleReturnScope ctfAssignmentExpressionList172 =null;
+
+ CommonTree LCURL171_tree=null;
+ CommonTree RCURL173_tree=null;
+ RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
+ RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
+ RewriteRuleSubtreeStream stream_ctfAssignmentExpressionList=new RewriteRuleSubtreeStream(adaptor,"rule ctfAssignmentExpressionList");
+
+
+ Symbols_stack.peek().types = new HashSet<String>();
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:3: ( LCURL ( ctfAssignmentExpressionList )? RCURL -> ( ctfAssignmentExpressionList )? )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:5: LCURL ( ctfAssignmentExpressionList )? RCURL
+ {
+ LCURL171=(Token)match(input,LCURL,FOLLOW_LCURL_in_ctfBody3327); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_LCURL.add(LCURL171);
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:11: ( ctfAssignmentExpressionList )?
+ int alt55=2;
+ int LA55_0 = input.LA(1);
+ if ( (LA55_0==ALIGNTOK||(LA55_0 >= BOOLTOK && LA55_0 <= CHARTOK)||LA55_0==CLOCKTOK||(LA55_0 >= COMPLEXTOK && LA55_0 <= DECIMAL_LITERAL)||LA55_0==DOUBLETOK||(LA55_0 >= ENUMTOK && LA55_0 <= ENVTOK)||(LA55_0 >= EVENTTOK && LA55_0 <= FLOATTOK)||LA55_0==HEX_LITERAL||(LA55_0 >= IDENTIFIER && LA55_0 <= IMAGINARYTOK)||LA55_0==INTEGERTOK||LA55_0==INTTOK||LA55_0==LONGTOK||LA55_0==OCTAL_LITERAL||(LA55_0 >= SHORTTOK && LA55_0 <= SIGNEDTOK)||LA55_0==STREAMTOK||LA55_0==STRINGTOK||(LA55_0 >= STRING_LITERAL && LA55_0 <= STRUCTTOK)||(LA55_0 >= TRACETOK && LA55_0 <= TYPEDEFTOK)||(LA55_0 >= UNSIGNEDTOK && LA55_0 <= VOIDTOK)) ) {
+ alt55=1;
+ }
+ switch (alt55) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:11: ctfAssignmentExpressionList
+ {
+ pushFollow(FOLLOW_ctfAssignmentExpressionList_in_ctfBody3329);
+ ctfAssignmentExpressionList172=ctfAssignmentExpressionList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ctfAssignmentExpressionList.add(ctfAssignmentExpressionList172.getTree());
+ }
+ break;
+
+ }
+
+ RCURL173=(Token)match(input,RCURL,FOLLOW_RCURL_in_ctfBody3332); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_RCURL.add(RCURL173);
+
+ // AST REWRITE
+ // elements: ctfAssignmentExpressionList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 622:46: -> ( ctfAssignmentExpressionList )?
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:49: ( ctfAssignmentExpressionList )?
+ if ( stream_ctfAssignmentExpressionList.hasNext() ) {
+ adaptor.addChild(root_0, stream_ctfAssignmentExpressionList.nextTree());
+ }
+ stream_ctfAssignmentExpressionList.reset();
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ Symbols_stack.pop();
+
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfBody"
+
+
+ public static class ctfAssignmentExpressionList_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfAssignmentExpressionList"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:625:1: ctfAssignmentExpressionList : ( ctfAssignmentExpression TERM !)+ ;
+ public final CTFParser.ctfAssignmentExpressionList_return ctfAssignmentExpressionList() throws RecognitionException {
+ CTFParser.ctfAssignmentExpressionList_return retval = new CTFParser.ctfAssignmentExpressionList_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token TERM175=null;
+ ParserRuleReturnScope ctfAssignmentExpression174 =null;
+
+ CommonTree TERM175_tree=null;
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:3: ( ( ctfAssignmentExpression TERM !)+ )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:5: ( ctfAssignmentExpression TERM !)+
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:5: ( ctfAssignmentExpression TERM !)+
+ int cnt56=0;
+ loop56:
+ while (true) {
+ int alt56=2;
+ int LA56_0 = input.LA(1);
+ if ( (LA56_0==ALIGNTOK||(LA56_0 >= BOOLTOK && LA56_0 <= CHARTOK)||LA56_0==CLOCKTOK||(LA56_0 >= COMPLEXTOK && LA56_0 <= DECIMAL_LITERAL)||LA56_0==DOUBLETOK||(LA56_0 >= ENUMTOK && LA56_0 <= ENVTOK)||(LA56_0 >= EVENTTOK && LA56_0 <= FLOATTOK)||LA56_0==HEX_LITERAL||(LA56_0 >= IDENTIFIER && LA56_0 <= IMAGINARYTOK)||LA56_0==INTEGERTOK||LA56_0==INTTOK||LA56_0==LONGTOK||LA56_0==OCTAL_LITERAL||(LA56_0 >= SHORTTOK && LA56_0 <= SIGNEDTOK)||LA56_0==STREAMTOK||LA56_0==STRINGTOK||(LA56_0 >= STRING_LITERAL && LA56_0 <= STRUCTTOK)||(LA56_0 >= TRACETOK && LA56_0 <= TYPEDEFTOK)||(LA56_0 >= UNSIGNEDTOK && LA56_0 <= VOIDTOK)) ) {
+ alt56=1;
+ }
+
+ switch (alt56) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:6: ctfAssignmentExpression TERM !
+ {
+ pushFollow(FOLLOW_ctfAssignmentExpression_in_ctfAssignmentExpressionList3351);
+ ctfAssignmentExpression174=ctfAssignmentExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfAssignmentExpression174.getTree());
+
+ TERM175=(Token)match(input,TERM,FOLLOW_TERM_in_ctfAssignmentExpressionList3353); if (state.failed) return retval;
+ }
+ break;
+
+ default :
+ if ( cnt56 >= 1 ) break loop56;
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ EarlyExitException eee = new EarlyExitException(56, input);
+ throw eee;
+ }
+ cnt56++;
+ }
+
+ }
+
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfAssignmentExpressionList"
+
+
+ public static class ctfAssignmentExpression_return extends ParserRuleReturnScope {
+ CommonTree tree;
+ @Override
+ public CommonTree getTree() { return tree; }
+ };
+
+
+ // $ANTLR start "ctfAssignmentExpression"
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:629:1: ctfAssignmentExpression : (left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) ) | ( declarationSpecifiers {...}? declaratorList ) -> ^( TYPEDEF declaratorList declarationSpecifiers ) | typealiasDecl );
+ public final CTFParser.ctfAssignmentExpression_return ctfAssignmentExpression() throws RecognitionException {
+ CTFParser.ctfAssignmentExpression_return retval = new CTFParser.ctfAssignmentExpression_return();
+ retval.start = input.LT(1);
+
+ CommonTree root_0 = null;
+
+ Token assignment=null;
+ Token type_assignment=null;
+ ParserRuleReturnScope left =null;
+ ParserRuleReturnScope right1 =null;
+ ParserRuleReturnScope right2 =null;
+ ParserRuleReturnScope declarationSpecifiers176 =null;
+ ParserRuleReturnScope declaratorList177 =null;
+ ParserRuleReturnScope typealiasDecl178 =null;
+
+ CommonTree assignment_tree=null;
+ CommonTree type_assignment_tree=null;
+ RewriteRuleTokenStream stream_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token ASSIGNMENT");
+ RewriteRuleTokenStream stream_TYPE_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token TYPE_ASSIGNMENT");
+ RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
+ RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
+ RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
+ RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
+
+ try {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:635:3: (left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) ) | ( declarationSpecifiers {...}? declaratorList ) -> ^( TYPEDEF declaratorList declarationSpecifiers ) | typealiasDecl )
+ int alt58=3;
+ switch ( input.LA(1) ) {
+ case IDENTIFIER:
+ {
+ int LA58_1 = input.LA(2);
+ if ( ((LA58_1 >= ARROW && LA58_1 <= ASSIGNMENT)||LA58_1==DOT||LA58_1==OPENBRAC||LA58_1==TYPE_ASSIGNMENT) ) {
+ alt58=1;
+ }
+ else if ( (LA58_1==BOOLTOK||LA58_1==CHARTOK||(LA58_1 >= COMPLEXTOK && LA58_1 <= CONSTTOK)||LA58_1==DOUBLETOK||LA58_1==ENUMTOK||(LA58_1 >= FLOATINGPOINTTOK && LA58_1 <= FLOATTOK)||(LA58_1 >= IDENTIFIER && LA58_1 <= IMAGINARYTOK)||LA58_1==INTEGERTOK||LA58_1==INTTOK||LA58_1==LONGTOK||LA58_1==POINTER||LA58_1==SHORTTOK||LA58_1==SIGNEDTOK||LA58_1==STRINGTOK||LA58_1==STRUCTTOK||LA58_1==TYPEDEFTOK||(LA58_1 >= UNSIGNEDTOK && LA58_1 <= VOIDTOK)) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
+ alt58=2;
+ }
+
+ }
+ break;
+ case ALIGNTOK:
+ case CALLSITETOK:
+ case CHARACTER_LITERAL:
+ case CLOCKTOK:
+ case DECIMAL_LITERAL:
+ case ENVTOK:
+ case EVENTTOK:
+ case HEX_LITERAL:
+ case OCTAL_LITERAL:
+ case SIGN:
+ case STREAMTOK:
+ case STRING_LITERAL:
+ case TRACETOK:
+ {
+ alt58=1;
+ }
+ break;
+ case SIGNEDTOK:
+ {
+ switch ( input.LA(2) ) {
+ case ARROW:
+ case ASSIGNMENT:
+ case DOT:
+ case OPENBRAC:
+ case TYPE_ASSIGNMENT:
+ {
+ alt58=1;
+ }
+ break;
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IDENTIFIER:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case POINTER:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt58=2;
+ }
+ break;
+ case TYPEDEFTOK:
+ {
+ alt58=2;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 58, 3, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+ }
+ break;
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LONGTOK:
+ case SHORTTOK:
+ case STRUCTTOK:
+ case TYPEDEFTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt58=2;
+ }
+ break;
+ case STRINGTOK:
+ {
+ switch ( input.LA(2) ) {
+ case ARROW:
+ case ASSIGNMENT:
+ case DOT:
+ case OPENBRAC:
+ case TYPE_ASSIGNMENT:
+ {
+ alt58=1;
+ }
+ break;
+ case BOOLTOK:
+ case CHARTOK:
+ case COMPLEXTOK:
+ case CONSTTOK:
+ case DOUBLETOK:
+ case ENUMTOK:
+ case FLOATINGPOINTTOK:
+ case FLOATTOK:
+ case IDENTIFIER:
+ case IMAGINARYTOK:
+ case INTEGERTOK:
+ case INTTOK:
+ case LCURL:
+ case LONGTOK:
+ case POINTER:
+ case SHORTTOK:
+ case SIGNEDTOK:
+ case STRINGTOK:
+ case STRUCTTOK:
+ case UNSIGNEDTOK:
+ case VARIANTTOK:
+ case VOIDTOK:
+ {
+ alt58=2;
+ }
+ break;
+ case TYPEDEFTOK:
+ {
+ alt58=2;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ int nvaeMark = input.mark();
+ try {
+ input.consume();
+ NoViableAltException nvae =
+ new NoViableAltException("", 58, 5, input);
+ throw nvae;
+ } finally {
+ input.rewind(nvaeMark);
+ }
+ }
+ }
+ break;
+ case TYPEALIASTOK:
+ {
+ alt58=3;
+ }
+ break;
+ default:
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 58, 0, input);
+ throw nvae;
+ }
+ switch (alt58) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:635:5: left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) )
+ {
+ pushFollow(FOLLOW_unaryExpression_in_ctfAssignmentExpression3376);
+ left=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_unaryExpression.add(left.getTree());
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:636:7: (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) )
+ int alt57=2;
+ int LA57_0 = input.LA(1);
+ if ( (LA57_0==ASSIGNMENT) ) {
+ alt57=1;
+ }
+ else if ( (LA57_0==TYPE_ASSIGNMENT) ) {
+ alt57=2;
+ }
+
+ else {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ NoViableAltException nvae =
+ new NoViableAltException("", 57, 0, input);
+ throw nvae;
+ }
+
+ switch (alt57) {
+ case 1 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:636:9: assignment= ASSIGNMENT right1= unaryExpression
+ {
+ assignment=(Token)match(input,ASSIGNMENT,FOLLOW_ASSIGNMENT_in_ctfAssignmentExpression3388); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_ASSIGNMENT.add(assignment);
+
+ pushFollow(FOLLOW_unaryExpression_in_ctfAssignmentExpression3392);
+ right1=unaryExpression();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_unaryExpression.add(right1.getTree());
+ // AST REWRITE
+ // elements: right1, left
+ // token labels:
+ // rule labels: retval, left, right1
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+ RewriteRuleSubtreeStream stream_left=new RewriteRuleSubtreeStream(adaptor,"rule left",left!=null?left.getTree():null);
+ RewriteRuleSubtreeStream stream_right1=new RewriteRuleSubtreeStream(adaptor,"rule right1",right1!=null?right1.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 637:11: -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:637:14: ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_EXPRESSION_VAL, "CTF_EXPRESSION_VAL"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:638:18: ^( CTF_LEFT $left)
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_LEFT, "CTF_LEFT"), root_2);
+ adaptor.addChild(root_2, stream_left.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:639:18: ^( CTF_RIGHT $right1)
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_RIGHT, "CTF_RIGHT"), root_2);
+ adaptor.addChild(root_2, stream_right1.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:640:9: type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier
+ {
+ type_assignment=(Token)match(input,TYPE_ASSIGNMENT,FOLLOW_TYPE_ASSIGNMENT_in_ctfAssignmentExpression3468); if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_TYPE_ASSIGNMENT.add(type_assignment);
+
+ pushFollow(FOLLOW_typeSpecifier_in_ctfAssignmentExpression3472);
+ right2=typeSpecifier();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_typeSpecifier.add(right2.getTree());
+ // AST REWRITE
+ // elements: right2, left
+ // token labels:
+ // rule labels: retval, left, right2
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+ RewriteRuleSubtreeStream stream_left=new RewriteRuleSubtreeStream(adaptor,"rule left",left!=null?left.getTree():null);
+ RewriteRuleSubtreeStream stream_right2=new RewriteRuleSubtreeStream(adaptor,"rule right2",right2!=null?right2.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 641:11: -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:641:14: ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_EXPRESSION_TYPE, "CTF_EXPRESSION_TYPE"), root_1);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:642:18: ^( CTF_LEFT $left)
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_LEFT, "CTF_LEFT"), root_2);
+ adaptor.addChild(root_2, stream_left.nextTree());
+ adaptor.addChild(root_1, root_2);
+ }
+
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:643:18: ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) )
+ {
+ CommonTree root_2 = (CommonTree)adaptor.nil();
+ root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_RIGHT, "CTF_RIGHT"), root_2);
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:643:30: ^( TYPE_SPECIFIER_LIST $right2)
+ {
+ CommonTree root_3 = (CommonTree)adaptor.nil();
+ root_3 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_3);
+ adaptor.addChild(root_3, stream_right2.nextTree());
+ adaptor.addChild(root_2, root_3);
+ }
+
+ adaptor.addChild(root_1, root_2);
+ }
+
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+
+ }
+
+ }
+ break;
+ case 2 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:5: ( declarationSpecifiers {...}? declaratorList )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:5: ( declarationSpecifiers {...}? declaratorList )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:6: declarationSpecifiers {...}? declaratorList
+ {
+ pushFollow(FOLLOW_declarationSpecifiers_in_ctfAssignmentExpression3555);
+ declarationSpecifiers176=declarationSpecifiers();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers176.getTree());
+ if ( !((inTypedef())) ) {
+ if (state.backtracking>0) {state.failed=true; return retval;}
+ throw new FailedPredicateException(input, "ctfAssignmentExpression", "inTypedef()");
+ }
+ pushFollow(FOLLOW_declaratorList_in_ctfAssignmentExpression3559);
+ declaratorList177=declaratorList();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList177.getTree());
+ }
+
+ // AST REWRITE
+ // elements: declarationSpecifiers, declaratorList
+ // token labels:
+ // rule labels: retval
+ // token list labels:
+ // rule list labels:
+ // wildcard labels:
+ if ( state.backtracking==0 ) {
+ retval.tree = root_0;
+ RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
+
+ root_0 = (CommonTree)adaptor.nil();
+ // 646:7: -> ^( TYPEDEF declaratorList declarationSpecifiers )
+ {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:646:10: ^( TYPEDEF declaratorList declarationSpecifiers )
+ {
+ CommonTree root_1 = (CommonTree)adaptor.nil();
+ root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_1);
+ adaptor.addChild(root_1, stream_declaratorList.nextTree());
+ adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
+ adaptor.addChild(root_0, root_1);
+ }
+
+ }
+
+
+ retval.tree = root_0;
+ }
+
+ }
+ break;
+ case 3 :
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:647:5: typealiasDecl
+ {
+ root_0 = (CommonTree)adaptor.nil();
+
+
+ pushFollow(FOLLOW_typealiasDecl_in_ctfAssignmentExpression3582);
+ typealiasDecl178=typealiasDecl();
+ state._fsp--;
+ if (state.failed) return retval;
+ if ( state.backtracking==0 ) adaptor.addChild(root_0, typealiasDecl178.getTree());
+
+ }
+ break;
+
+ }
+ retval.stop = input.LT(-1);
+
+ if ( state.backtracking==0 ) {
+ retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
+ adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
+ }
+ if ( state.backtracking==0 ) {
+ if (inTypedef()) {
+ typedefOff();
+ }
+ }
+ }
+
+ catch (RecognitionException e) {
+ throw e;
+ }
+
+ finally {
+ // do for sure before leaving
+ }
+ return retval;
+ }
+ // $ANTLR end "ctfAssignmentExpression"
+
+ // $ANTLR start synpred1_CTFParser
+ public final void synpred1_CTFParser_fragment() throws RecognitionException {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:5: ( IDENTIFIER )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:6: IDENTIFIER
+ {
+ match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_synpred1_CTFParser560); if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred1_CTFParser
+
+ // $ANTLR start synpred2_CTFParser
+ public final void synpred2_CTFParser_fragment() throws RecognitionException {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:5: ( ctfKeyword )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:6: ctfKeyword
+ {
+ pushFollow(FOLLOW_ctfKeyword_in_synpred2_CTFParser586);
+ ctfKeyword();
+ state._fsp--;
+ if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred2_CTFParser
+
+ // $ANTLR start synpred3_CTFParser
+ public final void synpred3_CTFParser_fragment() throws RecognitionException {
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:5: ( STRING_LITERAL )
+ // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:6: STRING_LITERAL
+ {
+ match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_synpred3_CTFParser606); if (state.failed) return;
+
+ }
+
+ }
+ // $ANTLR end synpred3_CTFParser
+
+ // Delegated rules
+
+ public final boolean synpred2_CTFParser() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred2_CTFParser_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !state.failed;
+ input.rewind(start);
+ state.backtracking--;
+ state.failed=false;
+ return success;
+ }
+ public final boolean synpred1_CTFParser() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred1_CTFParser_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !state.failed;
+ input.rewind(start);
+ state.backtracking--;
+ state.failed=false;
+ return success;
+ }
+ public final boolean synpred3_CTFParser() {
+ state.backtracking++;
+ int start = input.mark();
+ try {
+ synpred3_CTFParser_fragment(); // can never throw exception
+ } catch (RecognitionException re) {
+ System.err.println("impossible: "+re);
+ }
+ boolean success = !state.failed;
+ input.rewind(start);
+ state.backtracking--;
+ state.failed=false;
+ return success;
+ }
+
+
+ protected DFA23 dfa23 = new DFA23(this);
+ static final String DFA23_eotS =
+ "\10\uffff";
+ static final String DFA23_eofS =
+ "\10\uffff";
+ static final String DFA23_minS =
+ "\1\46\1\24\1\0\1\24\1\0\2\uffff\1\0";
+ static final String DFA23_maxS =
+ "\2\72\1\0\1\72\1\0\2\uffff\1\0";
+ static final String DFA23_acceptS =
+ "\5\uffff\1\1\1\2\1\uffff";
+ static final String DFA23_specialS =
+ "\2\uffff\1\2\1\uffff\1\1\2\uffff\1\0}>";
+ static final String[] DFA23_transitionS = {
+ "\1\2\23\uffff\1\1",
+ "\1\3\21\uffff\1\4\23\uffff\1\1",
+ "\1\uffff",
+ "\1\3\21\uffff\1\7\23\uffff\1\1",
+ "\1\uffff",
+ "",
+ "",
+ "\1\uffff"
+ };
+
+ static final short[] DFA23_eot = DFA.unpackEncodedString(DFA23_eotS);
+ static final short[] DFA23_eof = DFA.unpackEncodedString(DFA23_eofS);
+ static final char[] DFA23_min = DFA.unpackEncodedStringToUnsignedChars(DFA23_minS);
+ static final char[] DFA23_max = DFA.unpackEncodedStringToUnsignedChars(DFA23_maxS);
+ static final short[] DFA23_accept = DFA.unpackEncodedString(DFA23_acceptS);
+ static final short[] DFA23_special = DFA.unpackEncodedString(DFA23_specialS);
+ static final short[][] DFA23_transition;
+
+ static {
+ int numStates = DFA23_transitionS.length;
+ DFA23_transition = new short[numStates][];
+ for (int i=0; i<numStates; i++) {
+ DFA23_transition[i] = DFA.unpackEncodedString(DFA23_transitionS[i]);
+ }
+ }
+
+ protected class DFA23 extends DFA {
+
+ public DFA23(BaseRecognizer recognizer) {
+ this.recognizer = recognizer;
+ this.decisionNumber = 23;
+ this.eot = DFA23_eot;
+ this.eof = DFA23_eof;
+ this.min = DFA23_min;
+ this.max = DFA23_max;
+ this.accept = DFA23_accept;
+ this.special = DFA23_special;
+ this.transition = DFA23_transition;
+ }
+ @Override
+ public String getDescription() {
+ return "368:10: ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )";
+ }
+ @Override
+ public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
+ TokenStream input = (TokenStream)_input;
+ int _s = s;
+ switch ( s ) {
+ case 0 :
+ int LA23_7 = input.LA(1);
+
+ int index23_7 = input.index();
+ input.rewind();
+ s = -1;
+ if ( ((inTypedef())) ) {s = 5;}
+ else if ( (true) ) {s = 6;}
+
+ input.seek(index23_7);
+ if ( s>=0 ) return s;
+ break;
+
+ case 1 :
+ int LA23_4 = input.LA(1);
+
+ int index23_4 = input.index();
+ input.rewind();
+ s = -1;
+ if ( ((inTypedef())) ) {s = 5;}
+ else if ( (true) ) {s = 6;}
+
+ input.seek(index23_4);
+ if ( s>=0 ) return s;
+ break;
+
+ case 2 :
+ int LA23_2 = input.LA(1);
+
+ int index23_2 = input.index();
+ input.rewind();
+ s = -1;
+ if ( ((inTypedef())) ) {s = 5;}
+ else if ( (true) ) {s = 6;}
+
+ input.seek(index23_2);
+ if ( s>=0 ) return s;
+ break;
+ }
+ if (state.backtracking>0) {state.failed=true; return -1;}
+ NoViableAltException nvae =
+ new NoViableAltException(getDescription(), 23, _s, input);
+ error(nvae);
+ throw nvae;
+ }
+ }
+
+ public static final BitSet FOLLOW_declaration_in_parse449 = new BitSet(new long[]{0x40004AC1DA182B00L,0x000000000001CE95L});
+ public static final BitSet FOLLOW_EOF_in_parse452 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_SIGN_in_numberLiteral474 = new BitSet(new long[]{0x8040001000200000L});
+ public static final BitSet FOLLOW_HEX_LITERAL_in_numberLiteral485 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_DECIMAL_LITERAL_in_numberLiteral506 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_OCTAL_LITERAL_in_numberLiteral527 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_primaryExpression565 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfKeyword_in_primaryExpression591 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_LITERAL_in_primaryExpression611 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_numberLiteral_in_primaryExpression636 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumConstant_in_primaryExpression642 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_CHARACTER_LITERAL_in_primaryExpression648 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_OPENBRAC_in_postfixExpressionSuffix661 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_postfixExpressionSuffix663 = new BitSet(new long[]{0x0000000000004000L});
+ public static final BitSet FOLLOW_CLOSEBRAC_in_postfixExpressionSuffix665 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_DOT_in_postfixExpressionSuffix675 = new BitSet(new long[]{0x0000004000000000L});
+ public static final BitSet FOLLOW_ARROW_in_postfixExpressionSuffix681 = new BitSet(new long[]{0x0000004000000000L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_postfixExpressionSuffix684 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_primaryExpression_in_postfixExpression716 = new BitSet(new long[]{0x0200000000800022L});
+ public static final BitSet FOLLOW_postfixExpressionSuffix_in_postfixExpression718 = new BitSet(new long[]{0x0200000000800022L});
+ public static final BitSet FOLLOW_ctfSpecifierHead_in_postfixExpression725 = new BitSet(new long[]{0x0200000000800020L});
+ public static final BitSet FOLLOW_postfixExpressionSuffix_in_postfixExpression727 = new BitSet(new long[]{0x0200000000800022L});
+ public static final BitSet FOLLOW_postfixExpression_in_unaryExpression743 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_LITERAL_in_enumConstant760 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_enumConstant774 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfKeyword_in_enumConstant788 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_declaration816 = new BitSet(new long[]{0x0400004000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_declaratorList_in_declaration818 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_TERM_in_declaration821 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfSpecifier_in_declaration889 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_TERM_in_declaration891 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_storageClassSpecifier_in_declarationSpecifiers929 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
+ public static final BitSet FOLLOW_typeQualifier_in_declarationSpecifiers939 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
+ public static final BitSet FOLLOW_typeSpecifier_in_declarationSpecifiers949 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
+ public static final BitSet FOLLOW_declarator_in_declaratorList979 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_SEPARATOR_in_declaratorList982 = new BitSet(new long[]{0x0400004000000000L});
+ public static final BitSet FOLLOW_declarator_in_declaratorList984 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_abstractDeclarator_in_abstractDeclaratorList1014 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_SEPARATOR_in_abstractDeclaratorList1017 = new BitSet(new long[]{0x0400804000000000L});
+ public static final BitSet FOLLOW_abstractDeclarator_in_abstractDeclaratorList1019 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_TYPEDEFTOK_in_storageClassSpecifier1049 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOATTOK_in_typeSpecifier1065 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INTTOK_in_typeSpecifier1071 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LONGTOK_in_typeSpecifier1077 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_SHORTTOK_in_typeSpecifier1083 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_SIGNEDTOK_in_typeSpecifier1089 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_UNSIGNEDTOK_in_typeSpecifier1095 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_CHARTOK_in_typeSpecifier1101 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_DOUBLETOK_in_typeSpecifier1107 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VOIDTOK_in_typeSpecifier1113 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOLTOK_in_typeSpecifier1119 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_COMPLEXTOK_in_typeSpecifier1125 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IMAGINARYTOK_in_typeSpecifier1131 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_structSpecifier_in_typeSpecifier1137 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variantSpecifier_in_typeSpecifier1143 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumSpecifier_in_typeSpecifier1149 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfTypeSpecifier_in_typeSpecifier1155 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_typedefName_in_typeSpecifier1165 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_CONSTTOK_in_typeQualifier1178 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ALIGNTOK_in_alignAttribute1191 = new BitSet(new long[]{0x0000800000000000L});
+ public static final BitSet FOLLOW_LPAREN_in_alignAttribute1193 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_alignAttribute1195 = new BitSet(new long[]{0x1000000000000000L});
+ public static final BitSet FOLLOW_RPAREN_in_alignAttribute1197 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LCURL_in_structBody1231 = new BitSet(new long[]{0x48004AC18A180900L,0x000000000001CC91L});
+ public static final BitSet FOLLOW_structOrVariantDeclarationList_in_structBody1233 = new BitSet(new long[]{0x0800000000000000L});
+ public static final BitSet FOLLOW_RCURL_in_structBody1236 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRUCTTOK_in_structSpecifier1264 = new BitSet(new long[]{0x0000104000000000L});
+ public static final BitSet FOLLOW_structName_in_structSpecifier1289 = new BitSet(new long[]{0x0000100000000012L});
+ public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1311 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_structBody_in_structSpecifier1347 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1378 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_structBody_in_structSpecifier1494 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1512 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_structName1578 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_structOrVariantDeclaration_in_structOrVariantDeclarationList1599 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001CC91L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_structOrVariantDeclaration1632 = new BitSet(new long[]{0x0400004000000000L});
+ public static final BitSet FOLLOW_declaratorList_in_structOrVariantDeclaration1673 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_structOrVariantDeclaratorList_in_structOrVariantDeclaration1713 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_typealiasDecl_in_structOrVariantDeclaration1772 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_TERM_in_structOrVariantDeclaration1784 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_typeQualifier_in_specifierQualifierList1798 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C091L});
+ public static final BitSet FOLLOW_typeSpecifier_in_specifierQualifierList1802 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C091L});
+ public static final BitSet FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1835 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_SEPARATOR_in_structOrVariantDeclaratorList1838 = new BitSet(new long[]{0x0400004000000000L});
+ public static final BitSet FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1840 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_declarator_in_structOrVariantDeclarator1879 = new BitSet(new long[]{0x0000000000008002L});
+ public static final BitSet FOLLOW_COLON_in_structOrVariantDeclarator1882 = new BitSet(new long[]{0x8040001000200000L});
+ public static final BitSet FOLLOW_numberLiteral_in_structOrVariantDeclarator1884 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_VARIANTTOK_in_variantSpecifier1908 = new BitSet(new long[]{0x0001104000000000L});
+ public static final BitSet FOLLOW_variantName_in_variantSpecifier1926 = new BitSet(new long[]{0x0001100000000000L});
+ public static final BitSet FOLLOW_variantTag_in_variantSpecifier1956 = new BitSet(new long[]{0x0000100000000002L});
+ public static final BitSet FOLLOW_variantBody_in_variantSpecifier1982 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variantBody_in_variantSpecifier2050 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variantTag_in_variantSpecifier2071 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_variantBody_in_variantSpecifier2073 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_variantBody_in_variantSpecifier2080 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_variantName2112 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LCURL_in_variantBody2143 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001CC91L});
+ public static final BitSet FOLLOW_structOrVariantDeclarationList_in_variantBody2145 = new BitSet(new long[]{0x0800000000000000L});
+ public static final BitSet FOLLOW_RCURL_in_variantBody2147 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LT_in_variantTag2174 = new BitSet(new long[]{0x0000004000000000L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_variantTag2176 = new BitSet(new long[]{0x0000000200000000L});
+ public static final BitSet FOLLOW_GT_in_variantTag2178 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ENUMTOK_in_enumSpecifier2199 = new BitSet(new long[]{0x0000104000008000L});
+ public static final BitSet FOLLOW_enumName_in_enumSpecifier2238 = new BitSet(new long[]{0x0000100000008002L});
+ public static final BitSet FOLLOW_enumContainerType_in_enumSpecifier2270 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_enumBody_in_enumSpecifier2272 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumBody_in_enumSpecifier2302 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumContainerType_in_enumSpecifier2394 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_enumBody_in_enumSpecifier2396 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumBody_in_enumSpecifier2420 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_enumName2464 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LCURL_in_enumBody2485 = new BitSet(new long[]{0x0000004040000010L,0x0000000000000051L});
+ public static final BitSet FOLLOW_enumeratorList_in_enumBody2487 = new BitSet(new long[]{0x2800000000000000L});
+ public static final BitSet FOLLOW_SEPARATOR_in_enumBody2489 = new BitSet(new long[]{0x0800000000000000L});
+ public static final BitSet FOLLOW_RCURL_in_enumBody2492 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_COLON_in_enumContainerType2513 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001C891L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_enumContainerType2515 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_enumerator_in_enumeratorList2536 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_SEPARATOR_in_enumeratorList2539 = new BitSet(new long[]{0x0000004040000010L,0x0000000000000051L});
+ public static final BitSet FOLLOW_enumerator_in_enumeratorList2541 = new BitSet(new long[]{0x2000000000000002L});
+ public static final BitSet FOLLOW_enumConstant_in_enumerator2567 = new BitSet(new long[]{0x0000000000000042L});
+ public static final BitSet FOLLOW_enumeratorValue_in_enumerator2569 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ASSIGNMENT_in_enumeratorValue2583 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_enumeratorValue2587 = new BitSet(new long[]{0x0000000004000002L});
+ public static final BitSet FOLLOW_ELIPSES_in_enumeratorValue2626 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_enumeratorValue2630 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_pointer_in_declarator2673 = new BitSet(new long[]{0x0400004000000000L});
+ public static final BitSet FOLLOW_directDeclarator_in_declarator2676 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_directDeclarator2714 = new BitSet(new long[]{0x0200000000000002L});
+ public static final BitSet FOLLOW_directDeclaratorSuffix_in_directDeclarator2754 = new BitSet(new long[]{0x0200000000000002L});
+ public static final BitSet FOLLOW_OPENBRAC_in_directDeclaratorSuffix2768 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_directDeclaratorLength_in_directDeclaratorSuffix2770 = new BitSet(new long[]{0x0000000000004000L});
+ public static final BitSet FOLLOW_CLOSEBRAC_in_directDeclaratorSuffix2772 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_unaryExpression_in_directDeclaratorLength2800 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_pointer_in_abstractDeclarator2813 = new BitSet(new long[]{0x0400804000000002L});
+ public static final BitSet FOLLOW_directAbstractDeclarator_in_abstractDeclarator2816 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_directAbstractDeclarator_in_abstractDeclarator2841 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_directAbstractDeclarator2878 = new BitSet(new long[]{0x0200000000000002L});
+ public static final BitSet FOLLOW_LPAREN_in_directAbstractDeclarator2889 = new BitSet(new long[]{0x0400804000000000L});
+ public static final BitSet FOLLOW_abstractDeclarator_in_directAbstractDeclarator2891 = new BitSet(new long[]{0x1000000000000000L});
+ public static final BitSet FOLLOW_RPAREN_in_directAbstractDeclarator2893 = new BitSet(new long[]{0x0200000000000002L});
+ public static final BitSet FOLLOW_OPENBRAC_in_directAbstractDeclarator2908 = new BitSet(new long[]{0x8040005050206610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_directAbstractDeclarator2910 = new BitSet(new long[]{0x0000000000004000L});
+ public static final BitSet FOLLOW_CLOSEBRAC_in_directAbstractDeclarator2913 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_POINTER_in_pointer2931 = new BitSet(new long[]{0x0000000000100002L});
+ public static final BitSet FOLLOW_typeQualifierList_in_pointer2933 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_typeQualifier_in_typeQualifierList2956 = new BitSet(new long[]{0x0000000000100002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_typedefName2972 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_typealiasTarget2989 = new BitSet(new long[]{0x0400804000000002L});
+ public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasTarget2991 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasAlias3017 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_typealiasAlias3023 = new BitSet(new long[]{0x0400804000000002L});
+ public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasAlias3025 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_TYPEALIASTOK_in_typealiasDecl3039 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001C891L});
+ public static final BitSet FOLLOW_typealiasTarget_in_typealiasDecl3041 = new BitSet(new long[]{0x0000000000000000L,0x0000000000001000L});
+ public static final BitSet FOLLOW_TYPE_ASSIGNMENT_in_typealiasDecl3043 = new BitSet(new long[]{0x4400CAC18A180900L,0x000000000001C891L});
+ public static final BitSet FOLLOW_typealiasAlias_in_typealiasDecl3045 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfSpecifierHead_in_ctfSpecifier3145 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_ctfBody_in_ctfSpecifier3147 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_typealiasDecl_in_ctfSpecifier3164 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_EVENTTOK_in_ctfSpecifierHead3185 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STREAMTOK_in_ctfSpecifierHead3195 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_TRACETOK_in_ctfSpecifierHead3205 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ENVTOK_in_ctfSpecifierHead3215 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_CLOCKTOK_in_ctfSpecifierHead3225 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_CALLSITETOK_in_ctfSpecifierHead3235 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOATINGPOINTTOK_in_ctfTypeSpecifier3258 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3260 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INTEGERTOK_in_ctfTypeSpecifier3275 = new BitSet(new long[]{0x0000100000000000L});
+ public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3277 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRINGTOK_in_ctfTypeSpecifier3292 = new BitSet(new long[]{0x0000100000000002L});
+ public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3294 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_LCURL_in_ctfBody3327 = new BitSet(new long[]{0xC8404AD1DA382F10L,0x000000000001CED5L});
+ public static final BitSet FOLLOW_ctfAssignmentExpressionList_in_ctfBody3329 = new BitSet(new long[]{0x0800000000000000L});
+ public static final BitSet FOLLOW_RCURL_in_ctfBody3332 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfAssignmentExpression_in_ctfAssignmentExpressionList3351 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
+ public static final BitSet FOLLOW_TERM_in_ctfAssignmentExpressionList3353 = new BitSet(new long[]{0xC0404AD1DA382F12L,0x000000000001CED5L});
+ public static final BitSet FOLLOW_unaryExpression_in_ctfAssignmentExpression3376 = new BitSet(new long[]{0x0000000000000040L,0x0000000000001000L});
+ public static final BitSet FOLLOW_ASSIGNMENT_in_ctfAssignmentExpression3388 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
+ public static final BitSet FOLLOW_unaryExpression_in_ctfAssignmentExpression3392 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_TYPE_ASSIGNMENT_in_ctfAssignmentExpression3468 = new BitSet(new long[]{0x40004AC18A080900L,0x000000000001C091L});
+ public static final BitSet FOLLOW_typeSpecifier_in_ctfAssignmentExpression3472 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_declarationSpecifiers_in_ctfAssignmentExpression3555 = new BitSet(new long[]{0x0400004000000000L});
+ public static final BitSet FOLLOW_declaratorList_in_ctfAssignmentExpression3559 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_typealiasDecl_in_ctfAssignmentExpression3582 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_IDENTIFIER_in_synpred1_CTFParser560 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ctfKeyword_in_synpred2_CTFParser586 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_LITERAL_in_synpred3_CTFParser606 = new BitSet(new long[]{0x0000000000000002L});
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.ctf</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+bin.includes = feature.xml,\
+ feature.properties,\
+ p2.inf
+src.includes = sourceTemplateFeature/p2.inf
--- /dev/null
+###############################################################################
+# Copyright (c) 2008, 2015 Red Hat, Inc., Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+featureName=CTF (Common Trace Format) Parser
+
+description=Plug-ins to integrate a Common Trace Format (CTF) Parser into the workbench.
+
+featureProvider=Eclipse Trace Compass
+
+copyright=Copyright 2015 Ericsson
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.tracecompass.ctf"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider"
+ license-feature="org.eclipse.license"
+ license-feature-version="0.0.0">
+
+ <description url="http://www.example.com/description">
+ %description
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import plugin="org.antlr.runtime" version="3.2.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.tracecompass.ctf.parser"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.tracecompass.ctf.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
--- /dev/null
+instructions.configure=\
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tracecompass/master/repository,type:0,name:Trace Compass,enabled:false); \
+org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tracecompass/master/repository,type:1,name:Trace Compass,enabled:false);
+
+update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.ctf.feature.group' || pc.name == 'org.eclipse.tracecompass.ctf.feature.group'))
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Trace Compass CTF (Common Trace Format) Feature</name>
+ <artifactId>org.eclipse.tracecompass.ctf</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <packaging>eclipse-feature</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.ctf.source.feature.group' || pc.name == 'org.eclipse.tracecompass.ctf.source.feature.group'))
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="perf"/>
+ <classpathentry kind="src" path="shared"/>
+ <classpathentry kind="src" path="stubs"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.tmf.ctf.core.tests</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.core.tests;singleton:=true
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.tracecompass.tmf.core,
+ org.eclipse.tracecompass.tmf.core.tests,
+ org.eclipse.tracecompass.tmf.ctf.core,
+ org.eclipse.tracecompass.ctf.core,
+ org.eclipse.tracecompass.ctf.core.tests
+Export-Package: org.eclipse.tracecompass.tmf.ctf.core.tests,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.perf,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;x-internal:=true,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.shared,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.stubs,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;x-internal:=true,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;x-internal:=true,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;x-internal:=true,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;x-internal:=true
+Import-Package: com.google.common.collect,
+ org.eclipse.test.performance
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/,\
+ perf/,\
+ shared/,\
+ stubs
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 École Polytechnique de Montréal
+ *
+ * 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:
+ * Geneviève Bastien - Initial implementation and API
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.perf;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * The class <code>AllPerformanceTests</code> builds a suite that can be used to
+ * run all of the performance tests within its package as well as within any
+ * subpackages of its package.
+ *
+ * @author Geneviève Bastien
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment.AllPerfTests.class
+})
+public class AllPerfTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 École Polytechnique de Montréal
+ *
+ * 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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ ExperimentBenchmark.class
+})
+public class AllPerfTests {
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Geneviève Bastien - Convert to JUnit performance test
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.Performance;
+import org.eclipse.test.performance.PerformanceMeter;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfExperimentStub;
+import org.junit.Test;
+
+/**
+ * Coalescing benchmark
+ *
+ * @author Matthew Khouzam
+ */
+public class ExperimentBenchmark {
+
+ private static final String TEST_ID = "org.eclipse.linuxtools#Experiment benchmark#";
+ private static final int MAX_TRACES = 160;
+ private static final int BLOCK_SIZE = 100;
+ private static final String TRACES_ROOT_PATH = CtfTestTrace.TRACE_EXPERIMENT.getPath();
+ private static final int SAMPLE_SIZE_SLOW = 20;
+ private static final int SAMPLE_SIZE = 100;
+
+ private TmfExperimentStub fExperiment;
+
+ /**
+ * Run the benchmark
+ */
+ @Test
+ public void benchmarkExperimentSizeRequest() {
+ Performance perf = Performance.getDefault();
+
+ for (int numTraces = 1; numTraces < MAX_TRACES; numTraces = (int) (1.6 * (numTraces + 1))) {
+ PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + numTraces + " traces");
+ perf.tagAsSummary(pm, "Experiment Benchmark:" + numTraces + " traces", Dimension.CPU_TIME);
+ if ((int) (1.6 * (numTraces + 1)) > MAX_TRACES) {
+ perf.tagAsGlobalSummary(pm, "Experiment Benchmark:" + numTraces + " traces", Dimension.CPU_TIME);
+ }
+
+ int sampleSize = SAMPLE_SIZE;
+ if (numTraces > 20) {
+ sampleSize = SAMPLE_SIZE_SLOW;
+ }
+
+ for (int s = 0; s < sampleSize; s++) {
+
+ InnerEventRequest expReq = new InnerEventRequest(ITmfEvent.class, 0, ITmfEventRequest.ALL_DATA, ExecutionType.BACKGROUND);
+ InnerEventRequest traceReq[] = new InnerEventRequest[numTraces];
+
+ init(numTraces);
+ fExperiment.sendRequest(expReq);
+ List<ITmfTrace> traces = fExperiment.getTraces();
+ for (int i = 0; i < numTraces; i++) {
+ traceReq[i] = new InnerEventRequest(ITmfEvent.class, 0, ITmfEventRequest.ALL_DATA, ExecutionType.BACKGROUND);
+ traces.get(i).sendRequest(traceReq[i]);
+ }
+
+ pm.start();
+ waitForRequest(expReq, traceReq);
+ pm.stop();
+
+ for (int i = 0; i < traces.size(); i++) {
+ if (!expReq.isTraceHandled(traces.get(i))) {
+ System.err.println("Trace " + i + " not handled!");
+ }
+ }
+
+ fExperiment.dispose();
+ }
+ pm.commit();
+ }
+ }
+
+ /**
+ * Initialization
+ *
+ * @param maxTraces
+ * maximum number of traces to open
+ */
+ private void init(int maxTraces) {
+ try {
+ File parentDir = new File(TRACES_ROOT_PATH);
+ File[] traceFiles = parentDir.listFiles();
+ ITmfTrace[] traces = new CtfTmfTrace[Math.min(maxTraces, traceFiles.length)];
+ for (int i = 0; i < traces.length; i++) {
+ traces[i] = new CtfTmfTrace();
+ }
+ fExperiment = new TmfExperimentStub("MegaExperiment", traces, BLOCK_SIZE);
+ int j = 0;
+ for (int i = 0; i < (traces.length) && (j < traces.length); i++) {
+ String absolutePath = traceFiles[j].getAbsolutePath();
+ if (traces[i].validate(null, absolutePath).isOK()) {
+ traces[i].initTrace(null, absolutePath, ITmfEvent.class);
+ } else {
+ i--;
+ }
+ j++;
+ }
+ if (traces[traces.length - 1].getPath() == null) {
+ throw new TmfTraceException("Insufficient valid traces in directory");
+ }
+ } catch (TmfTraceException e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+ private static void waitForRequest(InnerEventRequest expReq, InnerEventRequest[] traceReqs) {
+ try {
+ expReq.waitForCompletion();
+ List<InnerEventRequest> reqs = Arrays.asList(traceReqs);
+ for (InnerEventRequest traceReq : reqs) {
+ traceReq.waitForCompletion();
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+
+ private static class InnerEventRequest extends TmfEventRequest {
+ private Set<String> fTraces = new HashSet<>();
+
+ public InnerEventRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
+ super(dataType, index, nbRequested, priority);
+ }
+
+ @Override
+ public void handleData(ITmfEvent event) {
+ super.handleData(event);
+ if (!fTraces.contains(event.getTrace().getName())) {
+ fTraces.add(event.getTrace().getName());
+ }
+ }
+
+ public boolean isTraceHandled(ITmfTrace trace) {
+ return fTraces.contains(trace.getName());
+ }
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = CTF support for TMF Core Tests Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.linuxtools.tmf.core.tracetype">
+ <type
+ category="org.eclipse.linuxtools.tmf.core.tests.category"
+ event_type="org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent"
+ id="org.eclipse.linuxtools.tmf.ctf.core.tests.ctf.tracetype"
+ isDirectory="true"
+ name="CTF Test Trace"
+ trace_type="org.eclipse.tracecompass.tmf.ctf.core.tests.stubs.CtfTmfTraceStub">
+ </type>
+ </extension>
+
+</plugin>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.tmf.ctf.core.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <name>CTF Support for TMF Core Tests Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>prepare</id>
+ <phase>validate</phase>
+ <configuration>
+ <target>
+ <echo message="prepare phase" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includes>
+ <include>**/AllTests.*</include>
+ </includes>
+ <useUIHarness>false</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <product>org.eclipse.platform.ide</product>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <groupId>org.eclipse.tracecompass</groupId>
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.shared;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.stubs.CtfTmfTraceStub;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
+ *
+ * To run tests using these, you first need to run the "get-traces.[xml|sh]"
+ * script located under lttng/org.eclipse.tracecompass.ctf.core.tests/traces/ .
+ *
+ * @author Alexandre Montplaisir
+ */
+@NonNullByDefault
+public enum CtfTmfTestTrace {
+ /** Example kernel trace */
+ KERNEL,
+ /** Another kernel trace */
+ TRACE2,
+ /** Kernel trace with event contexts */
+ KERNEL_VM,
+ /** Trace synchronization: source trace */
+ SYNC_SRC,
+ /** Trace synchronization: destination trace */
+ SYNC_DEST,
+ /** Trace synchronization (case 2): django client trace */
+ DJANGO_CLIENT,
+ /** Trace synchronization (case 2): django db trace */
+ DJANGO_DB,
+ /** Trace synchronization (case 2): django web server trace */
+ DJANGO_HTTPD,
+ /** UST trace with lots of lost events */
+ HELLO_LOST,
+ /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
+ CYG_PROFILE,
+ /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
+ CYG_PROFILE_FAST,
+ /** Autogenerated Syntetic trace */
+ SYNTHETIC_TRACE,
+ /** Trace with non-standard field sizes */
+ FUNKY_TRACE;
+
+
+ private final String fPath;
+ private @Nullable CtfTmfTraceStub fTrace = null;
+
+ private CtfTmfTestTrace() {
+ @SuppressWarnings("null")
+ @NonNull String path = CtfTestTrace.valueOf(this.name()).getPath();
+ fPath = path;
+ }
+
+ /**
+ * @return The path of this trace
+ */
+ public String getPath() {
+ return fPath;
+ }
+
+ /**
+ * Return a CtfTmfTraceStub object of this test trace. It will be already
+ * initTrace()'ed.
+ *
+ * Make sure you call {@link #exists()} before calling this!
+ *
+ * After being used by unit tests, traces must be properly disposed of by
+ * calling the {@link CtfTmfTestTrace#dispose()} method.
+ *
+ * @return A CtfTmfTrace reference to this trace
+ */
+ public synchronized CtfTmfTrace getTrace() {
+ CtfTmfTraceStub trace = fTrace;
+ if (trace != null) {
+ trace.close();
+ }
+ trace = new CtfTmfTraceStub();
+ try {
+ trace.initTrace(null, fPath, CtfTmfEvent.class);
+ } catch (TmfTraceException e) {
+ /* Should not happen if tracesExist() passed */
+ throw new RuntimeException(e);
+ }
+ fTrace = trace;
+ return trace;
+ }
+
+ /**
+ * Check if the trace actually exists on disk or not.
+ *
+ * @return If the trace is present
+ */
+ public boolean exists() {
+ return CtfTestTrace.valueOf(this.name()).exists();
+ }
+
+ /**
+ * Dispose of the trace
+ */
+ public void dispose() {
+ if (fTrace != null) {
+ fTrace.dispose();
+ fTrace = null;
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests;
+
+import org.eclipse.tracecompass.tmf.core.tests.shared.DebugSuite;
+import org.junit.runner.RunWith;
+
+/**
+ * The class <code>TestAll</code> builds a suite that can be used to run all of
+ * the tests within its package as well as within any subpackages of its
+ * package.
+ *
+ * @author ematkho
+ */
+@RunWith(DebugSuite.class)
+@DebugSuite.SuiteClasses({
+ org.eclipse.tracecompass.tmf.ctf.core.tests.context.AllTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.event.AllTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.iterator.AllTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.trace.AllTests.class,
+
+ /* Tests in other packages (that are there because of CTF) */
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request.AllTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics.AllTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager.AllTests.class
+})
+public class AllTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfLocationDataTest.class,
+ CtfLocationTest.class,
+ CtfTmfContextTest.class
+})
+public class AllTests {
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Collection of tests for the {@link CtfLocationInfo}
+ *
+ * @author alexmont
+ */
+public class CtfLocationDataTest {
+
+ private CtfLocationInfo fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new CtfLocationInfo(1, 0);
+ }
+
+ /**
+ * Test for the .getTimestamp() and .getIndex() methods
+ */
+ @Test
+ public void testGetters() {
+ long timestamp = fixture.getTimestamp();
+ long index = fixture.getIndex();
+
+ assertEquals(1, timestamp);
+ assertEquals(0, index);
+ }
+
+ /**
+ * Test for the .hashCode() method
+ */
+ @Test
+ public void testHashCode() {
+ int code = fixture.hashCode();
+ assertEquals(962, code);
+ }
+
+ /**
+ * Test for the .equals() method
+ */
+ @Test
+ public void testEquals() {
+ CtfLocationInfo same = new CtfLocationInfo(1, 0);
+ CtfLocationInfo diff1 = new CtfLocationInfo(100, 0);
+ CtfLocationInfo diff2 = new CtfLocationInfo(1, 10);
+
+ assertTrue(fixture.equals(same));
+ assertFalse(fixture.equals(diff1));
+ assertFalse(fixture.equals(diff2));
+ }
+
+ /**
+ * Test for the .compareTo() method
+ */
+ @Test
+ public void testCompareTo() {
+ CtfLocationInfo same = new CtfLocationInfo(1, 0);
+ CtfLocationInfo smaller = new CtfLocationInfo(0, 0);
+ CtfLocationInfo bigger1 = new CtfLocationInfo(1000, 500);
+ CtfLocationInfo bigger2 = new CtfLocationInfo(1, 1);
+
+ assertEquals(0, same.compareTo(fixture));
+ assertEquals(-1, smaller.compareTo(fixture));
+ assertEquals(1, bigger1.compareTo(fixture));
+ assertEquals(1, bigger2.compareTo(fixture));
+ }
+
+ /**
+ * Test for the .toString() method
+ */
+ @Test
+ public void testToString() {
+ String expected = "Element [1/0]";
+ assertEquals(expected, fixture.toString());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfLocationTest</code> contains tests for the class
+ * <code>{@link CtfLocation}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfLocationTest {
+
+ private CtfLocation fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ fixture = new CtfLocation(new CtfLocationInfo(1, 0));
+ }
+
+ /**
+ * Run the CtfLocation(Long) constructor test.
+ */
+ @Test
+ public void testCtfLocation_long() {
+ CtfLocationInfo location = new CtfLocationInfo(1, 0);
+ CtfLocation result = new CtfLocation(location);
+
+ assertNotNull(result);
+ assertEquals(1L, result.getLocationInfo().getTimestamp());
+ }
+
+ /**
+ * Run the CtfLocation(ITmfTimestamp) constructor test.
+ */
+ @Test
+ public void testCtfLocation_timestamp() {
+ ITmfTimestamp timestamp = new TmfTimestamp();
+ CtfLocation result = new CtfLocation(timestamp);
+
+ assertNotNull(result);
+ assertEquals(0L, result.getLocationInfo().getTimestamp());
+ }
+
+ /**
+ * Run the Long getLocation() method test.
+ */
+ @Test
+ public void testGetLocation() {
+ CtfLocationInfo location = fixture.getLocationInfo();
+ long result = location.getTimestamp();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the void setLocation(Long) method test.
+ */
+ @Test
+ public void testSetLocation() {
+ CtfLocationInfo location = new CtfLocationInfo(1337, 7331);
+ fixture = new CtfLocation(location);
+ }
+
+ /**
+ * Test the toString() method with a valid location.
+ */
+ @Test
+ public void testToString_valid(){
+ CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(1337, 7331));
+ assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2.toString());
+ }
+
+ /**
+ * Test the toString() method with an invalid location.
+ */
+ @Test
+ public void testToString_invalid(){
+ CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(-1, -1));
+ assertEquals("CtfLocation [INVALID]", fixture2.toString());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial implementation
+ * Alexandre Montplaisir
+ * Patrick Tasse - Updated for removal of context clone
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for the CtfTmfLightweightContext class
+ *
+ * @author Matthew Khouzam
+ * @version 1.1
+ */
+public class CtfTmfContextTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+ private static final long begin = 1332170682440133097L; /* Trace start time */
+ private static final long end = 1332170692664579801L; /* Trace end time */
+
+ private CtfTmfTrace trace;
+
+ private class SeekerThread extends Thread {
+ long val;
+
+ public void setVal(long val) {
+ this.val = val;
+ }
+ }
+
+ /**
+ * Pre-test initialization
+ *
+ * @throws TmfTraceException
+ * If the trace couldn't be init'ed, which shouldn't happen.
+ */
+ @Before
+ public void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+ trace = new CtfTmfTrace();
+ String path = testTrace.getPath();
+ trace.initTrace((IResource) null, path, CtfTmfEvent.class);
+ }
+
+ /**
+ * Index all the events in the test trace.
+ */
+ @Test
+ public void testIndexing() {
+ CtfTmfContext context = new CtfTmfContext(trace);
+ context.seek(0);
+
+ int count = 0;
+ while (trace.getNext(context) != null) {
+ count++;
+ }
+ assertTrue(count > 0);
+ }
+
+ /**
+ * Context fuzzer. Use an amount of contexts greater than the size of the
+ * iterator cache and have them access the trace in parallel.
+ *
+ * @throws InterruptedException
+ * Would fail the test
+ */
+ @Test
+ public void testTooManyContexts() throws InterruptedException {
+ final int lwcCount = 101;
+ double increment = (end - begin) / lwcCount;
+ final ArrayList<Long> vals = new ArrayList<>();
+ final ArrayList<Thread> threads = new ArrayList<>();
+ final ArrayList<CtfTmfContext> tooManyContexts = new ArrayList<>();
+
+ for (double i = begin; i < end; i += increment) {
+ SeekerThread thread = new SeekerThread() {
+ @Override
+ public void run() {
+ CtfTmfContext lwc = new CtfTmfContext(trace);
+ lwc.seek(val);
+ trace.getNext(lwc);
+ synchronized(trace){
+ if (lwc.getCurrentEvent() != null) {
+ vals.add(lwc.getCurrentEvent().getTimestamp().getValue());
+ }
+ tooManyContexts.add(lwc);
+ }
+ }
+ };
+ thread.setVal((long)i);
+ threads.add(thread);
+ thread.start();
+ }
+
+ for (Thread t: threads){
+ t.join();
+ }
+
+ for (long val : vals){
+ assertTrue(val >= begin);
+ assertTrue(val <= end);
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfTmfEventFieldTest.class,
+ CtfTmfEventTest.class,
+ CtfTmfEventTypeTest.class,
+ CtfTmfLostEventStatisticsTest.class,
+ CtfTmfLostEventsTest.class,
+ EventContextTest.class
+})
+public class AllTests {
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
+import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
+import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventField;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventFieldTest</code> contains tests for the class
+ * <code>{@link CtfTmfEventField}</code>.
+ *
+ * @author Matthew Khouzam
+ * @version 1.0
+ */
+public class CtfTmfEventFieldTest {
+
+ private static final @NonNull String ROOT = "root";
+ private static final String SEQ = "seq";
+ private static final @NonNull String ARRAY_STR = "array_str";
+ private static final @NonNull String ARRAY_FLOAT = "array_float";
+ private static final @NonNull String ARRAY_INT = "array_int";
+ private static final @NonNull String ARRAY_STRUCT = "array_struct";
+ private static final @NonNull String ARRAY_VARIANT = "array_variant";
+ private static final @NonNull String ARRAY_ENUM = "array_enum";
+ private static final String STR = "str";
+ private static final String FLOAT = "float";
+ private static final String LEN = "len";
+ private static final String INT = "int";
+ private static final String NAME = "test";
+ private static final String STRUCT = "struct";
+ private static final String VARIANT = "variant";
+ private static final String ENUM = "enum";
+
+ private static final byte TEST_NUMBER = 2;
+ private static final String TEST_STRING = "two";
+
+ private static final int ARRAY_SIZE = 2;
+
+ private StructDefinition fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws UnsupportedEncodingException
+ * Thrown when UTF-8 encoding is not available.
+ * @throws CTFException
+ * error
+ */
+ @Before
+ public void setUp() throws UnsupportedEncodingException, CTFException {
+ final byte[] testStringBytes = TEST_STRING.getBytes("UTF-8");
+
+ int capacity = 2048;
+ ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
+
+ StructDeclaration sDec = new StructDeclaration(1l);
+ StringDeclaration strDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
+ IntegerDeclaration intDec = IntegerDeclaration.UINT_8_DECL;
+ FloatDeclaration flDec = new FloatDeclaration(8, 24,
+ ByteOrder.BIG_ENDIAN, 8);
+ SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
+ StructDeclaration structDec = new StructDeclaration(8);
+ EnumDeclaration enumDec = new EnumDeclaration(intDec);
+ VariantDeclaration varDec = new VariantDeclaration();
+ ArrayDeclaration arrStrDec = new ArrayDeclaration(ARRAY_SIZE, strDec);
+ ArrayDeclaration arrFloatDec = new ArrayDeclaration(ARRAY_SIZE, flDec);
+ ArrayDeclaration arrIntDec = new ArrayDeclaration(ARRAY_SIZE, intDec);
+ ArrayDeclaration arrStructDec = new ArrayDeclaration(ARRAY_SIZE, structDec);
+ ArrayDeclaration arrVariantDec = new ArrayDeclaration(ARRAY_SIZE, varDec);
+ ArrayDeclaration arrEnumDec = new ArrayDeclaration(ARRAY_SIZE, enumDec);
+
+ sDec.addField(INT, intDec);
+ bb.put(TEST_NUMBER);
+
+ sDec.addField(ARRAY_INT, arrIntDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.put(TEST_NUMBER);
+ }
+
+ sDec.addField(LEN, intDec);
+ bb.put(TEST_NUMBER);
+
+ sDec.addField(FLOAT, flDec);
+ bb.putFloat(TEST_NUMBER);
+
+ sDec.addField(ARRAY_FLOAT, arrFloatDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.putFloat(TEST_NUMBER);
+ }
+
+ sDec.addField(STR, strDec);
+ bb.put(testStringBytes);
+ bb.put((byte) 0);
+
+ sDec.addField(ARRAY_STR, arrStrDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.put(testStringBytes);
+ bb.put((byte) 0);
+ }
+
+ sDec.addField(SEQ, seqDec);
+ bb.put(TEST_NUMBER);
+ bb.put(TEST_NUMBER);
+
+ structDec.addField(STR, strDec);
+ structDec.addField(INT, intDec);
+ sDec.addField(STRUCT, structDec);
+ bb.put(testStringBytes);
+ bb.put((byte) 0);
+ bb.put(TEST_NUMBER);
+
+ sDec.addField(ARRAY_STRUCT, arrStructDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.put(testStringBytes);
+ bb.put((byte) 0);
+ bb.put(TEST_NUMBER);
+ }
+
+ enumDec.add(0, 1, LEN);
+ enumDec.add(2, 3, FLOAT);
+ sDec.addField(ENUM, enumDec);
+ bb.put(TEST_NUMBER);
+
+ sDec.addField(ARRAY_ENUM, arrEnumDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.put(TEST_NUMBER);
+ }
+
+ varDec.addField(LEN, intDec);
+ varDec.addField(FLOAT, flDec);
+ varDec.setTag(ENUM);
+ sDec.addField(VARIANT, varDec);
+ bb.putFloat(TEST_NUMBER);
+
+ sDec.addField(ARRAY_VARIANT, arrVariantDec);
+ for (int i = 0; i < ARRAY_SIZE; ++i) {
+ bb.putFloat(TEST_NUMBER);
+ }
+
+ fixture = sDec.createDefinition(fixture, ROOT, new BitBuffer(bb));
+
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_float() {
+ FloatDefinition fieldDef = (FloatDefinition) fixture.lookupDefinition(FLOAT);
+ CtfTmfEventField result = CtfTmfEventField.parseField((IDefinition)fieldDef, "_" + NAME);
+ assertEquals("test=2.0", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of floats field.
+ */
+ @Test
+ public void testParseField_array_float() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_FLOAT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[2.0, 2.0]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_int() {
+ IDefinition fieldDef = fixture.lookupDefinition(INT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=2", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of integers field.
+ */
+ @Test
+ public void testParseField_array_int() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_INT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[2, 2]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_sequence() {
+ IDefinition fieldDef = fixture.lookupDefinition(SEQ);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[2, 2]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_sequence_value() {
+ IDefinition fieldDef = fixture.lookupDefinition(SEQ);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ long[] values = (long[]) result.getValue();
+ long[] expected = new long[] { 2, 2 };
+ assertArrayEquals(expected, values);
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_string() {
+ IDefinition fieldDef = fixture.lookupDefinition(STR);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=two", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of strings field.
+ */
+ @Test
+ public void testParseField_array_string() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_STR);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[two, two]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_struct() {
+ IDefinition fieldDef = fixture.lookupDefinition(STRUCT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[str=two, int=2]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of structs field.
+ */
+ @Test
+ public void testParseField_array_struct() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_STRUCT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[[str=two, int=2], [str=two, int=2]]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_enum() {
+ IDefinition fieldDef = fixture.lookupDefinition(ENUM);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=float", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of enums field.
+ */
+ @Test
+ public void testParseField_array_enum() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_ENUM);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[float, float]", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test.
+ */
+ @Test
+ public void testParseField_variant() {
+ IDefinition fieldDef = fixture.lookupDefinition(VARIANT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=float=2.0", result.toString());
+ }
+
+ /**
+ * Run the CtfTmfEventField parseField(Definition,String) method test for an
+ * array of variants field.
+ */
+ @Test
+ public void testParseField_array_variant() {
+ IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_VARIANT);
+ CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
+ assertEquals("test=[float=2.0, float=2.0]", result.toString());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ * Patrick Tasse - Remove getSubField
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventTest</code> contains tests for the class
+ * <code>{@link CtfTmfEvent}</code>.
+ *
+ * @author ematkho
+ * @version $Revision: 1.0 $
+ */
+public class CtfTmfEventTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+ private static CtfTmfEvent nullEvent;
+ private CtfTmfEvent fixture;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ assumeTrue(testTrace.exists());
+ try (CtfTmfTrace trace = testTrace.getTrace();
+ CtfIterator tr = (CtfIterator) trace.createIterator();) {
+ tr.advance();
+ fixture = tr.getCurrentEvent();
+ nullEvent = CtfTmfEventFactory.getNullEvent(trace);
+ }
+ }
+
+ /**
+ * Run the CTFEvent(EventDefinition,StreamInputReader) constructor test.
+ */
+ @Test
+ public void testCTFEvent_read() {
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Run the int getCPU() method test.
+ */
+ @Test
+ public void testGetCPU() {
+ int result = nullEvent.getCPU();
+ assertEquals(-1, result);
+ }
+
+ /**
+ * Run the String getEventName() method test.
+ */
+ @Test
+ public void testGetEventName() {
+ String result = nullEvent.getType().getName();
+ assertEquals("Empty CTF event", result);
+ }
+
+ /**
+ * Run the ArrayList<String> getFieldNames() method test.
+ */
+ @Test
+ public void testGetFieldNames() {
+ Collection<String> result = fixture.getContent().getFieldNames();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the Object getFieldValue(String) method test.
+ */
+ @Test
+ public void testGetFieldValue() {
+ String fieldName = "pid";
+ ITmfEventField result = fixture.getContent().getField(fieldName);
+
+ assertNotNull(result);
+ assertNotNull(result.getValue());
+ }
+
+ /**
+ * Run the HashMap<String, CTFEventField> getFields() method test.
+ */
+ @Test
+ public void testGetFields() {
+ Collection<? extends ITmfEventField> fields = nullEvent.getContent().getFields();
+ assertEquals(0, fields.size());
+ }
+
+ /**
+ * Run the ITmfEventField getSubFieldValue(String[]) method test.
+ */
+ @Test
+ public void testGetSubFieldValue() {
+ /* Field exists */
+ String[] names = { "pid" };
+ assertNotNull(fixture.getContent().getField(names));
+
+ /* First field exists, not the second */
+ String[] names2 = { "pid", "abcd" };
+ assertNull(fixture.getContent().getField(names2));
+
+ /* Both field do not exist */
+ String[] names3 = { "pfid", "abcd" };
+ assertNull(fixture.getContent().getField(names3));
+
+ /* TODO Missing case of embedded field, need event for it */
+ }
+
+ /**
+ * Run the long getID() method test.
+ */
+ @Test
+ public void testGetID() {
+ long result = nullEvent.getID();
+ assertEquals(-1L, result);
+ }
+
+ /**
+ * Run the long getTimestamp() method test.
+ */
+ @Test
+ public void testGetTimestamp() {
+ long result = nullEvent.getTimestamp().getValue();
+ assertEquals(-1L, result);
+ }
+
+ /**
+ * Test the getters for the reference, source and type.
+ */
+ @Test
+ public void testGetters() {
+ long rank = fixture.getRank();
+ try (CtfTmfTrace trace = fixture.getTrace();) {
+ assertEquals("kernel", trace.getName());
+ }
+ String reference = fixture.getReference();
+ int cpu = fixture.getCPU();
+ ITmfEventType type = fixture.getType();
+ assertEquals(ITmfContext.UNKNOWN_RANK, rank);
+
+ assertEquals("channel0_1", reference);
+ assertEquals(1, cpu);
+ assertEquals("lttng_statedump_vm_map", type.toString());
+ }
+
+ /**
+ * Test the custom CTF attributes methods. The test trace doesn't have any,
+ * so the list of attributes should be empty.
+ */
+ @Test
+ public void testCustomAttributes() {
+ Set<String> attributes = fixture.listCustomAttributes();
+ assertEquals(0, attributes.size());
+
+ String attrib = fixture.getCustomAttribute("bozo");
+ assertNull(attrib);
+ }
+
+ /**
+ * Test the toString() method
+ */
+ @Test
+ public void testToString() {
+ String s = fixture.getContent().toString();
+ assertEquals("pid=1922, start=0xb73ea000, end=0xb73ec000, flags=0x8000075, inode=917738, pgoff=0", s);
+ }
+
+ /**
+ * Test the {@link CtfTmfEventFactory#getNullEvent(CtfTmfTrace)} method, and
+ * the nullEvent's values.
+ */
+ @Test
+ public void testNullEvent() {
+ CtfTmfEvent nullEvent2 = CtfTmfEventFactory.getNullEvent(fixture.getTrace());
+ assertSame(nullEvent2, nullEvent);
+ assertNotNull(nullEvent);
+ assertEquals(-1, nullEvent.getCPU());
+ assertEquals("Empty CTF event", nullEvent.getType().getName());
+ assertNull(nullEvent.getReference());
+ assertEquals(0, nullEvent.getContent().getFields().size());
+ assertEquals(-1L, nullEvent.getID());
+ assertEquals(-1L, nullEvent.getTimestamp().getValue());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfEventTypeTest</code> contains tests for the class
+ * <code>{@link CtfTmfEventType}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfEventTypeTest {
+
+ /**
+ * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
+ */
+ @Test
+ public void testCtfTmfEventType() {
+ String eventName = "";
+ ITmfEventField content = new TmfEventField("", null, new ITmfEventField[] {});
+ CtfTmfEventType result = new CtfTmfEventType(eventName, content);
+
+ assertNotNull(result);
+ assertEquals("", result.toString());
+ assertEquals("", result.getName());
+ }
+
+ /**
+ * Run the String toString() method test.
+ */
+ @Test
+ public void testToString() {
+ ITmfEventField emptyField = new TmfEventField("", null, new ITmfEventField[] {});
+ CtfTmfEventType fixture = new CtfTmfEventType("" , emptyField);
+
+ String result = fixture.toString();
+
+ assertEquals("", result);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Map;
+
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Unit tests for handling of lost events by the statistics backends.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfLostEventStatisticsTest {
+
+ /** Time-out tests after 30 seconds */
+ @Rule
+ public TestRule globalTimeout= new Timeout(30000);
+
+ /**Test trace with lost events */
+ private static final CtfTmfTestTrace lostEventsTrace = CtfTmfTestTrace.HELLO_LOST;
+
+ private ITmfTrace fTrace;
+
+ /** The statistics back-end object for the trace with lost events */
+ private ITmfStatistics fStats;
+
+ /* The two analysis modules needed for fStats */
+ private TmfStatisticsTotalsModule fTotalsMod;
+ private TmfStatisticsEventTypesModule fEventTypesMod;
+
+ // ------------------------------------------------------------------------
+ // Maintenance
+ // ------------------------------------------------------------------------
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void setUpClass() {
+ assumeTrue(lostEventsTrace.exists());
+ }
+
+ /**
+ * Test setup
+ */
+ @Before
+ public void setUp() {
+ ITmfTrace trace = lostEventsTrace.getTrace();
+ fTrace = trace;
+
+ /* Prepare the two analysis-backed state systems */
+ fTotalsMod = new TmfStatisticsTotalsModule();
+ fEventTypesMod = new TmfStatisticsEventTypesModule();
+ try {
+ fTotalsMod.setTrace(trace);
+ fEventTypesMod.setTrace(trace);
+ } catch (TmfAnalysisException e) {
+ fail();
+ }
+
+ fTotalsMod.schedule();
+ fEventTypesMod.schedule();
+ assertTrue(fTotalsMod.waitForCompletion());
+ assertTrue(fEventTypesMod.waitForCompletion());
+
+ ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
+ ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
+ assertNotNull(totalsSS);
+ assertNotNull(eventTypesSS);
+
+ fStats = new TmfStateStatistics(totalsSS, eventTypesSS);
+ }
+
+ /**
+ * Test cleanup
+ */
+ @After
+ public void tearDown() {
+ fStats.dispose();
+ fTotalsMod.dispose();
+ fEventTypesMod.dispose();
+ fTrace.dispose();
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /*
+ * Trace start = 1376592664828559410
+ * Trace end = 1376592665108210547
+ */
+
+ private static final long rangeStart = 1376592664900000000L;
+ private static final long rangeEnd = 1376592665000000000L;
+
+ /**
+ * Test the total number of "real" events. Make sure the lost events aren't
+ * counted in the total.
+ */
+ @Test
+ public void testLostEventsTotals() {
+ long realEvents = fStats.getEventsTotal();
+ assertEquals(32300, realEvents);
+ }
+
+ /**
+ * Test the number of real events in a given range. Lost events shouldn't be
+ * counted.
+ */
+ @Test
+ public void testLostEventsTotalInRange() {
+ long realEventsInRange = fStats.getEventsInRange(rangeStart, rangeEnd);
+ assertEquals(11209L, realEventsInRange);
+ }
+
+ /**
+ * Test the total number of lost events reported in the trace.
+ */
+ @Test
+ public void testLostEventsTypes() {
+ Map<String, Long> events = fStats.getEventTypesTotal();
+ Long lostEvents = events.get(CTFStrings.LOST_EVENT_NAME);
+ assertEquals(Long.valueOf(967700L), lostEvents);
+ }
+
+ /**
+ * Test the number of lost events reported in a given range.
+ */
+ @Test
+ public void testLostEventsTypesInRange() {
+ Map<String, Long> eventsInRange = fStats.getEventTypesInRange(rangeStart, rangeEnd);
+ long lostEventsInRange = eventsInRange.get(CTFStrings.LOST_EVENT_NAME);
+ assertEquals(363494L, lostEventsInRange);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests to verify that lost events are handled correctly.
+ *
+ * Be wary if you are using Babeltrace to cross-check those values. There could
+ * be a bug in Babeltrace with regards to lost events. See
+ * http://bugs.lttng.org/issues/589
+ *
+ * It's not 100% sure at this point which implementation is correct, so for now
+ * these tests assume the Java implementation is the right one.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfLostEventsTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.HELLO_LOST;
+
+ private CtfTmfTrace fixture = null;
+
+ /**
+ * Class setup
+ */
+ @Before
+ public void setUp() {
+ assumeTrue(testTrace.exists());
+ fixture = testTrace.getTrace();
+ fixture.indexTrace(true);
+ }
+
+ /**
+ * Clean-up
+ */
+ @After
+ public void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test that the number of events is reported correctly (a range of lost
+ * events is counted as one event).
+ */
+ @Test
+ public void testNbEvents() {
+ final long expectedReal = 32300;
+ final long expectedLost = 562;
+
+ EventCountRequest req = new EventCountRequest();
+ fixture.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ assertEquals(expectedReal, req.getReal());
+ assertEquals(expectedLost, req.getLost());
+ }
+
+ /**
+ * Test getting the first lost event from the trace.
+ */
+ @Test
+ public void testFirstLostEvent() {
+ final long rank = 153;
+ final ITmfTimestamp start = new TmfNanoTimestamp(1376592664828848222L);
+ final ITmfTimestamp end = new TmfNanoTimestamp(1376592664828848540L);
+ final long nbLost = 859;
+
+ final CtfTmfEvent ev = getOneEventTime(start);
+ /* Make sure seeking by rank yields the same event */
+ final CtfTmfEvent ev2 = getOneEventRank(rank);
+ assertEquals(ev, ev2);
+
+ assertTrue(ev instanceof ITmfLostEvent);
+ ITmfLostEvent event = (ITmfLostEvent) ev;
+
+ assertEquals(start, event.getTimestamp());
+ assertEquals(start, event.getTimeRange().getStartTime());
+ assertEquals(end, event.getTimeRange().getEndTime());
+ assertEquals(nbLost, event.getNbLostEvents());
+ }
+
+ /**
+ * Test getting the second lost event from the trace.
+ */
+ @Test
+ public void testSecondLostEvent() {
+ final long rank = 191;
+ final ITmfTimestamp start = new TmfNanoTimestamp(1376592664829402521L);
+ final ITmfTimestamp end = new TmfNanoTimestamp(1376592664829403076L);
+ final long nbLost = 488;
+
+ final CtfTmfEvent ev = getOneEventTime(start);
+ /* Make sure seeking by rank yields the same event */
+ final CtfTmfEvent ev2 = getOneEventRank(rank);
+ assertEquals(ev, ev2);
+
+ assertTrue(ev instanceof ITmfLostEvent);
+ ITmfLostEvent event = (ITmfLostEvent) ev;
+
+ assertEquals(start, event.getTimestamp());
+ assertEquals(start, event.getTimeRange().getStartTime());
+ assertEquals(end, event.getTimeRange().getEndTime());
+ assertEquals(nbLost, event.getNbLostEvents());
+ }
+
+ /**
+ * Test getting one normal event from the trace (lost events should not
+ * interfere).
+ */
+ @Test
+ public void testNormalEvent() {
+ final long rank = 200;
+ final ITmfTimestamp ts = new TmfNanoTimestamp(1376592664829423928L);
+
+ final CtfTmfEvent event = getOneEventTime(ts);
+ /* Make sure seeking by rank yields the same event */
+ final CtfTmfEvent event2 = getOneEventRank(rank);
+ assertEquals(event, event2);
+
+ assertFalse(event instanceof ITmfLostEvent);
+ assertEquals(ts, event.getTimestamp());
+ }
+
+ // ------------------------------------------------------------------------
+ // Event requests
+ // ------------------------------------------------------------------------
+
+ private CtfTmfEvent getOneEventRank(long rank) {
+ OneEventRequestPerRank req = new OneEventRequestPerRank(rank);
+ fixture.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return req.getEvent();
+ }
+
+ private CtfTmfEvent getOneEventTime(@NonNull ITmfTimestamp ts) {
+ OneEventRequestPerTs req = new OneEventRequestPerTs(ts);
+ fixture.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return req.getEvent();
+ }
+
+ private class OneEventRequestPerRank extends TmfEventRequest {
+
+ private CtfTmfEvent event = null;
+
+ public OneEventRequestPerRank(long rank) {
+ super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, rank, 1, ExecutionType.FOREGROUND);
+ }
+
+ @Override
+ public void handleData(ITmfEvent ev) {
+ /* Type is checked by the request, cast should be safe */
+ event = (CtfTmfEvent) ev;
+ }
+
+ public CtfTmfEvent getEvent() {
+ return event;
+ }
+ }
+
+ private class OneEventRequestPerTs extends TmfEventRequest {
+
+ private CtfTmfEvent event = null;
+
+ public OneEventRequestPerTs(@NonNull ITmfTimestamp ts) {
+ super(CtfTmfEvent.class,
+ new TmfTimeRange(ts, TmfTimestamp.BIG_CRUNCH),
+ 0, 1, ExecutionType.FOREGROUND);
+ }
+
+ @Override
+ public void handleData(ITmfEvent ev) {
+ event = (CtfTmfEvent) ev;
+ }
+
+ public CtfTmfEvent getEvent() {
+ return event;
+ }
+ }
+
+ private class EventCountRequest extends TmfEventRequest {
+
+ private long nbReal = 0;
+ private long nbLost = 0;
+
+ public EventCountRequest() {
+ super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, 0,
+ ITmfEventRequest.ALL_DATA, ExecutionType.FOREGROUND);
+ }
+
+ @Override
+ public void handleData(ITmfEvent event) {
+ if (event instanceof ITmfLostEvent) {
+ nbLost++;
+ } else {
+ nbReal++;
+ }
+ }
+
+ public long getReal() {
+ return nbReal;
+ }
+
+ public long getLost() {
+ return nbLost;
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for reading event contexts from a CtfTmfTrace.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class EventContextTest {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /* We use test trace #2, kernel_vm, which has event contexts */
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL_VM;
+
+ private CtfTmfTrace fixture;
+ private long startTime;
+ private long endTime;
+
+ // ------------------------------------------------------------------------
+ // Class methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-class initialization.
+ *
+ * @throws TmfTraceException
+ * If the test trace is not found
+ */
+ @Before
+ public void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+ fixture = new CtfTmfTrace();
+ fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+ fixture.indexTrace(true);
+
+ startTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ endTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ }
+
+ /**
+ * Perform post-class clean-up.
+ */
+ @After
+ public void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Make sure the trace is the correct one, and its timestamps are read
+ * correctly.
+ */
+ @Test
+ public void testTrace() {
+ assertEquals(1363700740555978750L, startTime);
+ assertEquals(1363700770550261288L, endTime);
+ }
+
+ /**
+ * Test the context of the very first event of the trace.
+ */
+ @Test
+ public void testContextStart() {
+ CtfTmfEvent firstEvent = getEventAt(startTime);
+ long perfPageFault = (Long) firstEvent.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) firstEvent.getContent().getField("context._procname").getValue();
+ long tid = (Long) firstEvent.getContent().getField("context._tid").getValue();
+
+ assertEquals(613, perfPageFault);
+ assertEquals("lttng-sessiond", procname);
+ assertEquals(1230, tid);
+ }
+
+ /**
+ * Test the context of the event at 1363700745.559739078.
+ */
+ @Test
+ public void testContext1() {
+ long time = startTime + 5000000000L; // 1363700745.559739078
+ CtfTmfEvent event = getEventAt(time);
+ long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) event.getContent().getField("context._procname").getValue();
+ long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+ assertEquals(6048, perfPageFault);
+ assertEquals("swapper/0", procname);
+ assertEquals(0, tid);
+ }
+
+ /**
+ * Test the context of the event at 1363700750.559707062.
+ */
+ @Test
+ public void testContext2() {
+ long time = startTime + 2 * 5000000000L; // 1363700750.559707062
+ CtfTmfEvent event = getEventAt(time);
+ long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) event.getContent().getField("context._procname").getValue();
+ long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+ assertEquals(13258, perfPageFault);
+ assertEquals("swapper/0", procname);
+ assertEquals(0, tid);
+ }
+
+ /**
+ * Test the context of the event at 1363700755.555723128, which is roughly
+ * mid-way through the trace.
+ */
+ @Test
+ public void testContextMiddle() {
+ long midTime = startTime + (endTime - startTime) / 2L; // 1363700755.555723128
+ CtfTmfEvent midEvent = getEventAt(midTime);
+ long perfPageFault = (Long) midEvent.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) midEvent.getContent().getField("context._procname").getValue();
+ long tid = (Long) midEvent.getContent().getField("context._tid").getValue();
+
+ assertEquals(19438, perfPageFault);
+ assertEquals("swapper/0", procname);
+ assertEquals(0, tid);
+ }
+
+ /**
+ * Test the context of the event at 1363700760.559719724.
+ */
+ @Test
+ public void testContext3() {
+ long time = startTime + 4 * 5000000000L; // 1363700760.559719724
+ CtfTmfEvent event = getEventAt(time);
+ long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) event.getContent().getField("context._procname").getValue();
+ long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+ assertEquals(21507, perfPageFault);
+ assertEquals("swapper/0", procname);
+ assertEquals(0, tid);
+ }
+
+ /**
+ * Test the context of the event at 1363700765.559714634.
+ */
+ @Test
+ public void testContext4() {
+ long time = startTime + 5 * 5000000000L; // 1363700765.559714634
+ CtfTmfEvent event = getEventAt(time);
+ long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) event.getContent().getField("context._procname").getValue();
+ long tid = (Long) event.getContent().getField("context._tid").getValue();
+
+ assertEquals(21507, perfPageFault);
+ assertEquals("swapper/0", procname);
+ assertEquals(0, tid);
+ }
+
+ /**
+ * Test the context of the last event of the trace.
+ */
+ @Test
+ public void testContextEnd() {
+ CtfTmfEvent lastEvent = getEventAt(endTime);
+ long perfPageFault = (Long) lastEvent.getContent().getField("context._perf_page_fault").getValue();
+ String procname = (String) lastEvent.getContent().getField("context._procname").getValue();
+ long tid = (Long) lastEvent.getContent().getField("context._tid").getValue();
+
+ assertEquals(22117, perfPageFault);
+ assertEquals("lttng-sessiond", procname);
+ assertEquals(1230, tid);
+ }
+
+ // ------------------------------------------------------------------------
+ // Private stuff
+ // ------------------------------------------------------------------------
+
+ private synchronized CtfTmfEvent getEventAt(long timestamp) {
+ EventContextTestRequest req = new EventContextTestRequest(timestamp);
+ fixture.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ return null;
+ }
+ return req.getEvent();
+ }
+
+ private class EventContextTestRequest extends TmfEventRequest {
+
+ private CtfTmfEvent retEvent = null;
+
+ public EventContextTestRequest(long timestamp) {
+ super(CtfTmfEvent.class,
+ new TmfTimeRange(new TmfNanoTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
+ 0, 1, ExecutionType.FOREGROUND);
+ }
+
+ @Override
+ public void handleData(ITmfEvent event) {
+ retEvent = (CtfTmfEvent) event;
+ }
+
+ public CtfTmfEvent getEvent() {
+ return retEvent;
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.iterator;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfIteratorTest.class
+})
+public class AllTests {
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.iterator;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfIteratorTest</code> contains tests for the class
+ * <code>{@link CtfIterator}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfIteratorTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+ private CtfTmfTrace trace;
+ private CtfIterator iterator;
+
+ /**
+ * Perform pre-test initialization.
+ */
+ @Before
+ public void setUp() {
+ assumeTrue(testTrace.exists());
+ trace = testTrace.getTrace();
+ iterator = (CtfIterator) trace.createIterator();
+ CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
+ iterator.setLocation(ctfLocation);
+ iterator.increaseRank();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ */
+ @After
+ public void tearDown() {
+ if (trace != null) {
+ trace.dispose();
+ }
+ if (iterator != null) {
+ iterator.dispose();
+ }
+ }
+
+ /**
+ * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
+ */
+ @Test
+ public void testCtfIterator_noinit() {
+ try (CtfIterator result = (CtfIterator) trace.createIterator();) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
+ */
+ @Test
+ public void testCtfIterator_init() {
+ trace.init("test");
+ try (CtfIterator result = (CtfIterator) trace.createIterator();) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
+ * specifies an initial position for the iterator.
+ */
+ @Test
+ public void testCtfIterator_position() {
+ long timestampValue = 1L;
+ long rank = 1L;
+ try (CtfIterator result = (CtfIterator) trace.createIterator(new CtfLocationInfo(timestampValue, 0), rank);) {
+ assertNotNull(result);
+ }
+ }
+
+
+ /**
+ * Run the boolean advance() method test.
+ */
+ @Test
+ public void testAdvance() {
+ boolean result = iterator.advance();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the int compareTo(CtfIterator) method test.
+ */
+ @Test
+ public void testCompareTo() {
+ try (CtfIterator o = (CtfIterator) trace.createIterator();) {
+ int result = iterator.compareTo(o);
+ assertEquals(1L, result);
+ }
+ }
+
+ /**
+ * Run the boolean equals(Object) method test. Compare with another iterator
+ * on the same trace.
+ */
+ @Test
+ public void testEquals_other() {
+ try (CtfIterator obj = (CtfIterator) trace.createIterator();) {
+ assertNotNull(obj);
+ CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
+ obj.setLocation(ctfLocation1);
+ obj.increaseRank();
+
+ boolean result = iterator.equals(obj);
+ assertTrue(result);
+ }
+ }
+
+ /**
+ * Run the boolean equals(Object) method test. Compare with an empty object.
+ */
+ @Test
+ public void testEquals_empty() {
+ Object obj = new Object();
+ boolean result = iterator.equals(obj);
+
+ assertFalse(result);
+ }
+
+ /**
+ * Run the CtfTmfTrace getCtfTmfTrace() method test.
+ */
+ @Test
+ public void testGetCtfTmfTrace() {
+ try (CtfTmfTrace result = iterator.getCtfTmfTrace();) {
+ assertNotNull(result);
+ }
+ }
+
+ /**
+ * Run the CtfTmfEvent getCurrentEvent() method test.
+ */
+ @Test
+ public void testGetCurrentEvent() {
+ CtfTmfEvent result = iterator.getCurrentEvent();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the CtfLocation getLocation() method test.
+ */
+ @Test
+ public void testGetLocation() {
+ CtfLocation result = iterator.getLocation();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getRank() method test.
+ */
+ @Test
+ public void testGetRank() {
+ long result = iterator.getRank();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the boolean hasValidRank() method test.
+ */
+ @Test
+ public void testHasValidRank() {
+ boolean result = iterator.hasValidRank();
+ assertTrue(result);
+ }
+
+ /**
+ * Run the int hashCode() method test.
+ */
+ @Test
+ public void testHashCode() {
+ int result = iterator.hashCode();
+ int result2 = iterator.hashCode();
+ assertEquals(result, result2);
+ }
+
+ /**
+ * Run the void increaseRank() method test.
+ */
+ @Test
+ public void testIncreaseRank() {
+ iterator.increaseRank();
+ }
+
+ /**
+ * Run the boolean seek(long) method test.
+ */
+ @Test
+ public void testSeek() {
+ long timestamp = 1L;
+ boolean result = iterator.seek(timestamp);
+ assertTrue(result);
+ }
+
+ /**
+ * Run the void setLocation(ITmfLocation<?>) method test.
+ */
+ @Test
+ public void testSetLocation() {
+ CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
+ iterator.setLocation(location);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;
+
+import java.util.Vector;
+
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Test and benchmark reading a CTF LTTng kernel trace.
+ *
+ * @author Matthew Khouzam
+ */
+public class Benchmark {
+
+ /**
+ * Run the benchmark.
+ *
+ * @param args The command-line arguments
+ */
+ public static void main(final String[] args) {
+ final String TRACE_PATH = "testfiles/kernel";
+ final int NUM_LOOPS = 100;
+
+ // Change this to enable text output
+ final boolean USE_TEXT = true;
+
+ // Work variables
+ long nbEvent = 0L;
+ final Vector<Double> benchs = new Vector<>();
+ long start, stop;
+ for (int loops = 0; loops < NUM_LOOPS; loops++) {
+ nbEvent = 0L;
+ try (CtfTmfTrace trace = new CtfTmfTrace();) {
+ try {
+ trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
+ } catch (final TmfTraceException e) {
+ loops = NUM_LOOPS + 1;
+ break;
+ }
+
+ start = System.nanoTime();
+ if (nbEvent != -1) {
+ final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
+
+ start = System.nanoTime();
+ CtfTmfEvent current = traceReader.getCurrentEvent();
+ while (current != null) {
+ nbEvent++;
+ if (USE_TEXT) {
+
+ System.out.println("Event " + nbEvent + " Time "
+ + current.getTimestamp().toString() + " type " + current.getType().getName()
+ + " on CPU " + current.getCPU() + " " + current.getContent().toString());
+ }
+ // advance the trace to the next event.
+ boolean hasMore = traceReader.advance();
+ if (hasMore) {
+ // you can know the trace has more events.
+ }
+ current = traceReader.getCurrentEvent();
+ }
+ }
+ stop = System.nanoTime();
+ System.out.print('.');
+ final double time = (stop - start) / (double) nbEvent;
+ benchs.add(time);
+ } // trace.close()
+ }
+ System.out.println("");
+ double avg = 0;
+ for (final double val : benchs) {
+ avg += val;
+ }
+ avg /= benchs.size();
+ System.out.println("Time to read = " + avg + " events/ns");
+ for (final Double val : benchs) {
+ System.out.print(val);
+ System.out.print(", ");
+ }
+
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2015 Ericsson
+ *
+ * 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:
+ * William Bourque <wbourque@gmail.com> - Initial API and implementation
+ * Matthew Khouzam - Update to CtfTmf trace and events
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;
+
+import java.util.Vector;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Benchmark the event request subsystem of TMF.
+ */
+public class RequestBenchmark extends TmfEventRequest {
+
+ private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
+ final TmfTimeRange range, final int nbRequested) {
+ super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
+ }
+
+ // Path of the trace
+ private static final String TRACE_PATH = "../org.eclipse.tracecompass.ctf.core.tests/traces/kernel";
+
+ // Change this to run several time over the same trace
+ private static final int NB_OF_PASS = 100;
+
+ // Work variables
+ private static int nbEvent = 0;
+ private static TmfExperiment fExperiment = null;
+ private static Vector<Double> benchs = new Vector<>();
+
+ /**
+ * Run the benchmark
+ *
+ * @param args
+ * The command-line arguments
+ */
+ public static void main(final String[] args) {
+
+ try {
+ /* Our experiment will contains ONE trace */
+ final ITmfTrace[] traces = new ITmfTrace[1];
+ traces[0] = new CtfTmfTrace();
+ traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
+ /* Create our new experiment */
+ fExperiment = new TmfExperiment(CtfTmfEvent.class, "Headless", traces,
+ TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
+
+ /*
+ * We will issue a request for each "pass". TMF will then process
+ * them synchronously.
+ */
+ RequestBenchmark request = null;
+ for (int x = 0; x < NB_OF_PASS; x++) {
+ request = new RequestBenchmark(CtfTmfEvent.class,
+ TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
+ fExperiment.sendRequest(request);
+ }
+ prev = System.nanoTime();
+ } catch (final NullPointerException e) {
+ /*
+ * Silently dismiss Null pointer exception The only way to "finish"
+ * the threads in TMF is by crashing them with null.
+ */
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public void handleData(final ITmfEvent event) {
+ super.handleData(event);
+ nbEvent++;
+
+ }
+
+ static long prev;
+ static long done = 0;
+ @Override
+ public void handleCompleted() {
+ final long next = System.nanoTime();
+ double val = next - prev;
+ final int nbEvent2 = nbEvent;
+ val /= nbEvent2;
+
+ nbEvent = 0;
+ prev = next;
+ benchs.add(val);
+ if (benchs.size() == NB_OF_PASS) {
+ try {
+ System.out.println("Nb events : " + nbEvent2);
+
+ for (final double value : benchs) {
+ System.out.print(value + ", ");
+ }
+ fExperiment.sendRequest(null);
+
+ } catch (final Exception e) {
+ }
+ }
+ }
+
+ @Override
+ public void handleSuccess() {
+ }
+
+ @Override
+ public void handleFailure() {
+ }
+
+ @Override
+ public void handleCancel() {
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TmfSchedulerTest.class
+})
+public class AllTests {}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Simon Delisle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
+
+import java.io.PrintWriter;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Benchmark for the request scheduler
+ *
+ * The benchmark has three tests. The first one is the latency (time between the
+ * creation of the request and the beginning of its execution). The second one
+ * is the average waiting time for a request. The last one is the total
+ * completion time.
+ */
+public class TmfSchedulerBenchmark {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final int NUM_LOOPS = 10;
+ private static final int NANOSECONDS_IN_MILLISECONDS = 1000000;
+ private static final int NANOSECONDS_IN_SECONDS = 1000000000;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
+ private static ForegroundRequest lastForegroundRequest = null;
+ private static BackgroundRequest lastBackgroundRequest = null;
+
+ private static PrintWriter pw = new PrintWriter(System.out, true);
+
+ /**
+ * Start the benchmark
+ *
+ * @param args
+ * The command-line arguments
+ */
+ public static void main(final String[] args) {
+ trace.indexTrace(true);
+ pw.println("---------- Benchmark started ----------");
+ latencyBenchmark();
+ averageWaitingTime();
+ completedTime();
+ benchmarkResults();
+ trace.dispose();
+ }
+
+ private static void latencyBenchmark() {
+ long averageLatency = 0;
+
+ pw.println("----- Latency -----");
+ for (int i = 0; i < NUM_LOOPS; i++) {
+ try {
+ ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground1);
+ foreground1.waitForCompletion();
+ averageLatency += foreground1.getLatency();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ pw.println((averageLatency / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+ }
+
+ private static void averageWaitingTime() {
+ long averageWaitingBackground = 0;
+ long averageWaitingForeground1 = 0;
+ long averageWaitingForeground2 = 0;
+
+ pw.println("----- Average waiting time with 3 requests -----");
+ for (int i = 0; i < NUM_LOOPS; i++) {
+ ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(background1);
+ trace.sendRequest(foreground1);
+ trace.sendRequest(foreground2);
+ try {
+ foreground1.waitForCompletion();
+ foreground2.waitForCompletion();
+ background1.waitForCompletion();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ averageWaitingBackground += background1.getAverageWaitingTime();
+ averageWaitingForeground1 += foreground1.getAverageWaitingTime();
+ averageWaitingForeground2 += foreground2.getAverageWaitingTime();
+ }
+ pw.print("-- Background : ");
+ pw.println((averageWaitingBackground / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+
+ pw.print("-- First foreground : ");
+ pw.println((averageWaitingForeground1 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+
+ pw.print("-- Second foreground : ");
+ pw.println((averageWaitingForeground2 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
+ }
+
+ private static void completedTime() {
+ long averageCompletedTime1 = 0;
+ long averageCompletedTime2 = 0;
+ long averageCompletedTime3 = 0;
+ long averageCompletedTime4 = 0;
+ long averageCompletedTime5 = 0;
+ long averageCompletedTime6 = 0;
+
+ pw.println("----- Time to complete request -----");
+ for (int i = 0; i < NUM_LOOPS; i++) {
+ try {
+ ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground1);
+ foreground1.waitForCompletion();
+ averageCompletedTime1 += foreground1.getCompletedTime();
+
+ ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground2);
+ trace.sendRequest(foreground3);
+ foreground2.waitForCompletion();
+ foreground3.waitForCompletion();
+ averageCompletedTime2 += (foreground2.getCompletedTime() + foreground3.getCompletedTime());
+
+ ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground4);
+ trace.sendRequest(background1);
+ foreground4.waitForCompletion();
+ background1.waitForCompletion();
+ averageCompletedTime3 += (foreground4.getCompletedTime() + background1.getCompletedTime());
+
+ ForegroundRequest foreground5 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground5);
+ trace.sendRequest(foreground6);
+ trace.sendRequest(background2);
+ foreground5.waitForCompletion();
+ foreground6.waitForCompletion();
+ background2.waitForCompletion();
+ averageCompletedTime4 += (foreground5.getCompletedTime() + foreground6.getCompletedTime() + background2.getCompletedTime());
+
+ ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground8 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background3 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground7);
+ trace.sendRequest(foreground8);
+ trace.sendRequest(foreground9);
+ trace.sendRequest(background3);
+ foreground7.waitForCompletion();
+ foreground8.waitForCompletion();
+ foreground9.waitForCompletion();
+ background3.waitForCompletion();
+ averageCompletedTime5 += (foreground7.getCompletedTime() + foreground8.getCompletedTime() + foreground9.getCompletedTime() + background3.getCompletedTime());
+
+ ForegroundRequest foreground10 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground11 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground12 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground13 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background4 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ trace.sendRequest(foreground10);
+ trace.sendRequest(foreground11);
+ trace.sendRequest(foreground12);
+ trace.sendRequest(foreground13);
+ trace.sendRequest(background4);
+ foreground10.waitForCompletion();
+ foreground11.waitForCompletion();
+ foreground12.waitForCompletion();
+ foreground13.waitForCompletion();
+ background4.waitForCompletion();
+ averageCompletedTime6 += (foreground10.getCompletedTime() + foreground11.getCompletedTime() + foreground12.getCompletedTime() + foreground13.getCompletedTime() + background4.getCompletedTime());
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ pw.print("-- Time to complete one request : ");
+ pw.println((averageCompletedTime1 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+ pw.print("-- Time to complete 2 requests (2 foreground) : ");
+ pw.println((averageCompletedTime2 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+ pw.print("-- Time to complete 2 requests (1 foreground, 1 background) : ");
+ pw.println((averageCompletedTime3 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+ pw.print("-- Time to complete 3 requests (2 foreground, 1 background) : ");
+ pw.println((averageCompletedTime4 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+ pw.print("-- Time to complete 4 requests (3 foreground, 1 background) : ");
+ pw.println((averageCompletedTime5 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+
+ pw.print("-- Time to complete 5 requests (4 foreground, 1 background) : ");
+ pw.println((averageCompletedTime6 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
+ }
+
+ /**
+ * The benchmark results
+ */
+ public static void benchmarkResults() {
+ pw.println("---------- Benchmark completed ----------");
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper methods
+ // ------------------------------------------------------------------------
+
+ private static class BackgroundRequest extends TmfEventRequest {
+ private long startTime;
+ private long endTimeLatency = -1;
+ private long completedTime = 0;
+ private long waitingTimeStart = 0;
+ private long waitingTimeEnd = 0;
+ private long waitingTime = 0;
+ private int waitingCounter = 0;
+ private boolean isWaiting = false;
+
+ BackgroundRequest(TmfTimeRange timeRange) {
+ super(trace.getEventType(),
+ timeRange,
+ 0,
+ ITmfEventRequest.ALL_DATA,
+ ExecutionType.BACKGROUND);
+ startTime = System.nanoTime();
+ }
+
+ @Override
+ public void handleData(final ITmfEvent event) {
+ if (endTimeLatency == -1) {
+ endTimeLatency = System.nanoTime();
+ }
+ super.handleData(event);
+ if (lastForegroundRequest == null && lastBackgroundRequest == null) {
+ lastBackgroundRequest = this;
+ }
+ if (isWaiting) {
+ waitingTimeEnd = System.nanoTime();
+ waitingTime += waitingTimeEnd - waitingTimeStart;
+ ++waitingCounter;
+ isWaiting = false;
+ }
+ if (lastForegroundRequest != null) {
+ lastForegroundRequest.waitingTimeStart = System.nanoTime();
+ lastForegroundRequest.isWaiting = true;
+ lastForegroundRequest = null;
+ lastBackgroundRequest = this;
+ }
+ if (lastBackgroundRequest != this) {
+ lastBackgroundRequest.waitingTimeStart = System.nanoTime();
+ lastBackgroundRequest.isWaiting = true;
+ lastBackgroundRequest = this;
+ }
+ }
+
+ @Override
+ public void handleCompleted() {
+ completedTime = System.nanoTime();
+ super.handleCompleted();
+ }
+
+ public long getCompletedTime() {
+ return completedTime - startTime;
+ }
+
+ public long getAverageWaitingTime() {
+ if (waitingCounter == 0) {
+ return 0;
+ }
+ return waitingTime / waitingCounter;
+ }
+ }
+
+ private static class ForegroundRequest extends TmfEventRequest {
+ private long startTime = 0;
+ private long endTimeLatency = -1;
+ private long completedTime = 0;
+ private long waitingTimeStart = 0;
+ private long waitingTimeEnd = 0;
+ private long waitingTime = 0;
+ private int waitingCounter = 0;
+ private boolean isWaiting = false;
+
+ ForegroundRequest(TmfTimeRange timeRange) {
+ super(trace.getEventType(),
+ timeRange,
+ 0,
+ ITmfEventRequest.ALL_DATA,
+ ExecutionType.FOREGROUND);
+ startTime = System.nanoTime();
+ }
+
+ @Override
+ public void handleData(final ITmfEvent event) {
+ if (endTimeLatency == -1) {
+ endTimeLatency = System.nanoTime();
+ }
+ super.handleData(event);
+ if (lastBackgroundRequest == null && lastForegroundRequest == null) {
+ lastForegroundRequest = this;
+ }
+ if (isWaiting) {
+ waitingTimeEnd = System.nanoTime();
+ waitingTime += waitingTimeEnd - waitingTimeStart;
+ ++waitingCounter;
+ isWaiting = false;
+ }
+ if (lastBackgroundRequest != null) {
+ lastBackgroundRequest.waitingTimeStart = System.nanoTime();
+ lastBackgroundRequest.isWaiting = true;
+ lastBackgroundRequest = null;
+ lastForegroundRequest = this;
+ }
+ if (lastForegroundRequest != this) {
+ lastForegroundRequest.waitingTimeStart = System.nanoTime();
+ lastForegroundRequest.isWaiting = true;
+ lastForegroundRequest = this;
+ }
+ }
+
+ @Override
+ public void handleCompleted() {
+ completedTime = System.nanoTime();
+ super.handleCompleted();
+ }
+
+ public long getLatency() {
+ return endTimeLatency - startTime;
+ }
+
+ public long getCompletedTime() {
+ return completedTime - startTime;
+ }
+
+ public long getAverageWaitingTime() {
+ if (waitingCounter == 0) {
+ return 0;
+ }
+ return waitingTime / waitingCounter;
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Simon Delisle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Test suite for the scheduler.
+ */
+public class TmfSchedulerTest {
+
+ /** Time-out tests after 60 seconds */
+ @Rule
+ public TestRule globalTimeout= new Timeout(60000);
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+ private static final int NB_EVENTS_TRACE = 695319;
+ private static final int NB_EVENTS_TIME_RANGE = 155133;
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private CtfTmfTrace fixture;
+
+ private long fStartTime;
+ private long fEndTime;
+ private TmfTimeRange fForegroundTimeRange;
+
+ private final List<String> fOrderList = new ArrayList<>();
+ private int fForegroundId = 0;
+ private int fBackgroundId = 0;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws TmfTraceException
+ * If the test trace is not found
+ */
+ @Before
+ public void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+ fixture = new CtfTmfTrace();
+ fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+ fixture.indexTrace(true);
+ fStartTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ fEndTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+
+ long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
+ long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
+ fForegroundTimeRange = new TmfTimeRange(new TmfTimestamp(foregroundStartTime, ITmfTimestamp.NANOSECOND_SCALE),
+ new TmfTimestamp(foregroundEndTime, ITmfTimestamp.NANOSECOND_SCALE));
+ }
+
+ /**
+ * Perform post-test clean-up.
+ */
+ @After
+ public void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Tests cases
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test one background request
+ */
+ @Test
+ public void backgroundRequest() {
+ BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ fixture.sendRequest(background);
+ try {
+ background.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
+ }
+
+ /**
+ * Test one foreground request
+ */
+ @Test
+ public void foregroundRequest() {
+ ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ fixture.sendRequest(foreground);
+ try {
+ foreground.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
+ }
+
+ /**
+ * Test one foreground and one background request for the entire trace at
+ * the same time
+ */
+ @Test
+ public void TestMultiRequest1() {
+ BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+ fixture.sendRequest(background);
+ fixture.sendRequest(foreground);
+ try {
+ background.waitForCompletion();
+ foreground.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
+ assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
+ }
+
+ /**
+ * Test one background request for the entire trace and one foreground
+ * request for smaller time range
+ */
+ @Test
+ public void TestMultiRequest2() {
+ BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground2 = new ForegroundRequest(fForegroundTimeRange);
+
+ fixture.sendRequest(background2);
+ fixture.sendRequest(foreground2);
+ try {
+ background2.waitForCompletion();
+ foreground2.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TRACE, background2.getNbEvents());
+ assertEquals(NB_EVENTS_TIME_RANGE, foreground2.getNbEvents());
+ }
+
+ /**
+ * Test two foreground request, one to select a time range and one to select
+ * an event in this time range
+ */
+ @Test
+ public void TestMultiRequest3() {
+ ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ fixture.sendRequest(foreground3);
+
+ TmfSelectionRangeUpdatedSignal signal3 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fForegroundTimeRange.getStartTime()));
+ fixture.broadcast(signal3);
+
+ try {
+ foreground3.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TRACE, foreground3.getNbEvents());
+ }
+
+ /**
+ * Test two foreground request, one to select a time range and one to select
+ * an event before this time range
+ */
+ @Test
+ public void TestMultiRequest4() {
+ ForegroundRequest foreground4 = new ForegroundRequest(fForegroundTimeRange);
+ fixture.sendRequest(foreground4);
+ TmfSelectionRangeUpdatedSignal signal4 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+ fixture.broadcast(signal4);
+
+ try {
+ foreground4.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TIME_RANGE, foreground4.getNbEvents());
+ }
+
+ /**
+ * Test two foreground request, one to select a time range and one to select
+ * an event after this time range
+ */
+ @Test
+ public void TestMultiRequest5() {
+ ForegroundRequest foreground5 = new ForegroundRequest(fForegroundTimeRange);
+ fixture.sendRequest(foreground5);
+ TmfSelectionRangeUpdatedSignal signal5 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fEndTime - ((fEndTime - fStartTime) / 4)));
+ fixture.broadcast(signal5);
+
+ try {
+ foreground5.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TIME_RANGE, foreground5.getNbEvents());
+ }
+
+ /**
+ * Test one background and one foreground request for the entire trace and
+ * one foreground request to select an event
+ */
+ @Test
+ public void TestMultiRequest6() {
+ BackgroundRequest background6 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+ fixture.sendRequest(background6);
+ fixture.sendRequest(foreground6);
+
+ TmfSelectionRangeUpdatedSignal signal6 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
+ fixture.broadcast(signal6);
+
+ try {
+ background6.waitForCompletion();
+ foreground6.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+
+ assertEquals(NB_EVENTS_TRACE, background6.getNbEvents());
+ assertEquals(NB_EVENTS_TRACE, foreground6.getNbEvents());
+ }
+
+ /**
+ * Four request, two foreground and two background
+ */
+ @Test
+ public void TestMultiRequest7() {
+ ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground8 = new ForegroundRequest(fForegroundTimeRange);
+ BackgroundRequest background7 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background8 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ fixture.sendRequest(foreground7);
+ fixture.sendRequest(foreground8);
+ fixture.sendRequest(background7);
+ fixture.sendRequest(background8);
+ try {
+ foreground7.waitForCompletion();
+ foreground8.waitForCompletion();
+ background7.waitForCompletion();
+ background8.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertEquals(NB_EVENTS_TRACE, foreground7.getNbEvents());
+ assertEquals(NB_EVENTS_TIME_RANGE, foreground8.getNbEvents());
+ assertEquals(NB_EVENTS_TRACE, background7.getNbEvents());
+ assertEquals(NB_EVENTS_TRACE, background8.getNbEvents());
+ }
+
+ /**
+ * One long foreground request and one short foreground request, the short
+ * one should finish first
+ */
+ @Test
+ public void preemptedForegroundRequest() {
+ ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ TmfTimeRange shortTimeRange = new TmfTimeRange(new TmfTimestamp(fStartTime, ITmfTimestamp.NANOSECOND_SCALE),
+ new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 16), ITmfTimestamp.NANOSECOND_SCALE));
+ ForegroundRequest shortForeground = new ForegroundRequest(shortTimeRange);
+ fixture.sendRequest(foreground9);
+ try {
+ foreground9.waitForStart();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ fixture.sendRequest(shortForeground);
+ try {
+ shortForeground.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertFalse(foreground9.isCompleted());
+ }
+
+ /**
+ * One long background request and one short foreground request, the
+ * foreground request should finish first
+ */
+ @Test
+ public void preemptedBackgroundRequest() {
+ BackgroundRequest background9 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground10 = new ForegroundRequest(fForegroundTimeRange);
+ fixture.sendRequest(background9);
+ fixture.sendRequest(foreground10);
+ try {
+ foreground10.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertTrue(foreground10.isCompleted());
+ assertFalse(background9.isCompleted());
+ }
+
+ /**
+ * Test if the scheduler is working as expected
+ */
+ @Ignore
+ @Test
+ public void executionOrder() {
+ List<String> expectedOrder = new LinkedList<>();
+ expectedOrder.add("FOREGROUND1");
+ expectedOrder.add("FOREGROUND2");
+ expectedOrder.add("FOREGROUND3");
+ expectedOrder.add("FOREGROUND4");
+ expectedOrder.add("BACKGROUND1");
+ expectedOrder.add("FOREGROUND1");
+ expectedOrder.add("FOREGROUND2");
+ expectedOrder.add("FOREGROUND3");
+ expectedOrder.add("FOREGROUND4");
+ expectedOrder.add("BACKGROUND2");
+
+ fOrderList.clear();
+ fForegroundId = 0;
+ fBackgroundId = 0;
+
+ BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+ BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
+
+ ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+ ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
+
+ fixture.sendRequest(foreground1);
+ fixture.sendRequest(foreground2);
+ fixture.sendRequest(foreground3);
+ fixture.sendRequest(foreground4);
+ fixture.sendRequest(background1);
+ fixture.sendRequest(background2);
+ try {
+ foreground1.waitForCompletion();
+ foreground2.waitForCompletion();
+ foreground3.waitForCompletion();
+ foreground4.waitForCompletion();
+ background1.waitForCompletion();
+ background2.waitForCompletion();
+ } catch (InterruptedException e) {
+ fail();
+ }
+ assertEquals(expectedOrder, fOrderList.subList(0, expectedOrder.size()));
+ }
+
+ // ------------------------------------------------------------------------
+ // Helper methods
+ // ------------------------------------------------------------------------
+
+ private class BackgroundRequest extends TmfEventRequest {
+ private int nbEvents = 0;
+ private String backgroundName;
+
+ BackgroundRequest(TmfTimeRange timeRange) {
+ super(fixture.getEventType(),
+ timeRange,
+ 0,
+ ITmfEventRequest.ALL_DATA,
+ ExecutionType.BACKGROUND);
+ backgroundName = getExecType().toString() + ++fBackgroundId;
+ }
+
+ @Override
+ public void handleData(final ITmfEvent event) {
+ super.handleData(event);
+ synchronized (fOrderList) {
+ if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(backgroundName)) {
+ fOrderList.add(backgroundName);
+ }
+ }
+ ++nbEvents;
+ }
+
+ public int getNbEvents() {
+ return nbEvents;
+ }
+ }
+
+ private class ForegroundRequest extends TmfEventRequest {
+ private int nbEvents = 0;
+ private String foregroundName;
+
+ ForegroundRequest(TmfTimeRange timeRange) {
+ super(fixture.getEventType(),
+ timeRange,
+ 0,
+ ITmfEventRequest.ALL_DATA,
+ ExecutionType.FOREGROUND);
+ foregroundName = getExecType().toString() + ++fForegroundId;
+ }
+
+ @Override
+ public void handleData(final ITmfEvent event) {
+ super.handleData(event);
+ synchronized (fOrderList) {
+ if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(foregroundName)) {
+ fOrderList.add(foregroundName);
+ }
+ }
+ ++nbEvents;
+ }
+
+ public int getNbEvents() {
+ return nbEvents;
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TmfEventsStatisticsTest.class,
+ TmfStateStatisticsTest.class
+})
+public class AllTests {}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.tmf.core.statistics.TmfEventsStatistics;
+import org.junit.BeforeClass;
+
+/**
+ * Unit tests for the {@link TmfEventsStatistics}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfEventsStatisticsTest extends TmfStatisticsTest {
+
+ /**
+ * Set up the fixture once for all tests.
+ */
+ @BeforeClass
+ public static void setUpClass() {
+ assumeTrue(testTrace.exists());
+ backend = new TmfEventsStatistics(testTrace.getTrace());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+/**
+ * Unit tests for the {@link TmfStateStatistics}
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfStateStatisticsTest extends TmfStatisticsTest {
+
+ private ITmfTrace fTrace;
+
+ private TmfStatisticsTotalsModule fTotalsMod;
+ private TmfStatisticsEventTypesModule fEventTypesMod;
+
+ /**
+ * Class setup
+ */
+ @BeforeClass
+ public static void setUpClass() {
+ assumeTrue(testTrace.exists());
+ }
+
+ /**
+ * Test setup
+ */
+ @Before
+ public void setUp() {
+ ITmfTrace trace = testTrace.getTrace();
+ fTrace = trace;
+
+ /* Prepare the two analysis-backed state systems */
+ fTotalsMod = new TmfStatisticsTotalsModule();
+ fEventTypesMod = new TmfStatisticsEventTypesModule();
+ try {
+ fTotalsMod.setTrace(trace);
+ fEventTypesMod.setTrace(trace);
+ } catch (TmfAnalysisException e) {
+ fail();
+ }
+
+ fTotalsMod.schedule();
+ fEventTypesMod.schedule();
+ assertTrue(fTotalsMod.waitForCompletion());
+ assertTrue(fEventTypesMod.waitForCompletion());
+
+ ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
+ ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
+ assertNotNull(totalsSS);
+ assertNotNull(eventTypesSS);
+
+ backend = new TmfStateStatistics(totalsSS, eventTypesSS);
+ }
+
+ /**
+ * Test cleanup
+ */
+ @After
+ public void tearDown() {
+ fTotalsMod.dispose();
+ fEventTypesMod.dispose();
+ fTrace.dispose();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * Base unit test class for any type of ITmfStatistics. Sub-classes should
+ * implement a "@BeforeClass" method to setup the 'backend' fixture accordingly.
+ *
+ * @author Alexandre Montplaisir
+ */
+public abstract class TmfStatisticsTest {
+
+ /** Time-out tests after 30 seconds */
+ @Rule public TestRule globalTimeout= new Timeout(30000);
+
+ /** Test trace used for these tests */
+ protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+ /** The statistics back-end object */
+ protected static ITmfStatistics backend;
+
+ /* Known values about the trace */
+ private static final int totalNbEvents = 695319;
+ private static final long tStart = 1332170682440133097L; /* Timestamp of first event */
+ private static final long tEnd = 1332170692664579801L; /* Timestamp of last event */
+
+ /* Timestamps of interest */
+ private static final long t1 = 1332170682490946000L;
+ private static final long t2 = 1332170682490947524L; /* event exactly here */
+ private static final long t3 = 1332170682490948000L;
+ private static final long t4 = 1332170682490949000L;
+ private static final long t5 = 1332170682490949270L; /* following event here */
+ private static final long t6 = 1332170682490949300L;
+
+ private static final String eventType = "lttng_statedump_process_state";
+
+
+ // ------------------------------------------------------------------------
+ // Tests for histogramQuery()
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test the {@link ITmfStatistics#histogramQuery} method for the small known
+ * interval.
+ */
+ @Test
+ public void testHistogramQuerySmall() {
+ final int NB_REQ = 10;
+ List<Long> results = backend.histogramQuery(t1, t6, NB_REQ);
+
+ /* Make sure the returned array has the right size */
+ assertEquals(NB_REQ, results.size());
+
+ /* Check the contents of each "bucket" */
+ assertEquals(0, results.get(0).longValue());
+ assertEquals(0, results.get(1).longValue());
+ assertEquals(0, results.get(2).longValue());
+ assertEquals(0, results.get(3).longValue());
+ assertEquals(1, results.get(4).longValue());
+ assertEquals(0, results.get(5).longValue());
+ assertEquals(0, results.get(6).longValue());
+ assertEquals(0, results.get(7).longValue());
+ assertEquals(0, results.get(8).longValue());
+ assertEquals(1, results.get(9).longValue());
+
+ }
+
+ /**
+ * Test the {@link ITmfStatistics#histogramQuery} method over the whole
+ * trace.
+ */
+ @Test
+ public void testHistogramQueryFull() {
+ final int NB_REQ = 10;
+ List<Long> results = backend.histogramQuery(tStart, tEnd, NB_REQ);
+
+ /* Make sure the returned array has the right size */
+ assertEquals(NB_REQ, results.size());
+
+ /* Check the total number of events */
+ long count = 0;
+ for (long val : results) {
+ count += val;
+ }
+ assertEquals(totalNbEvents, count);
+
+ /* Check the contents of each "bucket" */
+ assertEquals(94161, results.get(0).longValue());
+ assertEquals(87348, results.get(1).longValue());
+ assertEquals(58941, results.get(2).longValue());
+ assertEquals(59879, results.get(3).longValue());
+ assertEquals(66941, results.get(4).longValue());
+ assertEquals(68939, results.get(5).longValue());
+ assertEquals(72746, results.get(6).longValue());
+ assertEquals(60749, results.get(7).longValue());
+ assertEquals(61208, results.get(8).longValue());
+ assertEquals(64407, results.get(9).longValue());
+ }
+
+ // ------------------------------------------------------------------------
+ // Test for getEventsTotal()
+ // ------------------------------------------------------------------------
+
+ /**
+ * Basic test for {@link ITmfStatistics#getEventsTotal}
+ */
+ @Test
+ public void testGetEventsTotal() {
+ long count = backend.getEventsTotal();
+ assertEquals(totalNbEvents, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // Test for getEventTypesTotal()
+ // ------------------------------------------------------------------------
+
+ /**
+ * Basic test for {@link ITmfStatistics#getEventTypesTotal}
+ */
+ @Test
+ public void testEventTypesTotal() {
+ Map<String, Long> res = backend.getEventTypesTotal();
+ assertEquals(126, res.size()); /* Number of different event types in the trace */
+
+ long count = sumOfEvents(res);
+ assertEquals(totalNbEvents, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // Tests for getEventsInRange(ITmfTimestamp start, ITmfTimestamp end)
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} over the whole trace.
+ */
+ @Test
+ public void testGetEventsInRangeWholeRange() {
+ long count = backend.getEventsInRange(tStart, tEnd);
+ assertEquals(totalNbEvents, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
+ * except the start time (there is only one event at the start time).
+ */
+ @Test
+ public void testGetEventsInRangeMinusStart() {
+ long count = backend.getEventsInRange(tStart + 1, tEnd);
+ assertEquals(totalNbEvents - 1, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
+ * except the end time (there is only one event at the end time).
+ */
+ @Test
+ public void testGetEventsInRangeMinusEnd() {
+ long count = backend.getEventsInRange(tStart, tEnd - 1);
+ assertEquals(totalNbEvents - 1, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} when both the start and
+ * end times don't match an event.
+ */
+ @Test
+ public void testGetEventsInRangeNoEventsAtEdges() {
+ long count = backend.getEventsInRange(t1, t6);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} when the *start* of the
+ * interval is exactly on an event (that event should be included).
+ */
+ @Test
+ public void testGetEventsInRangeEventAtStart() {
+ long count = backend.getEventsInRange(t2, t3);
+ assertEquals(1, count);
+
+ count = backend.getEventsInRange(t2, t6);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} when the *end* of the
+ * interval is exactly on an event (that event should be included).
+ */
+ @Test
+ public void testGetEventsInRangeEventAtEnd() {
+ long count = backend.getEventsInRange(t4, t5);
+ assertEquals(1, count);
+
+ count = backend.getEventsInRange(t1, t5);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} when there are events
+ * matching exactly both the start and end times of the range (both should
+ * be included).
+ */
+ @Test
+ public void testGetEventsInRangeEventAtBoth() {
+ long count = backend.getEventsInRange(t2, t5);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventsInRange} when there are no events
+ * in a given range.
+ */
+ @Test
+ public void testGetEventsInRangeNoEvents() {
+ long count = backend.getEventsInRange(t3, t4);
+ assertEquals(0, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // Tests for getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end)
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} over the whole trace.
+ */
+ @Test
+ public void testGetEventTypesInRangeWholeRange() {
+ Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd);
+ /* Number of events of that type in the whole trace */
+ assertEquals(new Long(464L), result.get(eventType));
+
+ long count = sumOfEvents(result);
+ assertEquals(totalNbEvents, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
+ * except the start time (there is only one event at the start time).
+ */
+ @Test
+ public void testGetEventTypesInRangeMinusStart() {
+ Map<String, Long> result = backend.getEventTypesInRange(tStart + 1, tEnd);
+
+ long count = sumOfEvents(result);
+ assertEquals(totalNbEvents - 1, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
+ * except the end time (there is only one event at the end time).
+ */
+ @Test
+ public void testGetEventTypesInRangeMinusEnd() {
+ Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd - 1);
+
+ long count = sumOfEvents(result);
+ assertEquals(totalNbEvents - 1, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} when both the start
+ * and end times don't match an event.
+ */
+ @Test
+ public void testGetEventTypesInRangeNoEventsAtEdges() {
+ Map<String, Long> result = backend.getEventTypesInRange(t1, t6);
+ assertEquals(new Long(2L), result.get(eventType));
+
+ long count = sumOfEvents(result);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} when the *start* of
+ * the interval is exactly on an event (that event should be included).
+ */
+ @Test
+ public void testGetEventTypesInRangeEventAtStart() {
+ Map<String, Long> result = backend.getEventTypesInRange(t2, t3);
+ assertEquals(new Long(1L), result.get(eventType));
+ long count = sumOfEvents(result);
+ assertEquals(1, count);
+
+ result = backend.getEventTypesInRange(t2, t6);
+ assertEquals(new Long(2L), result.get(eventType));
+ count = sumOfEvents(result);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} when the *end* of
+ * the interval is exactly on an event (that event should be included).
+ */
+ @Test
+ public void testGetEventTypesInRangeEventAtEnd() {
+ Map<String, Long> result = backend.getEventTypesInRange(t4, t5);
+ assertEquals(new Long(1L), result.get(eventType));
+ long count = sumOfEvents(result);
+ assertEquals(1, count);
+
+ result = backend.getEventTypesInRange(t1, t5);
+ assertEquals(new Long(2L), result.get(eventType));
+ count = sumOfEvents(result);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} when there are
+ * events matching exactly both the start and end times of the range (both
+ * should be included).
+ */
+ @Test
+ public void testGetEventTypesInRangeEventAtBoth() {
+ Map<String, Long> result = backend.getEventTypesInRange(t2, t5);
+ assertEquals(new Long(2L), result.get(eventType));
+ long count = sumOfEvents(result);
+ assertEquals(2, count);
+ }
+
+ /**
+ * Test for {@link ITmfStatistics#getEventTypesInRange} when there are no
+ * events in a given range.
+ */
+ @Test
+ public void testGetEventTypesInRangeNoEvents() {
+ Map<String, Long> result = backend.getEventTypesInRange(t3, t4);
+ long count = sumOfEvents(result);
+ assertEquals(0, count);
+ }
+
+ // ------------------------------------------------------------------------
+ // Convenience methods
+ // ------------------------------------------------------------------------
+
+ private static long sumOfEvents(Map<String, Long> map) {
+ long count = 0;
+ for (long val : map.values()) {
+ count += val;
+ }
+ return count;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TmfTraceManagerTest.class
+})
+public class AllTests {}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ * Patrick Tasse - Support selection range
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assume.assumeTrue;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Test suite for the {@link TmfTraceManager}.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class TmfTraceManagerTest {
+
+ private static final int SCALE = ITmfTimestamp.NANOSECOND_SCALE;
+
+ private static ITmfTrace trace1;
+ private static final long t1start = 1331668247314038062L;
+ private static final long t1end = 1331668259054285979L;
+
+ private static ITmfTrace trace2;
+ private static final long t2start = 1332170682440133097L;
+ private static final long t2end = 1332170692664579801L;
+
+ private static final long ONE_SECOND = 1000000000L;
+
+ private TmfTraceManager tm;
+
+
+ /**
+ * Test class initialization
+ */
+ @BeforeClass
+ public static void setUpClass() {
+ assumeTrue(CtfTmfTestTrace.TRACE2.exists());
+ assumeTrue(CtfTmfTestTrace.KERNEL.exists());
+ trace1 = CtfTmfTestTrace.TRACE2.getTrace();
+ trace2 = CtfTmfTestTrace.KERNEL.getTrace();
+
+ trace1.indexTrace(true);
+ trace2.indexTrace(true);
+
+ // Deregister traces from signal manager so that they don't
+ // interfere with the TmfTraceManager tests
+ TmfSignalManager.deregister(trace1);
+ TmfSignalManager.deregister(trace2);
+ }
+
+ /**
+ * Test initialization
+ */
+ @Before
+ public void setUp() {
+ tm = TmfTraceManager.getInstance();
+ }
+
+ /**
+ * Test clean-up
+ */
+ @After
+ public void tearDown() {
+ while (tm.getActiveTrace() != null) {
+ closeTrace(tm.getActiveTrace());
+ }
+ }
+
+ /**
+ * Test class clean-up
+ */
+ @AfterClass
+ public static void tearDownClass() {
+ CtfTmfTestTrace.TRACE2.dispose();
+ CtfTmfTestTrace.KERNEL.dispose();
+ }
+
+ // ------------------------------------------------------------------------
+ // Dummy actions (fake signals)
+ // ------------------------------------------------------------------------
+
+ private void openTrace(ITmfTrace trace) {
+ if (trace == null) {
+ throw new IllegalArgumentException();
+ }
+ TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null));
+ selectTrace(trace);
+ }
+
+ private void closeTrace(ITmfTrace trace) {
+ if (trace == null) {
+ throw new IllegalArgumentException();
+ }
+ TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace));
+ /*
+ * In TMF, the next tab would now be selected (if there are some), which
+ * would select another trace automatically.
+ */
+ if (tm.getOpenedTraces().size() > 0) {
+ selectTrace(tm.getOpenedTraces().toArray(new ITmfTrace[0])[0]);
+ }
+ }
+
+ private void selectTrace(ITmfTrace trace) {
+ TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, trace));
+ }
+
+ private void selectTimestamp(@NonNull ITmfTimestamp ts) {
+ TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, ts));
+ }
+
+ private void selectWindowRange(TmfTimeRange tr) {
+ TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, tr));
+ }
+
+ // ------------------------------------------------------------------------
+ // General tests
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test that the manager is correctly initialized
+ */
+ @Test
+ public void testInitialize() {
+ TmfTraceManager mgr = TmfTraceManager.getInstance();
+ assertNotNull(mgr);
+ assertSame(tm, mgr);
+ }
+
+ /**
+ * Test the contents of a trace set with one trace.
+ */
+ @Test
+ public void testTraceSet() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace2);
+
+ Collection<ITmfTrace> expected = Collections.singleton(trace2);
+ Collection<ITmfTrace> actual = tm.getActiveTraceSet();
+
+ assertEquals(1, actual.size());
+ assertEquals(expected, actual);
+ }
+
+ /**
+ * Test the contents of a trace set with an experiment.
+ */
+ @Test
+ public void testTraceSetExperiment() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(trace1);
+ openTrace(exp);
+
+ Collection<ITmfTrace> expected = ImmutableSet.of(trace1, trace2);
+ Collection<ITmfTrace> actual = tm.getActiveTraceSet();
+
+ assertEquals(2, actual.size());
+ assertEquals(expected, actual);
+ }
+
+ /**
+ * Test the contents of the complete trace set.
+ */
+ @Test
+ public void testTraceSetWithExperiment() {
+ /* Test with a trace */
+ Collection<ITmfTrace> expected = Collections.singleton(trace1);
+ Collection<ITmfTrace> actual = TmfTraceManager.getTraceSetWithExperiment(trace1);
+ assertEquals(1, actual.size());
+ assertEquals(expected, actual);
+
+ /* Test with an experiment */
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ expected = ImmutableSet.of(trace1, trace2, exp);
+ actual = TmfTraceManager.getTraceSetWithExperiment(exp);
+ assertEquals(3, actual.size());
+ assertEquals(expected, actual);
+ }
+
+ /**
+ * Test the {@link TmfTraceManager#getSupplementaryFileDir} method.
+ */
+ @Test
+ public void testSupplementaryFileDir() {
+ String name1 = trace1.getName();
+ String name2 = trace2.getName();
+ String basePath = TmfTraceManager.getTemporaryDirPath() + File.separator;
+
+ String expected1 = basePath + name1 + File.separator;
+ String expected2 = basePath + name2 + File.separator;
+
+ assertEquals(expected1, TmfTraceManager.getSupplementaryFileDir(trace1));
+ assertEquals(expected2, TmfTraceManager.getSupplementaryFileDir(trace2));
+ }
+
+ // ------------------------------------------------------------------------
+ // Test a single trace
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test the initial range of a single trace.
+ */
+ @Test
+ public void testTraceInitialRange() {
+ openTrace(trace2);
+ final TmfTimeRange expectedRange = new TmfTimeRange(
+ trace2.getStartTime(),
+ calculateOffset(trace2.getStartTime(), trace2.getInitialRangeOffset()));
+ TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(expectedRange, actualRange);
+ }
+
+ /**
+ * Try selecting a timestamp contained inside the trace's range. The trace's
+ * current time should get updated correctly.
+ */
+ @Test
+ public void testNewTimestamp() {
+ openTrace(trace2);
+ ITmfTimestamp ts = new TmfTimestamp(t2start + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(ts, selection.getStartTime());
+ assertEquals(ts, selection.getEndTime());
+ }
+
+ /**
+ * Try selecting a timestamp happening before the trace's start. The change
+ * should be ignored.
+ */
+ @Test
+ public void testTimestampBefore() {
+ openTrace(trace2);
+ TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
+ ITmfTimestamp ts = new TmfTimestamp(t2start - ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(beforeTr, selection);
+ }
+
+ /**
+ * Try selecting a timestamp happening after the trace's end. The change
+ * should be ignored.
+ */
+ @Test
+ public void testTimestampAfter() {
+ openTrace(trace2);
+ TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
+ ITmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(beforeTr, selection);
+ }
+
+ /**
+ * Test selecting a normal sub-range of a single trace.
+ */
+ @Test
+ public void testTraceNewTimeRange() {
+ openTrace(trace2);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t2start + ONE_SECOND, SCALE),
+ new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(range, curRange);
+ }
+
+ /**
+ * Test selecting a range whose start time is before the trace's start time.
+ * The selected range should get clamped to the trace's range.
+ */
+ @Test
+ public void testTraceTimeRangeClampingStart() {
+ openTrace(trace2);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
+ new TmfTimestamp(t2end - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(t2start, curRange.getStartTime().getValue());
+ assertEquals(range.getEndTime(), curRange.getEndTime());
+ }
+
+ /**
+ * Test selecting a range whose end time is after the trace's end time.
+ * The selected range should get clamped to the trace's range.
+ */
+ @Test
+ public void testTraceTimeRangeClampingEnd() {
+ openTrace(trace2);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t2start + ONE_SECOND, SCALE),
+ new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+ selectWindowRange(range);
+
+ TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(range.getStartTime(), curRange.getStartTime());
+ assertEquals(t2end, curRange.getEndTime().getValue());
+ }
+
+ /**
+ * Test selecting a range whose both start and end times are outside of the
+ * trace's range. The selected range should get clamped to the trace's
+ * range.
+ */
+ @Test
+ public void testTraceTimeRangeClampingBoth() {
+ openTrace(trace2);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
+ new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
+ selectWindowRange(range);
+
+ TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(t2start, curRange.getStartTime().getValue());
+ assertEquals(t2end, curRange.getEndTime().getValue());
+ }
+
+ // ------------------------------------------------------------------------
+ // Test multiple, non-overlapping traces in parallel
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test, with two traces in parallel, when we select a timestamp that is
+ * part of the first trace.
+ *
+ * The first trace's timestamp should be updated, but the second trace's one
+ * should not change.
+ */
+ @Test
+ public void testTwoTracesTimestampValid() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* Timestamp of trace1 should have been updated */
+ TmfTraceContext ctx = tm.getCurrentTraceContext();
+ assertEquals(ts, ctx.getSelectionRange().getStartTime());
+ assertEquals(ts, ctx.getSelectionRange().getEndTime());
+
+ /* Timestamp of trace2 should not have changed */
+ selectTrace(trace2);
+ ctx = tm.getCurrentTraceContext();
+ assertEquals(trace2.getStartTime(), ctx.getSelectionRange().getStartTime());
+ assertEquals(trace2.getStartTime(), ctx.getSelectionRange().getEndTime());
+ }
+
+ /**
+ * Test, with two traces in parallel, when we select a timestamp that is
+ * between two traces.
+ *
+ * None of the trace's timestamps should be updated (we are not in an
+ * experiment!)
+ */
+ @Test
+ public void testTwoTracesTimestampInBetween() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* Timestamp of trace1 should not have changed */
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(trace1.getStartTime(), selection.getStartTime());
+ assertEquals(trace1.getStartTime(), selection.getEndTime());
+
+ /* Timestamp of trace2 should not have changed */
+ selectTrace(trace2);
+ selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(trace2.getStartTime(), selection.getStartTime());
+ assertEquals(trace2.getStartTime(), selection.getEndTime());
+ }
+
+ /**
+ * Test, with two traces in parallel, when we select a timestamp that is
+ * completely out of the trace's range.
+ *
+ * None of the trace's timestamps should be updated.
+ */
+ @Test
+ public void testTwoTracesTimestampInvalid() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* Timestamp of trace1 should not have changed */
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(trace1.getStartTime(), selection.getStartTime());
+ assertEquals(trace1.getStartTime(), selection.getEndTime());
+
+ /* Timestamp of trace2 should not have changed */
+ selectTrace(trace2);
+ selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(trace2.getStartTime(), selection.getStartTime());
+ assertEquals(trace2.getStartTime(), selection.getEndTime());
+ }
+
+ /**
+ * Test, with two traces opened in parallel (not in an experiment), if we
+ * select a time range valid in one of them. That trace's time range should
+ * be updated, but not the other one.
+ */
+ @Test
+ public void testTwoTracesTimeRangeAllInOne() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ /* Range of trace1 should be equal to the requested one */
+ assertEquals(range, tm.getCurrentTraceContext().getWindowRange());
+
+ /* The range of trace 2 should not have changed */
+ selectTrace(trace2);
+ assertEquals(getInitialRange(trace2), tm.getCurrentTraceContext().getWindowRange());
+ }
+
+ /**
+ * Test, with two traces in parallel, when we select a time range that is
+ * only partially valid for one of the traces.
+ *
+ * The first trace's time range should be clamped to a valid range, and the
+ * second one's should not change.
+ */
+ @Test
+ public void testTwoTracesTimeRangePartiallyInOne() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end + ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ /* Range of trace1 should get clamped to its end time */
+ TmfTimeRange expectedRange = new TmfTimeRange(
+ new TmfTimestamp(t1start + ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end, SCALE));
+ assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
+
+ /* Range of trace2 should not have changed */
+ selectTrace(trace2);
+ assertEquals(getInitialRange(trace2), tm.getCurrentTraceContext().getWindowRange());
+ }
+
+ /**
+ * Test, with two traces in parallel, when we select a time range that is
+ * only partially valid for both traces.
+ *
+ * Each trace's time range should get clamped to respectively valid ranges.
+ */
+ @Test
+ public void testTwoTracesTimeRangeInBoth() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1end - ONE_SECOND, SCALE),
+ new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ /* Range of trace1 should be clamped to its end time */
+ TmfTimeRange expectedRange = new TmfTimeRange(
+ new TmfTimestamp(t1end - ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end, SCALE));
+ assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
+
+ /* Range of trace2 should be clamped to its start time */
+ selectTrace(trace2);
+ expectedRange = new TmfTimeRange(
+ new TmfTimestamp(t2start, SCALE),
+ new TmfTimestamp(t2start + ONE_SECOND, SCALE));
+ assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
+ }
+
+ /**
+ * Test, with two traces in parallel, when we select a time range that is
+ * not valid for any trace.
+ *
+ * Each trace's time range should not be modified.
+ */
+ @Test
+ public void testTwoTracesTimeRangeInBetween() {
+ openTrace(trace1);
+ openTrace(trace2);
+ selectTrace(trace1);
+ TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1end + ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ /* Range of trace1 should not have changed */
+ TmfTimeRange expectedRange = getInitialRange(trace1);
+ TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
+ assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
+
+ /* Range of trace2 should not have changed */
+ selectTrace(trace2);
+ expectedRange = getInitialRange(trace2);
+ curRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
+ assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
+ }
+
+ // ------------------------------------------------------------------------
+ // Test an experiment
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test in an experiment when we select a timestamp that is part of one of
+ * the experiment's traces.
+ *
+ * The experiment's current time should be correctly updated.
+ */
+ @Test
+ public void testExperimentTimestampInTrace() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+ TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* The experiment's current time should be updated. */
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(ts, selection.getStartTime());
+ assertEquals(ts, selection.getEndTime());
+ }
+
+ /**
+ * Test in an experiment when we select a timestamp that is between two
+ * traces in the experiment.
+ *
+ * The experiment's current time should still be updated, since the
+ * timestamp is valid in the experiment itself.
+ */
+ @Test
+ public void testExperimentTimestampInBetween() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+ TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* The experiment's current time should be updated. */
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(ts, selection.getStartTime());
+ assertEquals(ts, selection.getEndTime());
+ }
+
+ /**
+ * Test in an experiment when we select a timestamp that is outside of the
+ * total range of the experiment.
+ *
+ * The experiment's current time should not be updated.
+ */
+ @Test
+ public void testExperimentTimestampInvalid() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+ TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
+ selectTimestamp(ts);
+
+ /* The experiment's current time should NOT be updated. */
+ TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
+ assertEquals(trace1.getStartTime(), selection.getStartTime());
+ assertEquals(trace1.getStartTime(), selection.getEndTime());
+ }
+
+ /**
+ * Test the initial range of an experiment.
+ */
+ @Test
+ public void testExperimentInitialRange() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+ /*
+ * The initial range should be == to the initial range of the earliest
+ * trace (here trace1).
+ */
+ final TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
+
+ assertEquals(getInitialRange(trace1), actualRange);
+ assertEquals(getInitialRange(exp), actualRange);
+ }
+
+ /**
+ * Test the range clamping with the start time of the range outside of the
+ * earliest trace's range. Only that start time should get clamped.
+ */
+ @Test
+ public void testExperimentRangeClampingOne() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+
+ final TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1start - ONE_SECOND, SCALE),
+ new TmfTimestamp(t1end - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(t1start, actualRange.getStartTime().getValue());
+ assertEquals(t1end - ONE_SECOND, actualRange.getEndTime().getValue());
+ }
+
+ /**
+ * Test the range clamping when both the start and end times of the signal's
+ * range are outside of the trace's range. The range should clamp to the
+ * experiment's range.
+ */
+ @Test
+ public void testExperimentRangeClampingBoth() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+
+ final TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1start - ONE_SECOND, SCALE),
+ new TmfTimestamp(t2end + ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(t1start, actualRange.getStartTime().getValue());
+ assertEquals(t2end, actualRange.getEndTime().getValue());
+ }
+
+ /**
+ * Test selecting a range in-between two disjoint traces in an experiment.
+ * The range should still get correctly selected, even if no trace has any
+ * events in that range.
+ */
+ @Test
+ public void testExperimentRangeInBetween() {
+ TmfExperiment exp = createExperiment(trace1, trace2);
+ openTrace(exp);
+
+ final TmfTimeRange range = new TmfTimeRange(
+ new TmfTimestamp(t1end + ONE_SECOND, SCALE),
+ new TmfTimestamp(t2start - ONE_SECOND, SCALE));
+ selectWindowRange(range);
+
+ TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
+ assertEquals(range, actualRange);
+ }
+
+ // ------------------------------------------------------------------------
+ // Utility methods
+ // ------------------------------------------------------------------------
+
+ private static TmfExperiment createExperiment(ITmfTrace t1, ITmfTrace t2) {
+ ITmfTrace[] traces = new ITmfTrace[] { t1, t2 };
+ TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "test-exp", traces,
+ TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
+ exp.indexTrace(true);
+ // Deregister experiment from signal manager so that it doesn't
+ // interfere with the TmfTraceManager tests
+ TmfSignalManager.deregister(exp);
+ return exp;
+ }
+
+ private static TmfTimeRange getInitialRange(ITmfTrace trace) {
+ return new TmfTimeRange(
+ trace.getStartTime(),
+ calculateOffset(trace.getStartTime(), trace.getInitialRangeOffset()));
+ }
+
+ /**
+ * Basically a "initial + offset" operation, but for ITmfTimetamp objects.
+ */
+ private static @NonNull ITmfTimestamp calculateOffset(ITmfTimestamp initialTs, ITmfTimestamp offsetTs) {
+ long start = initialTs.normalize(0, SCALE).getValue();
+ long offset = offsetTs.normalize(0, SCALE).getValue();
+ return new TmfTimestamp(start + offset, SCALE);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Test suite
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CtfTmfTraceTest.class,
+ CtfTmfTraceValidateTest.class,
+ FunkyTraceTest.class
+})
+public class AllTests {
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ * Patrick Tasse - Fix location ratio
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.signal.TmfEndSynchSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.TmfEventTypeCollectionHelper;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class <code>CtfTmfTraceTest</code> contains tests for the class
+ * <code>{@link CtfTmfTrace}</code>.
+ *
+ * @author ematkho
+ * @version 1.0
+ */
+public class CtfTmfTraceTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+ private CtfTmfTrace fixture;
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws TmfTraceException
+ * If the test trace is not found
+ */
+ @Before
+ public void setUp() throws TmfTraceException {
+ assumeTrue(testTrace.exists());
+ fixture = new CtfTmfTrace();
+ fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
+ }
+
+ /**
+ * Perform post-test clean-up.
+ */
+ @After
+ public void tearDown() {
+ if (fixture != null) {
+ fixture.dispose();
+ }
+ }
+
+ /**
+ * Run the CtfTmfTrace() constructor test.
+ */
+ @Test
+ public void testCtfTmfTrace() {
+ try (CtfTmfTrace result = new CtfTmfTrace();) {
+ assertNotNull(result);
+ assertEquals(1000, result.getCacheSize());
+ assertEquals(0L, result.getNbEvents());
+ assertEquals(0L, result.getStreamingInterval());
+ assertNull(result.getResource());
+ assertNull(result.getType());
+ }
+ }
+
+ /**
+ * Test the parseEvent() method
+ */
+ @Test
+ public void testParseEvent() {
+ ITmfContext ctx = fixture.seekEvent(0);
+ fixture.getNext(ctx);
+ CtfTmfEvent event = fixture.parseEvent(ctx);
+ assertNotNull(event);
+ ctx.dispose();
+ }
+
+ /**
+ * Run the void broadcast(TmfSignal) method test.
+ */
+ @Test
+ public void testBroadcast() {
+ TmfSignal signal = new TmfEndSynchSignal(1);
+ fixture.broadcast(signal);
+ }
+
+ /**
+ * Run the void dispose() method test.
+ */
+ @Test
+ public void testClose() {
+ try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
+ }
+ }
+
+ /**
+ * Run the int getCacheSize() method test.
+ */
+ @Test
+ public void testGetCacheSize() {
+ try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
+ int result = emptyFixture.getCacheSize();
+ assertEquals(1000, result);
+ }
+ }
+
+ /**
+ * Run the ITmfLocation<Comparable> getCurrentLocation() method test.
+ */
+ @Test
+ public void testGetCurrentLocation() {
+ CtfLocation result = (CtfLocation) fixture.getCurrentLocation();
+ assertNull(result);
+ }
+
+ /**
+ * Test the seekEvent() method with a null location.
+ */
+ @Test
+ public void testSeekEventLoc_null() {
+ CtfLocation loc = null;
+ fixture.seekEvent(loc);
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Test the seekEvent() method with a location from a timestamp.
+ */
+ @Test
+ public void testSeekEventLoc_timetamp() {
+ CtfLocation loc = new CtfLocation(new TmfNanoTimestamp(0L));
+ fixture.seekEvent(loc);
+ assertNotNull(fixture);
+ }
+
+ /**
+ * Run the ITmfTimestamp getEndTime() method test.
+ */
+ @Test
+ public void testGetEndTime() {
+ ITmfTimestamp result = fixture.getEndTime();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the String getEnvironment method test.
+ */
+ @Test
+ public void testGetEnvValue() {
+ String key = "tracer_name";
+ String result = fixture.getTraceProperties().get(key);
+ assertEquals("\"lttng-modules\"", result);
+ }
+
+ /**
+ * Test the {@link CtfTmfTrace#getEventType()} method.
+ */
+ @Test
+ public void testGetEventType() {
+ Class<?> result = fixture.getEventType();
+ assertNotNull(result);
+ assertEquals(CtfTmfEvent.class, result);
+ }
+
+ /**
+ * Run the Class<CtfTmfEvent> getContainedEventTypes() method test.
+ */
+ @Test
+ public void testGetContainedEventTypes() {
+ Set<? extends ITmfEventType> result = fixture.getContainedEventTypes();
+ assertNotNull(result);
+ assertFalse(result.isEmpty());
+ }
+
+ /**
+ * Run the double getLocationRatio(ITmfLocation<?>) method test.
+ */
+ @Test
+ public void testGetLocationRatio() {
+ ITmfContext context = fixture.seekEvent(0);
+ long t1 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ long t2 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ long t3 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ context.dispose();
+ double ratio1 = fixture.getLocationRatio(new CtfLocation(t1, 0));
+ assertEquals(0.0, ratio1, 0.01);
+ double ratio2 = fixture.getLocationRatio(new CtfLocation(t2, 0));
+ assertEquals((double) (t2 - t1) / (t3 - t1), ratio2, 0.01);
+ double ratio3 = fixture.getLocationRatio(new CtfLocation(t3, 0));
+ assertEquals(1.0, ratio3, 0.01);
+ }
+
+ /**
+ * Run the String getName() method test.
+ */
+ @Test
+ public void testGetName() {
+ String result = fixture.getName();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the getTraceProperties() method test.
+ */
+ @Test
+ public void testGetTraceProperties() {
+ int result = fixture.getTraceProperties().size();
+ assertEquals(9, result);
+ }
+
+ /**
+ * Run the long getNbEvents() method test.
+ */
+ @Test
+ public void testGetNbEvents() {
+ long result = fixture.getNbEvents();
+ assertEquals(1L, result);
+ }
+
+ /**
+ * Run the CtfTmfEvent getNext(ITmfContext) method test.
+ */
+ @Test
+ public void testGetNext() {
+ ITmfContext context = fixture.seekEvent(0);
+ CtfTmfEvent result = fixture.getNext(context);
+ assertNotNull(result);
+ context.dispose();
+ }
+
+ /**
+ * Run the String getPath() method test.
+ */
+ @Test
+ public void testGetPath() {
+ String result = fixture.getPath();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the IResource getResource() method test.
+ */
+ @Test
+ public void testGetResource() {
+ IResource result = fixture.getResource();
+ assertNull(result);
+ }
+
+ /**
+ * Run the ITmfTimestamp getStartTime() method test.
+ */
+ @Test
+ public void testGetStartTime() {
+ ITmfTimestamp result = fixture.getStartTime();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the long getStreamingInterval() method test.
+ */
+ @Test
+ public void testGetStreamingInterval() {
+ long result = fixture.getStreamingInterval();
+ assertEquals(0L, result);
+ }
+
+ /**
+ * Run the TmfTimeRange getTimeRange() method test.
+ */
+ @Test
+ public void testGetTimeRange() {
+ TmfTimeRange result = fixture.getTimeRange();
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the CtfTmfEvent readNextEvent(ITmfContext) method test.
+ */
+ @Test
+ public void testReadNextEvent() {
+ ITmfContext context = fixture.seekEvent(0);
+ CtfTmfEvent result = fixture.getNext(context);
+ assertNotNull(result);
+ context.dispose();
+ }
+
+ /**
+ * Run the ITmfContext seekEvent(double) method test.
+ */
+ @Test
+ public void testSeekEvent_ratio() {
+ ITmfContext context = fixture.seekEvent(0);
+ long t1 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ long t2 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ long t3 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
+ fixture.getNext(context);
+ context.dispose();
+ context = fixture.seekEvent(0.0);
+ assertEquals(t1, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
+ context.dispose();
+ context = fixture.seekEvent(0.5);
+ assertEquals(t2, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
+ context.dispose();
+ context = fixture.seekEvent(1.0);
+ assertEquals(t3, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
+ context.dispose();
+ }
+
+ /**
+ * Run the ITmfContext seekEvent(long) method test.
+ */
+ @Test
+ public void testSeekEvent_rank() {
+ long rank = 1L;
+ ITmfContext result = fixture.seekEvent(rank);
+ assertNotNull(result);
+ result.dispose();
+ }
+
+ /**
+ * Run the ITmfContext seekEvent(ITmfTimestamp) method test.
+ */
+ @Test
+ public void testSeekEvent_timestamp() {
+ ITmfTimestamp timestamp = new TmfTimestamp();
+ ITmfContext result = fixture.seekEvent(timestamp);
+ assertNotNull(result);
+ result.dispose();
+ }
+
+ /**
+ * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
+ */
+ @Test
+ public void testSeekEvent_location() {
+ final CtfLocationInfo location2 = new CtfLocationInfo(1L, 0L);
+ CtfLocation ctfLocation = new CtfLocation(location2);
+ ITmfContext result = fixture.seekEvent(ctfLocation);
+ assertNotNull(result);
+ result.dispose();
+ }
+
+ /**
+ * Run the boolean validate(IProject,String) method test.
+ */
+ @Test
+ public void testValidate() {
+ IProject project = null;
+ IStatus result = fixture.validate(project, testTrace.getPath());
+ assertTrue(result.isOK());
+ }
+
+ /**
+ * Run the boolean hasEvent(final String) method test
+ */
+ @Test
+ public void testEventLookup() {
+ Set<? extends ITmfEventType> eventTypes = fixture.getContainedEventTypes();
+ Set<String> eventNames = TmfEventTypeCollectionHelper.getEventNames(eventTypes);
+ assertTrue(eventNames.contains("sched_switch"));
+ assertFalse(eventNames.contains("Sched_switch"));
+ String[] events = { "sched_switch", "sched_wakeup", "timer_init" };
+ assertTrue(eventNames.containsAll(Arrays.asList(events)));
+ Set<String> copy = new HashSet<>(eventNames);
+ copy.retainAll(Arrays.asList(events));
+ assertFalse(copy.isEmpty());
+ String[] names = { "inexistent", "sched_switch", "SomeThing" };
+ copy = new HashSet<>(eventNames);
+ copy.retainAll(Arrays.asList(names));
+ assertTrue(!copy.isEmpty());
+ assertFalse(eventNames.containsAll(Arrays.asList(names)));
+ }
+
+ /**
+ * Run the String getHostId() method test
+ */
+ @Test
+ public void testCtfHostId() {
+ String a = fixture.getHostId();
+ assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - IInitial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTraceValidationStatus;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * The class <code>CtfTmfTraceValidateTest</code> contains tests for trace
+ * validation
+ * <code>{@link CtfTmfTrace#validate(org.eclipse.core.resources.IProject, String)}</code>
+ * .
+ *
+ * @author Bernd Hufmann
+ */
+@RunWith(Parameterized.class)
+public class CtfTmfTraceValidateTest {
+
+ private static final Path BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces");
+ private static final Path CTF_SUITE_BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces", "ctf-testsuite", "tests", "1.8");
+
+ private String fTrace;
+ private int fServerity;
+ private int fConfidence;
+ private boolean fHasException;
+
+ /**
+ * Gets a list of test case parameters.
+ *
+ * @return The list of CTF traces (directories) to test
+ */
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> getTracePaths() {
+ final List<Object[]> dirs = new LinkedList<>();
+ // text-only metadata, valid CTF trace (lttle-endian)
+ addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "literal-integers")), IStatus.OK, 10, false);
+ // packet-based metadata, valid CTF trace (lttle-endian)
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("kernel")), IStatus.OK, 10, false);
+ // text-only metadata, but invalid
+ addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "enum-empty")), IStatus.WARNING, 1, true);
+ // packet-based metadata, but invalid
+ addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "lttng-modules-2.0-pre1")), IStatus.WARNING, 1, true);
+ // pass file instead of directory
+ addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("trace2.tar.bz2")), IStatus.ERROR, 1, false);
+
+ return dirs;
+ }
+
+ private static void addDirsFrom(List<Object[]> dirs, Path path, int severity, int confidence, boolean hasException) {
+ if (!Files.exists(path)) {
+ /* Some planned directories may not exist yet in the test suite */
+ return;
+ }
+
+ Object array[] = new Object[] { path.toString(), severity, confidence, hasException };
+ dirs.add(array);
+ }
+
+ /**
+ * @param trace
+ * a trace path
+ * @param severity
+ * severity of validation status expected
+ * @param confidence
+ * confidence of validation status expected
+ * @param hasException
+ * flag whether validation status should contain exception
+ */
+ public CtfTmfTraceValidateTest(String trace, int severity, int confidence, boolean hasException) {
+ fTrace = trace;
+ fServerity = severity;
+ fConfidence = confidence;
+ fHasException = hasException;
+ }
+
+ /**
+ * Main test cases
+ */
+ @Test
+ public void testValidate() {
+ try (CtfTmfTrace trace = new CtfTmfTrace();) {
+ IStatus status = trace.validate(null, fTrace);
+ assertEquals(toString(), fServerity, status.getSeverity());
+
+ if (fHasException) {
+ assertNotNull(toString(), status.getException());
+ }
+ switch (status.getSeverity()) {
+ case IStatus.OK: {
+ assertTrue(status instanceof CtfTraceValidationStatus);
+ CtfTraceValidationStatus ctfStatus = (CtfTraceValidationStatus) status;
+ assertEquals(toString(), fConfidence, ctfStatus.getConfidence());
+ assertNotNull(ctfStatus.getEnvironment());
+ break;
+ }
+ case IStatus.WARNING: {
+ assertTrue(status instanceof TraceValidationStatus);
+ TraceValidationStatus ctfStatus = (TraceValidationStatus) status;
+ assertEquals(fConfidence, ctfStatus.getConfidence());
+ break;
+ }
+ case IStatus.ERROR: {
+ // nothing else to check here
+ break;
+ }
+ default:
+ // no other severity should be returned
+ fail();
+ break;
+ }
+ assertEquals(fServerity, status.getSeverity());
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.ctf.core.CtfEnumPair;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
+
+/**
+ * More advanced CTF tests using "funky_trace", a trace generated with the
+ * Babeltrace CTF writer API, which has lots of fun things like different
+ * integer/float sizes and non-standard struct alignments.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class FunkyTraceTest {
+
+ /** Time-out tests after 20 seconds */
+ @Rule
+ public TestRule globalTimeout= new Timeout(20000);
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.FUNKY_TRACE;
+ private static final double DELTA = 0.0000001;
+
+ private CtfTmfTrace fTrace;
+
+ // ------------------------------------------------------------------------
+ // Setup
+ // ------------------------------------------------------------------------
+
+ /**
+ * Test setup
+ */
+ @Before
+ public void setup() {
+ assumeTrue(testTrace.exists());
+ fTrace = testTrace.getTrace();
+ fTrace.indexTrace(true);
+ }
+
+ /**
+ * Clean-up
+ */
+ @After
+ public void tearDown() {
+ if (fTrace != null) {
+ fTrace.dispose();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Test methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Verify the contents of the first event
+ */
+ @Test
+ public void testFirstEvent() {
+ CtfTmfEvent event = getEvent(0);
+ assertEquals("Simple Event", event.getType().getName());
+ assertEquals(1234567, event.getTimestamp().getValue());
+ assertEquals(42, ((Long) event.getContent().getField("integer_field").getValue()).intValue());
+ assertEquals(3.1415, ((Double) event.getContent().getField("float_field").getValue()).doubleValue(), DELTA);
+ }
+
+ /**
+ * Verify the contents of the second event (the first "spammy event")
+ */
+ @Test
+ public void testSecondEvent() {
+ CtfTmfEvent event = getEvent(1);
+ assertEquals("Spammy_Event", event.getType().getName());
+ assertEquals(1234568, event.getTimestamp().getValue());
+ assertEquals(0, ((Long) event.getContent().getField("field_1").getValue()).intValue());
+ assertEquals("This is a test", event.getContent().getField("a_string").getValue());
+ }
+
+ /**
+ * Verify the contents of the last "spammy event"
+ */
+ @Test
+ public void testSecondToLastEvent() {
+ CtfTmfEvent event = getEvent(100000);
+ assertEquals("Spammy_Event", event.getType().getName());
+ assertEquals(1334567, event.getTimestamp().getValue());
+ assertEquals(99999, ((Long) event.getContent().getField("field_1").getValue()).intValue());
+ assertEquals("This is a test", event.getContent().getField("a_string").getValue());
+ }
+
+ /**
+ * Verify the contents of the last, complex event
+ */
+ @Test
+ public void testLastEvent() {
+ /*
+ * Last event as seen in Babeltrace:
+ * [19:00:00.001334568] (+0.000000001) Complex Test Event: { }, {
+ * uint_35 = 0xDDF00D,
+ * int_16 = -12345,
+ * complex_structure = {
+ * variant_selector = ( INT16_TYPE : container = 1 ),
+ * a_string = "Test string",
+ * variant_value = { INT16_TYPE = -200 },
+ * inner_structure = {
+ * seq_len = 0xA,
+ * a_sequence = [ [0] = 4, [1] = 3, [2] = 2, [3] = 1, [4] = 0, [5] = -1, [6] = -2, [7] = -3, [8] = -4, [9] = -5 ]
+ * }
+ * }
+ * }
+ */
+
+ CtfTmfEvent event = getEvent(100001);
+ assertEquals("Complex Test Event", event.getType().getName());
+ assertEquals(1334568, event.getTimestamp().getValue());
+ assertEquals(0xddf00d, ((Long) event.getContent().getField("uint_35").getValue()).intValue());
+ assertEquals(-12345, ((Long) event.getContent().getField("int_16").getValue()).intValue());
+
+ ITmfEventField[] complexStruct =
+ (ITmfEventField[]) event.getContent().getField("complex_structure").getValue();
+
+ assertEquals("variant_selector", complexStruct[0].getName());
+ CtfEnumPair variant1 = (CtfEnumPair) complexStruct[0].getValue();
+ assertEquals("INT16_TYPE", variant1.getStringValue());
+ assertEquals(Long.valueOf(1), variant1.getLongValue());
+
+ assertEquals("a_string", complexStruct[1].getName());
+ assertEquals("Test string", complexStruct[1].getValue());
+
+ assertEquals("variant_value", complexStruct[2].getName());
+ ITmfEventField variantField = (ITmfEventField) complexStruct[2].getValue();
+ assertEquals("INT16_TYPE", variantField.getName());
+ assertEquals(Long.valueOf(-200), variantField.getValue());
+
+ ITmfEventField[] innerStruct = (ITmfEventField[]) complexStruct[3].getValue();
+
+ assertEquals("seq_len", innerStruct[0].getName());
+ assertEquals(Long.valueOf(10), innerStruct[0].getValue());
+
+ assertEquals("a_sequence", innerStruct[1].getName());
+ long[] seqValues = (long[]) innerStruct[1].getValue();
+ long[] expectedValues = { 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 };
+ assertArrayEquals(expectedValues, seqValues);
+ }
+
+ // ------------------------------------------------------------------------
+ // Private stuff
+ // ------------------------------------------------------------------------
+
+ private synchronized CtfTmfEvent getEvent(long index) {
+ TestEventRequest req = new TestEventRequest(index);
+ fTrace.sendRequest(req);
+ try {
+ req.waitForCompletion();
+ } catch (InterruptedException e) {
+ return null;
+ }
+ return req.getEvent();
+ }
+
+ private class TestEventRequest extends TmfEventRequest {
+
+ private CtfTmfEvent fRetEvent = null;
+
+ public TestEventRequest(long index) {
+ super(CtfTmfEvent.class,
+ TmfTimeRange.ETERNITY,
+ index,
+ 1,
+ ExecutionType.FOREGROUND);
+ }
+
+ @Override
+ public void handleData(ITmfEvent event) {
+ fRetEvent = (CtfTmfEvent) event;
+ }
+
+ public CtfTmfEvent getEvent() {
+ return fRetEvent;
+ }
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 École Polytechnique de Montréal
+ *
+ * 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:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.tests.stubs;
+
+import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Dummy test ctf trace
+ */
+public class CtfTmfTraceStub extends CtfTmfTrace {
+
+ /**
+ * Simulate trace opening, to be called by tests who need an actively opened
+ * trace
+ */
+ public void openTrace() {
+ TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, this, null));
+ selectTrace();
+ }
+
+ /**
+ * Simulate selecting the trace
+ */
+ public void selectTrace() {
+ TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, this));
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.tmf.ctf.core</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=1
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=1
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.core;singleton:=true
+Bundle-Activator: org.eclipse.tracecompass.internal.tmf.ctf.core.Activator
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.tracecompass.common.core,
+ org.eclipse.tracecompass.ctf.core,
+ org.eclipse.tracecompass.tmf.core
+Export-Package: org.eclipse.tracecompass.internal.tmf.ctf.core;x-internal:=true,
+ org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;x-friends:="org.eclipse.tracecompass.tmf.ctf.core.tests",
+ org.eclipse.tracecompass.tmf.ctf.core,
+ org.eclipse.tracecompass.tmf.ctf.core.context,
+ org.eclipse.tracecompass.tmf.ctf.core.event,
+ org.eclipse.tracecompass.tmf.ctf.core.event.aspect,
+ org.eclipse.tracecompass.tmf.ctf.core.event.lookup,
+ org.eclipse.tracecompass.tmf.ctf.core.trace
+Import-Package: com.google.common.collect,
+ org.eclipse.emf.common.util
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = CTF support for TMF Core Plug-in
+
+# CTF trace type
+tracetype.category.ctf = Common Trace Format
+tracetype.type.ctf = Generic CTF Trace
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.linuxtools.tmf.core.tracetype">
+ <category
+ id="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+ name="%tracetype.category.ctf">
+ </category>
+ <type
+ category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
+ event_type="org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent"
+ id="org.eclipse.linuxtools.tmf.ui.type.ctf"
+ isDirectory="true"
+ name="%tracetype.type.ctf"
+ trace_type="org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace">
+ </type>
+ </extension>
+
+</plugin>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.tmf.ctf.core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <name>CTF support for TMF Core Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <groupId>org.eclipse.tracecompass</groupId>
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson
+ *
+ * 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:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.ctf.core;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * <b><u>Activator</u></b>
+ * <p>
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.tracecompass.tmf.ctf.core"; //$NON-NLS-1$
+
+ /**
+ * The shared instance
+ */
+ private static Activator plugin;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operators
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Logs a message with severity INFO in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ */
+ public void logInfo(String message) {
+ getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity INFO in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ * @param exception A exception to log
+ */
+ public void logInfo(String message, Throwable exception) {
+ getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
+ }
+
+ /**
+ * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ */
+ public void logWarning(String message) {
+ getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ * @param exception A exception to log
+ */
+ public void logWarning(String message, Throwable exception) {
+ getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
+ }
+
+ /**
+ * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ */
+ public void logError(String message) {
+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
+ *
+ * @param message A message to log
+ * @param exception A exception to log
+ */
+ public void logError(String message, Throwable exception) {
+ getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson, École Polytechnique de Montréal
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Florian Wininger - Performance improvements
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
+
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * The CTF trace reader iterator.
+ *
+ * It doesn't reserve a file handle, so many iterators can be used without
+ * worries of I/O errors or resource exhaustion.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfIterator extends CTFTraceReader
+ implements ITmfContext, Comparable<CtfIterator> {
+
+ /** An invalid location */
+ public static final CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
+
+ private final CtfTmfTrace fTrace;
+
+ private CtfLocation fCurLocation;
+ private long fCurRank;
+
+ private CtfLocation fPreviousLocation;
+ private CtfTmfEvent fPreviousEvent;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new CTF trace iterator, which initially points at the first
+ * event in the trace.
+ *
+ * @param ctfTrace
+ * The {@link CTFTrace} linked to the trace. It should be
+ * provided by the corresponding 'ctfTmfTrace'.
+ *
+ * @param ctfTmfTrace
+ * The {@link CtfTmfTrace} to iterate over
+ * @throws CTFException
+ * If the iterator couldn't not be instantiated, probably due to
+ * a read error.
+ */
+ public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace) throws CTFException {
+ super(ctfTrace);
+ fTrace = ctfTmfTrace;
+ if (hasMoreEvents()) {
+ fCurLocation = new CtfLocation(ctfTmfTrace.getStartTime());
+ fCurRank = 0;
+ } else {
+ setUnknownLocation();
+ }
+ }
+
+ /**
+ * Create a new CTF trace iterator, which will initially point to the given
+ * location/rank.
+ *
+ * @param ctfTrace
+ * The {@link CTFTrace} linked to the trace. It should be
+ * provided by the corresponding 'ctfTmfTrace'.
+ * @param ctfTmfTrace
+ * The {@link CtfTmfTrace} to iterate over
+ * @param ctfLocationData
+ * The initial timestamp the iterator will be pointing to
+ * @param rank
+ * The initial rank
+ * @throws CTFException
+ * If the iterator couldn't not be instantiated, probably due to
+ * a read error.
+ */
+ public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace, CtfLocationInfo ctfLocationData, long rank)
+ throws CTFException {
+ super(ctfTrace);
+
+ this.fTrace = ctfTmfTrace;
+ if (this.hasMoreEvents()) {
+ this.fCurLocation = new CtfLocation(ctfLocationData);
+ if (this.getCurrentEvent().getTimestamp().getValue() != ctfLocationData.getTimestamp()) {
+ this.seek(ctfLocationData);
+ this.fCurRank = rank;
+ }
+ } else {
+ setUnknownLocation();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ close();
+ }
+
+ private void setUnknownLocation() {
+ fCurLocation = NULL_LOCATION;
+ fCurRank = UNKNOWN_RANK;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return this iterator's trace.
+ *
+ * @return CtfTmfTrace The iterator's trace
+ */
+ public CtfTmfTrace getCtfTmfTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Return the current event pointed to by the iterator.
+ *
+ * @return CtfTmfEvent The current event
+ */
+ public synchronized CtfTmfEvent getCurrentEvent() {
+ final CTFStreamInputReader top = super.getPrio().peek();
+ if (top != null) {
+ if (!fCurLocation.equals(fPreviousLocation)) {
+ fPreviousLocation = fCurLocation;
+ fPreviousEvent = CtfTmfEventFactory.createEvent(top.getCurrentEvent(),
+ top.getFilename(), fTrace);
+ }
+ return fPreviousEvent;
+ }
+ return null;
+ }
+
+ /**
+ * Return the current timestamp location pointed to by the iterator. This is
+ * the timestamp for use in CtfLocation, not the event timestamp.
+ *
+ * @return long The current timestamp location
+ */
+ public synchronized long getCurrentTimestamp() {
+ final CTFStreamInputReader top = super.getPrio().peek();
+ if (top != null) {
+ long ts = top.getCurrentEvent().getTimestamp();
+ return fTrace.timestampCyclesToNanos(ts);
+ }
+ return 0;
+ }
+
+ /**
+ * Seek this iterator to a given location.
+ *
+ * @param ctfLocationData
+ * The LocationData representing the position to seek to
+ * @return boolean True if the seek was successful, false if there was an
+ * error seeking.
+ */
+ public synchronized boolean seek(CtfLocationInfo ctfLocationData) {
+ boolean ret = false;
+
+ /* Avoid the cost of seeking at the current location. */
+ if (fCurLocation.getLocationInfo().equals(ctfLocationData)) {
+ return super.hasMoreEvents();
+ }
+ /* Update location to make sure the current event is updated */
+ fCurLocation = new CtfLocation(ctfLocationData);
+
+ /* Adjust the timestamp depending on the trace's offset */
+ long currTimestamp = ctfLocationData.getTimestamp();
+ final long offsetTimestamp = this.getCtfTmfTrace().timestampNanoToCycles(currTimestamp);
+ try {
+ if (offsetTimestamp < 0) {
+ ret = super.seek(0L);
+ } else {
+ ret = super.seek(offsetTimestamp);
+ }
+ } catch (CTFException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ return false;
+ }
+ /*
+ * Check if there is already one or more events for that timestamp, and
+ * assign the location index correctly
+ */
+ long index = 0;
+ final CtfTmfEvent currentEvent = this.getCurrentEvent();
+ if (currentEvent != null) {
+ currTimestamp = currentEvent.getTimestamp().getValue();
+
+ for (long i = 0; i < ctfLocationData.getIndex(); i++) {
+ if (currTimestamp == currentEvent.getTimestamp().getValue()) {
+ index++;
+ } else {
+ index = 0;
+ }
+ this.advance();
+ }
+ } else {
+ ret = false;
+ }
+ /* Seek the current location accordingly */
+ if (ret) {
+ fCurLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index));
+ } else {
+ fCurLocation = NULL_LOCATION;
+ }
+
+ return ret;
+ }
+
+ // ------------------------------------------------------------------------
+ // CTFTraceReader
+ // ------------------------------------------------------------------------
+
+ @Override
+ public boolean seek(long timestamp) {
+ return seek(new CtfLocationInfo(timestamp, 0));
+ }
+
+ @Override
+ public synchronized boolean advance() {
+ boolean ret = false;
+ try {
+ ret = super.advance();
+ } catch (CTFException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ }
+
+ if (ret) {
+ long timestamp = fCurLocation.getLocationInfo().getTimestamp();
+ final long timestampValue = getCurrentTimestamp();
+ if (timestamp == timestampValue) {
+ long index = fCurLocation.getLocationInfo().getIndex();
+ fCurLocation = new CtfLocation(timestampValue, index + 1);
+ } else {
+ fCurLocation = new CtfLocation(timestampValue, 0L);
+ }
+ } else {
+ fCurLocation = NULL_LOCATION;
+ }
+ return ret;
+ }
+
+ // ------------------------------------------------------------------------
+ // ITmfContext
+ // ------------------------------------------------------------------------
+
+ @Override
+ public long getRank() {
+ return fCurRank;
+ }
+
+ @Override
+ public void setRank(long rank) {
+ fCurRank = rank;
+ }
+
+ @Override
+ public void increaseRank() {
+ /* Only increase the rank if it's valid */
+ if (hasValidRank()) {
+ fCurRank++;
+ }
+ }
+
+ @Override
+ public boolean hasValidRank() {
+ return (getRank() >= 0);
+ }
+
+ @Override
+ public void setLocation(ITmfLocation location) {
+ // FIXME alex: isn't there a cleaner way than a cast here?
+ fCurLocation = (CtfLocation) location;
+ seek(((CtfLocation) location).getLocationInfo());
+ }
+
+ @Override
+ public CtfLocation getLocation() {
+ return fCurLocation;
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int compareTo(final CtfIterator o) {
+ if (getRank() < o.getRank()) {
+ return -1;
+ } else if (getRank() > o.getRank()) {
+ return 1;
+ }
+ return 0;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = (prime * result)
+ + ((fTrace == null) ? 0 : fTrace.hashCode());
+ result = (prime * result)
+ + ((fCurLocation == null) ? 0 : fCurLocation.hashCode());
+ result = (prime * result) + (int) (fCurRank ^ (fCurRank >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof CtfIterator)) {
+ return false;
+ }
+ CtfIterator other = (CtfIterator) obj;
+ if (!equalsNullable(fTrace, other.fTrace)) {
+ return false;
+ }
+ if (!equalsNullable(fCurLocation, other.fCurLocation)) {
+ return false;
+ }
+ if (fCurRank != other.fCurRank) {
+ return false;
+ }
+ return true;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Renamed/extracted from CtfTraceManager
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * A CTF trace iterator manager.
+ *
+ * Each instance of {@link CtfTmfTrace} should possess one of these, which will
+ * manage the iterators that are opened to read that trace. This will allow
+ * controlling the number of opened file handles per trace.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfIteratorManager {
+ /*
+ * Cache size. Under 1023 on linux32 systems. Number of file handles
+ * created.
+ */
+ private static final int MAX_SIZE = 100;
+
+ /** The map of the cache */
+ private final Map<CtfTmfContext, CtfIterator> fMap;
+
+ /** An array pointing to the same cache. this allows fast "random" accesses */
+ private final List<CtfTmfContext> fRandomAccess;
+
+ /** Lock for when we access the two previous data structures */
+ private final Lock fAccessLock = new ReentrantLock();
+
+ /** The parent trace */
+ private final CtfTmfTrace fTrace;
+
+ /** Random number generator */
+ private final Random fRnd;
+
+ /**
+ * Constructor
+ *
+ * @param trace
+ * The trace whose iterators this manager will manage
+ */
+ public CtfIteratorManager(CtfTmfTrace trace) {
+ fMap = new HashMap<>();
+ fRandomAccess = new ArrayList<>();
+ fRnd = new Random(System.nanoTime());
+ fTrace = trace;
+ }
+
+ /**
+ * This needs explaining: the iterator table is effectively a cache.
+ * Originally the contexts had a 1 to 1 structure with the file handles of a
+ * trace. This failed since there is a limit to how many file handles we can
+ * have opened simultaneously. Then a round-robin scheme was implemented,
+ * this lead up to a two competing contexts syncing up and using the same
+ * file handler, causing horrible slowdowns. Now a random replacement
+ * algorithm is selected. This is the same as used by arm processors, and it
+ * works quite well when many cores so this looks promising for very
+ * multi-threaded systems.
+ *
+ * @param context
+ * the context to look up
+ * @return the iterator referring to the context
+ */
+ public CtfIterator getIterator(final CtfTmfContext context) {
+ /*
+ * if the element is in the map, we don't need to do anything else.
+ */
+ CtfIterator iter = fMap.get(context);
+ if (iter == null) {
+
+ fAccessLock.lock();
+ try {
+ /*
+ * Assign an iterator to a context.
+ */
+ if (fRandomAccess.size() < MAX_SIZE) {
+ /*
+ * if we're not full yet, just add an element.
+ */
+ iter = (CtfIterator) fTrace.createIterator();
+ addElement(context, iter);
+
+ } else {
+ /*
+ * if we're full, randomly replace an element
+ */
+ iter = replaceRandomElement(context);
+ }
+ if (context.getLocation() != null) {
+ final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo();
+ iter.seek(location);
+ }
+ } finally {
+ fAccessLock.unlock();
+ }
+ }
+ return iter;
+ }
+
+ /**
+ * Remove an iterator from this manager
+ *
+ * @param context
+ * The context of the iterator to remove
+ */
+ public void removeIterator(CtfTmfContext context) {
+ fAccessLock.lock();
+ try {
+ /* The try below is only to auto-call CtfIterator.close() */
+ try (CtfIterator removed = fMap.remove(context)) {
+ // try with resource
+ }
+ fRandomAccess.remove(context);
+
+ } finally {
+ fAccessLock.unlock();
+ }
+ }
+
+ /**
+ * Add a pair of context and element to the hashmap and the arraylist.
+ *
+ * @param context
+ * the context
+ * @param elem
+ * the iterator
+ */
+ private void addElement(final CtfTmfContext context,
+ final CtfIterator elem) {
+ fAccessLock.lock();
+ try {
+ fMap.put(context, elem);
+ fRandomAccess.add(context);
+
+ } finally {
+ fAccessLock.unlock();
+ }
+ }
+
+ /**
+ * Replace a random element
+ *
+ * @param context
+ * the context to swap in
+ * @return the iterator of the removed elements.
+ */
+ private CtfIterator replaceRandomElement(final CtfTmfContext context) {
+ /*
+ * This needs some explanation too: We need to select a random victim
+ * and remove it. The order of the elements is not important, so instead
+ * of just calling arraylist.remove(element) which has an O(n)
+ * complexity, we pick an random number. The element is swapped out of
+ * the array and removed and replaced in the hashmap.
+ */
+ fAccessLock.lock(); // just in case, should only be called when already locked
+ try {
+ final int size = fRandomAccess.size();
+ final int pos = fRnd.nextInt(size);
+ final CtfTmfContext victim = fRandomAccess.get(pos);
+ fRandomAccess.set(pos, context);
+ final CtfIterator elem = fMap.remove(victim);
+ fMap.put(context, elem);
+ victim.dispose();
+ return elem;
+
+ } finally {
+ fAccessLock.unlock();
+ }
+ }
+
+ /**
+ * Dispose this iterator manager, which will close all the remaining
+ * iterators.
+ */
+ public void dispose() {
+ fAccessLock.lock();
+ try {
+ for (CtfIterator iterator : fMap.values()) {
+ iterator.dispose();
+ }
+ fMap.clear();
+ fRandomAccess.clear();
+
+ } finally {
+ fAccessLock.unlock();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson, Ecole Polytechnique de Montreal 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:
+ * Ansgar Radermacher - support for model URI
+ * Patrick Tasse - context strings
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core;
+
+import org.eclipse.core.runtime.QualifiedName;
+
+/**
+ * Set of constants used by the CTF adaptor classes
+ *
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+@SuppressWarnings("nls")
+public interface CtfConstants {
+
+ /*
+ * Context strings
+ */
+
+ /** Prefix for context information stored as CtfTmfEventfield */
+ String CONTEXT_FIELD_PREFIX = "context.";
+
+ /** Key for ip field */
+ String IP_KEY = "_ip";
+
+ /*
+ * Custom attributes names (key within hash table)
+ */
+
+ /** Model URI for traces related to EMF models */
+ String MODEL_URI_KEY = "model.emf.uri";
+
+ /**
+ * The host persistent property for the live session.
+ */
+ QualifiedName LIVE_HOST = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.host"); //$NON-NLS-1$//$NON-NLS-2$
+
+ /**
+ * The port persistent property for the live session.
+ */
+ QualifiedName LIVE_PORT = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.port"); //$NON-NLS-1$//$NON-NLS-2$
+
+ /**
+ * The live session name persistent property.
+ */
+ QualifiedName LIVE_SESSION_NAME = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.session.name"); //$NON-NLS-1$//$NON-NLS-2$;
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core;
+
+import org.eclipse.tracecompass.tmf.core.util.Pair;
+
+/**
+ * Pair of Enum value name and its long value.
+ *
+ * @author Bernd Hufmann
+ */
+public class CtfEnumPair extends Pair<String, Long> {
+
+ /**
+ * Constructs a CtfEnumPair
+ *
+ * @param strValue
+ * The first parameter of the pair (String)
+ * @param longValue
+ * The second parameter of the pair (Long)
+ */
+ public CtfEnumPair(String strValue, Long longValue) {
+ super(strValue, longValue);
+ }
+
+ /**
+ * Returns the String value of the Enum.
+ *
+ * @return the string value
+ */
+ public String getStringValue() {
+ return getFirst();
+ }
+
+ /**
+ * Returns the long value of the Enum.
+ *
+ * @return the Long value
+ */
+ public Long getLongValue() {
+ return getSecond();
+ }
+
+ @Override
+ public String toString() {
+ return getFirst();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Extends TmfLocation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.context;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.location.TmfLocation;
+
+/**
+ * The nugget of information that is unique to a location in a CTF trace.
+ *
+ * It can be copied and used to restore a position in a given trace.
+ *
+ * @author Matthew Khouzam
+ */
+public final class CtfLocation extends TmfLocation {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /**
+ * An invalid location
+ */
+ public static final CtfLocationInfo INVALID_LOCATION = new CtfLocationInfo(-1, -1);
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Basic constructor for CtfLocation. Uses a default index of 0.
+ *
+ * @param timestamp
+ * The timestamp of this location
+ */
+ public CtfLocation(final ITmfTimestamp timestamp) {
+ this(timestamp.getValue(), 0);
+ }
+
+ /**
+ * Constructor using timestamp object and index
+ *
+ * @param timestamp
+ * The timestamp of this location
+ * @param index
+ * The index of this location for this timestamp
+ */
+ public CtfLocation(final ITmfTimestamp timestamp, long index) {
+ this(timestamp.getValue(), index);
+ }
+
+ /**
+ * Constructor using a long value for the timestamp, and an index
+ *
+ * @param timestampValue
+ * The new timestamp
+ * @param index
+ * The new index
+ */
+ public CtfLocation(final long timestampValue, final long index) {
+ super(new CtfLocationInfo(timestampValue, index));
+ }
+
+ /**
+ * Constructor using a pre-made locationInfo object
+ *
+ * @param locationInfo
+ * The locationInfo object to use
+ */
+ public CtfLocation(CtfLocationInfo locationInfo) {
+ super(locationInfo);
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param location
+ * Other location to copy
+ */
+ public CtfLocation(final CtfLocation location) {
+ super(location);
+ }
+
+ // ------------------------------------------------------------------------
+ // TmfLocation
+ // ------------------------------------------------------------------------
+
+ /**
+ * Construct the location from the ByteBuffer.
+ *
+ * @param bufferIn
+ * the buffer to read from
+ */
+ public CtfLocation(ByteBuffer bufferIn) {
+ super(new CtfLocationInfo(bufferIn));
+ }
+
+ @Override
+ public CtfLocationInfo getLocationInfo() {
+ return (CtfLocationInfo) super.getLocationInfo();
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public String toString() {
+ if (getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
+ return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
+ }
+ return super.toString();
+ }
+
+ /**
+ * Constructs the location from the ByteBuffer. This typically happens when reading from disk.
+ */
+ @Override
+ public void serialize(ByteBuffer bufferOut) {
+ getLocationInfo().serialize(bufferOut);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.context;
+
+import java.nio.ByteBuffer;
+
+/**
+ * The data object to go in a {@link CtfLocation}.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
+
+ private final long fTimestamp;
+ private final long fIndex;
+
+ /**
+ * @param ts
+ * Timestamp
+ * @param index
+ * Index of this event (if there are N elements with the same
+ * timestamp, which one is it.)
+ */
+ public CtfLocationInfo(long ts, long index) {
+ fTimestamp = ts;
+ fIndex = index;
+ }
+
+ /**
+ * Construct the location from the ByteBuffer.
+ *
+ * @param bufferIn
+ * the buffer to read from
+ */
+ public CtfLocationInfo(ByteBuffer bufferIn) {
+ fTimestamp = bufferIn.getLong();
+ fIndex = bufferIn.getLong();
+ }
+
+ /**
+ * @return The timestamp
+ */
+ public long getTimestamp() {
+ return fTimestamp;
+ }
+
+ /**
+ * @return The index of the element
+ */
+ public long getIndex() {
+ return fIndex;
+ }
+
+ // ------------------------------------------------------------------------
+ // Object
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = (prime * result) + (int) (fIndex ^ (fIndex >>> 32));
+ result = (prime * result) + (int) (fTimestamp ^ (fTimestamp >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CtfLocationInfo)) {
+ return false;
+ }
+ CtfLocationInfo other = (CtfLocationInfo) obj;
+ if (fIndex != other.fIndex) {
+ return false;
+ }
+ if (fTimestamp != other.fTimestamp) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Element [" + fTimestamp + '/' + fIndex + ']'; //$NON-NLS-1$
+ }
+
+ // ------------------------------------------------------------------------
+ // Comparable
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int compareTo(CtfLocationInfo other) {
+ if (fTimestamp > other.getTimestamp()) {
+ return 1;
+ }
+ if (fTimestamp < other.getTimestamp()) {
+ return -1;
+ }
+ if (fIndex > other.getIndex()) {
+ return 1;
+ }
+ if (fIndex < other.getIndex()) {
+ return -1;
+ }
+ return 0;
+ }
+
+ /**
+ * Write the location to the ByteBuffer so that it can be saved to disk.
+ *
+ * @param bufferOut
+ * the buffer to write to
+ */
+ public void serialize(ByteBuffer bufferOut) {
+ bufferOut.putLong(fTimestamp);
+ bufferOut.putLong(fIndex);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Delisle - Remove the iterator in dispose()
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.context;
+
+import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
+ * a boxed Long, a long and an int.
+ *
+ * @author Matthew Khouzam
+ */
+public class CtfTmfContext implements ITmfContext {
+
+ // -------------------------------------------
+ // Fields
+ // -------------------------------------------
+
+ private CtfLocation fCurLocation;
+ private long fCurRank;
+
+ private final CtfTmfTrace fTrace;
+
+ // -------------------------------------------
+ // Constructor
+ // -------------------------------------------
+
+ /**
+ * Constructor
+ *
+ * @param ctfTmfTrace
+ * the parent trace
+ */
+ public CtfTmfContext(CtfTmfTrace ctfTmfTrace) {
+ fTrace = ctfTmfTrace;
+ fCurLocation = new CtfLocation(new CtfLocationInfo(0, 0));
+ }
+
+ // -------------------------------------------
+ // TmfContext Overrides
+ // -------------------------------------------
+
+ @Override
+ public long getRank() {
+ return fCurRank;
+ }
+
+ @Override
+ public synchronized ITmfLocation getLocation() {
+ return fCurLocation;
+ }
+
+ @Override
+ public boolean hasValidRank() {
+ return fCurRank != CtfLocation.INVALID_LOCATION.getTimestamp();
+ }
+
+ @Override
+ public synchronized void setLocation(ITmfLocation location) {
+ if (location instanceof CtfLocation) {
+ CtfIterator iterator = getIterator();
+ iterator.seek(((CtfLocation) location).getLocationInfo());
+ fCurLocation = iterator.getLocation();
+ } else {
+ fCurLocation = null;
+ }
+ }
+
+ @Override
+ public void setRank(long rank) {
+ fCurRank = rank;
+
+ }
+
+ @Override
+ public void increaseRank() {
+ if (hasValidRank()) {
+ fCurRank++;
+ }
+ }
+
+ // -------------------------------------------
+ // CtfTmfTrace Helpers
+ // -------------------------------------------
+
+ /**
+ * Gets the trace of this context.
+ *
+ * @return The trace of this context
+ */
+ public CtfTmfTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Gets the current event. Wrapper to help CtfTmfTrace
+ *
+ * @return The event or null
+ */
+ public synchronized CtfTmfEvent getCurrentEvent() {
+ return getIterator().getCurrentEvent();
+ }
+
+ /**
+ * Advances to a the next event. Wrapper to help CtfTmfTrace
+ *
+ * @return success or not
+ */
+ public synchronized boolean advance() {
+ final CtfLocationInfo curLocationData = fCurLocation.getLocationInfo();
+ CtfIterator iterator = getIterator();
+ boolean retVal = iterator.advance();
+ CtfTmfEvent currentEvent = iterator.getCurrentEvent();
+
+ if (currentEvent != null) {
+ final long timestampValue = iterator.getCurrentTimestamp();
+ if (curLocationData.getTimestamp() == timestampValue) {
+ fCurLocation = new CtfLocation(timestampValue, curLocationData.getIndex() + 1);
+ } else {
+ fCurLocation = new CtfLocation(timestampValue, 0L);
+ }
+ } else {
+ fCurLocation = new CtfLocation(CtfLocation.INVALID_LOCATION);
+ }
+
+ return retVal;
+ }
+
+ @Override
+ public void dispose() {
+ fTrace.disposeContext(this);
+ }
+
+ /**
+ * Seeks to a given timestamp. Wrapper to help CtfTmfTrace
+ *
+ * @param timestamp
+ * desired timestamp
+ * @return success or not
+ */
+ public synchronized boolean seek(final long timestamp) {
+ CtfIterator iterator = getIterator();
+ boolean ret = iterator.seek(timestamp);
+ fCurLocation = iterator.getLocation();
+ return ret;
+ }
+
+ /**
+ * Seeks to a given location. Wrapper to help CtfTmfTrace
+ * @param location
+ * unique location to find the event.
+ *
+ * @return success or not
+ */
+ public synchronized boolean seek(final CtfLocationInfo location) {
+ fCurLocation = new CtfLocation(location);
+ return getIterator().seek(location);
+ }
+
+ // -------------------------------------------
+ // Private helpers
+ // -------------------------------------------
+
+ /**
+ * Get iterator, called every time to get an iterator, no local copy is
+ * stored so that there is no need to "update"
+ *
+ * @return an iterator
+ */
+ private CtfIterator getIterator() {
+ return (CtfIterator) fTrace.createIteratorFromContext(this);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ * Bernd Hufmann - Updated for source and model lookup interfaces
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.tmf.core.event.ITmfCustomAttributes;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
+import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfModelLookup;
+import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
+import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * A wrapper class around CTF's Event Definition/Declaration that maps all types
+ * of Declaration to native Java types.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfEvent extends TmfEvent
+ implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ private final int fSourceCPU;
+ private final long fTypeId;
+ private final String fEventName;
+ private final IEventDeclaration fEventDeclaration;
+ private final @NonNull EventDefinition fEvent;
+ private final String fReference;
+
+ /** Lazy-loaded field containing the event's payload */
+ private ITmfEventField fContent;
+
+ private CtfTmfEventType fCtfTmfEventType;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Constructor used by {@link CtfTmfEventFactory#createEvent}
+ */
+ CtfTmfEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
+ String fileName, int cpu, IEventDeclaration declaration, @NonNull EventDefinition eventDefinition) {
+ super(trace,
+ rank,
+ timestamp,
+ /*
+ * Event type. We don't use TmfEvent's field here, we
+ * re-implement getType().
+ */
+ null,
+ /*
+ * Content handled with a lazy-loaded field re-implemented in
+ * getContent().
+ */
+ null);
+
+ fEventDeclaration = declaration;
+ fSourceCPU = cpu;
+ fTypeId = declaration.getId().longValue();
+ fEventName = declaration.getName();
+ fEvent = eventDefinition;
+ fReference = fileName;
+ }
+
+ /**
+ * Inner constructor to create "null" events. Don't use this directly in
+ * normal usage, use {@link CtfTmfEventFactory#getNullEvent(CtfTmfTrace)} to
+ * get an instance of an empty event.
+ *
+ * There is no need to give higher visibility to this method than package
+ * visible.
+ *
+ * @param trace
+ * The trace associated with this event
+ */
+ CtfTmfEvent(CtfTmfTrace trace) {
+ super(trace,
+ ITmfContext.UNKNOWN_RANK,
+ new TmfNanoTimestamp(-1),
+ null,
+ new TmfEventField("", null, new CtfTmfEventField[0])); //$NON-NLS-1$
+ fSourceCPU = -1;
+ fTypeId = -1;
+ fEventName = EMPTY_CTF_EVENT_NAME;
+ fEventDeclaration = null;
+ fEvent = EventDefinition.NULL_EVENT;
+ fReference = null;
+ }
+
+ /**
+ * Default constructor. Do not use directly, but it needs to be present
+ * because it's used in extension points, and the framework will use this
+ * constructor to get the class type.
+ */
+ public CtfTmfEvent() {
+ this(null);
+ }
+
+ // ------------------------------------------------------------------------
+ // Getters/Setters/Predicates
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets the cpu core the event was recorded on.
+ *
+ * @return The cpu id for a given source. In lttng it's from CPUINFO
+ */
+ public int getCPU() {
+ return fSourceCPU;
+ }
+
+ /**
+ * Return this event's ID, according to the trace's metadata.
+ *
+ * Watch out, this ID is not constant from one trace to another for the same
+ * event types! Use "getEventName()" for a constant reference.
+ *
+ * @return The event ID
+ */
+ public long getID() {
+ return fTypeId;
+ }
+
+ /**
+ * Return this event's reference
+ *
+ * @return The event's reference
+ */
+ public String getReference() {
+ return fReference;
+ }
+
+ @Override
+ public CtfTmfTrace getTrace() {
+ /*
+ * Should be of the right type, since we take a CtfTmfTrace at the
+ * constructor
+ */
+ return (CtfTmfTrace) super.getTrace();
+ }
+
+ @Override
+ public ITmfEventType getType() {
+ if (fCtfTmfEventType == null) {
+ fCtfTmfEventType = new CtfTmfEventType(fEventName, getContent());
+
+ /*
+ * Register the event type in the owning trace, but only if there is
+ * one
+ */
+ getTrace().registerEventType(fCtfTmfEventType);
+ }
+ return fCtfTmfEventType;
+ }
+
+ @Override
+ public String getName() {
+ return fEventName;
+ }
+
+ @Override
+ public Set<String> listCustomAttributes() {
+ if (fEventDeclaration == null) {
+ return new HashSet<>();
+ }
+ return fEventDeclaration.getCustomAttributes();
+ }
+
+ @Override
+ public String getCustomAttribute(String name) {
+ if (fEventDeclaration == null) {
+ return null;
+ }
+ return fEventDeclaration.getCustomAttribute(name);
+ }
+
+ /**
+ * Get the call site for this event.
+ *
+ * @return the call site information, or null if there is none
+ */
+ @Override
+ public CtfTmfCallsite getCallsite() {
+ CtfTmfCallsite callsite = null;
+ CtfTmfTrace trace = getTrace();
+
+ if (getContent() != null) {
+ ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
+ if (ipField != null && ipField.getValue() instanceof Long) {
+ long ip = (Long) ipField.getValue();
+ callsite = trace.getCallsite(fEventName, ip);
+ }
+ }
+ if (callsite == null) {
+ callsite = trace.getCallsite(fEventName);
+ }
+ return callsite;
+ }
+
+ @Override
+ public String getModelUri() {
+ return getCustomAttribute(CtfConstants.MODEL_URI_KEY);
+ }
+
+ @Override
+ public synchronized ITmfEventField getContent() {
+ if (fContent == null) {
+ fContent = new TmfEventField(
+ ITmfEventField.ROOT_FIELD_ID, null, parseFields(fEvent));
+ }
+ return fContent;
+ }
+
+ /**
+ * Extract the field information from the structDefinition haze-inducing
+ * mess, and put them into something ITmfEventField can cope with.
+ */
+ private static CtfTmfEventField[] parseFields(@NonNull EventDefinition eventDef) {
+ List<CtfTmfEventField> fields = new ArrayList<>();
+
+ ICompositeDefinition structFields = eventDef.getFields();
+ if (structFields != null) {
+ if (structFields.getFieldNames() != null) {
+ for (String curFieldName : structFields.getFieldNames()) {
+ fields.add(CtfTmfEventField.parseField((IDefinition) structFields.getDefinition(curFieldName), curFieldName));
+ }
+ }
+ }
+ /* Add context information as CtfTmfEventField */
+ ICompositeDefinition structContext = eventDef.getContext();
+ if (structContext != null) {
+ for (String contextName : structContext.getFieldNames()) {
+ /* Prefix field name */
+ String curContextName = CtfConstants.CONTEXT_FIELD_PREFIX + contextName;
+ fields.add(CtfTmfEventField.parseField((IDefinition) structContext.getDefinition(contextName), curContextName));
+ }
+ }
+
+ return fields.toArray(new CtfTmfEventField[fields.size()]);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.CTFStrings;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * Factory for CtfTmfEvent's.
+ *
+ * This code was moved out of CtfTmfEvent to provide better separation between
+ * the parsing/instantiation of events, and the usual TMF API implementations.
+ *
+ * @author Alexandre Montplaisir
+ */
+public final class CtfTmfEventFactory {
+
+ private static final String NO_STREAM = "No stream"; //$NON-NLS-1$
+
+ /**
+ * Don't let anyone instantiate this class.
+ */
+ private CtfTmfEventFactory() {}
+
+ /**
+ * Factory method to instantiate new {@link CtfTmfEvent}'s.
+ *
+ * @param eventDef
+ * CTF EventDefinition object corresponding to this trace event
+ * @param fileName
+ * The path to the trace file
+ * @param originTrace
+ * The trace from which this event originates
+ * @return The newly-built CtfTmfEvent
+ */
+ public static CtfTmfEvent createEvent(EventDefinition eventDef,
+ String fileName, CtfTmfTrace originTrace) {
+
+ /* Prepare what to pass to CtfTmfEvent's constructor */
+ final IEventDeclaration eventDecl = eventDef.getDeclaration();
+ final long ts = eventDef.getTimestamp();
+ final TmfNanoTimestamp timestamp = originTrace.createTimestamp(
+ originTrace.timestampCyclesToNanos(ts));
+
+ int sourceCPU = eventDef.getCPU();
+
+ String reference = fileName == null ? NO_STREAM : fileName;
+
+ /* Handle the special case of lost events */
+ if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
+ IDefinition nbLostEventsDef = eventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD);
+ IDefinition durationDef = eventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_DURATION);
+ if (!(nbLostEventsDef instanceof IntegerDefinition) || !(durationDef instanceof IntegerDefinition)) {
+ /*
+ * One or both of these fields doesn't exist, or is not of the
+ * right type. The event claims to be a "lost event", but is
+ * malformed. Log it and return a null event instead.
+ */
+ return getNullEvent(originTrace);
+ }
+ long nbLostEvents = ((IntegerDefinition) nbLostEventsDef).getValue();
+ long duration = ((IntegerDefinition) durationDef).getValue();
+ TmfNanoTimestamp timestampEnd = new TmfNanoTimestamp(
+ originTrace.timestampCyclesToNanos(ts) + duration);
+
+ CtfTmfLostEvent lostEvent = new CtfTmfLostEvent(originTrace,
+ ITmfContext.UNKNOWN_RANK,
+ reference, // filename
+ sourceCPU,
+ eventDecl,
+ new TmfTimeRange(timestamp, timestampEnd),
+ nbLostEvents,
+ eventDef);
+ return lostEvent;
+ }
+
+ /* Handle standard event types */
+ CtfTmfEvent event = new CtfTmfEvent(
+ originTrace,
+ ITmfContext.UNKNOWN_RANK,
+ timestamp,
+ reference, // filename
+ sourceCPU,
+ eventDecl,
+ eventDef);
+ return event;
+ }
+
+ /* Singleton instance of a null event */
+ private static CtfTmfEvent nullEvent = null;
+
+ /**
+ * Get an instance of a null event.
+ *
+ * @param trace
+ * A trace to associate with this null event
+ * @return An empty event
+ */
+ public static CtfTmfEvent getNullEvent(@NonNull CtfTmfTrace trace) {
+ if (nullEvent == null) {
+ nullEvent = new CtfTmfEvent(trace);
+ }
+ return nullEvent;
+ }
+
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011, 2014 Ericsson, École Polytechnique de Montréal
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Initial API and implementation, extend TmfEventField
+ * Bernd Hufmann - Add Enum field handling
+ * Geneviève Bastien - Add Struct and Variant field handling
+ * Jean-Christian Kouame - Correct handling of unsigned integer fields
+ * François Doray - Add generic array field type
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.Definition;
+import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
+import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
+import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
+import org.eclipse.tracecompass.tmf.ctf.core.CtfEnumPair;
+
+/**
+ * The CTF implementation of the TMF event field model
+ *
+ * @version 2.0
+ * @author Matthew Khouzam
+ * @author Alexandre Montplaisir
+ */
+public abstract class CtfTmfEventField extends TmfEventField {
+
+ // ------------------------------------------------------------------------
+ // Constructor
+ // ------------------------------------------------------------------------
+
+ /**
+ * Standard constructor. Only to be used internally, call parseField() to
+ * generate a new field object.
+ *
+ * @param name
+ * The name of this field
+ * @param value
+ * The value of this field. Its type should match the field type.
+ * @param fields
+ * The children fields. Useful for composite fields
+ */
+ protected CtfTmfEventField(String name, Object value, ITmfEventField[] fields) {
+ super(/* Strip the underscore from the field name if there is one */
+ name.startsWith("_") ? name.substring(1) : name, //$NON-NLS-1$
+ value,
+ fields);
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ /**
+ * Factory method to instantiate CtfTmfEventField objects.
+ *
+ * @param fieldDef
+ * The CTF Definition of this event field
+ * @param fieldName
+ * String The name to assign to this field
+ * @return The resulting CtfTmfEventField object
+ * @deprecated use {@link CtfTmfEventField#parseField(IDefinition, String)}
+ */
+ @Deprecated
+ public static CtfTmfEventField parseField(Definition fieldDef,
+ String fieldName) {
+ return parseField((IDefinition) fieldDef, fieldName);
+ }
+
+ /**
+ * Factory method to instantiate CtfTmfEventField objects.
+ *
+ * @param fieldDef
+ * The CTF Definition of this event field
+ * @param fieldName
+ * String The name to assign to this field
+ * @return The resulting CtfTmfEventField object
+ */
+ public static CtfTmfEventField parseField(IDefinition fieldDef,
+ String fieldName) {
+ CtfTmfEventField field = null;
+
+ /* Determine the Definition type */
+ if (fieldDef instanceof IntegerDefinition) {
+ IntegerDefinition intDef = (IntegerDefinition) fieldDef;
+ int base = intDef.getDeclaration().getBase();
+ field = new CTFIntegerField(fieldName, intDef.getValue(), base, intDef.getDeclaration().isSigned());
+
+ } else if (fieldDef instanceof EnumDefinition) {
+ EnumDefinition enumDef = (EnumDefinition) fieldDef;
+ field = new CTFEnumField(fieldName, new CtfEnumPair(enumDef.getValue(), enumDef.getIntegerValue()));
+
+ } else if (fieldDef instanceof StringDefinition) {
+ field = new CTFStringField(fieldName, ((StringDefinition) fieldDef).getValue());
+
+ } else if (fieldDef instanceof FloatDefinition) {
+ FloatDefinition floatDef = (FloatDefinition) fieldDef;
+ field = new CTFFloatField(fieldName, floatDef.getValue());
+
+ } else if (fieldDef instanceof AbstractArrayDefinition) {
+ AbstractArrayDefinition arrayDef = (AbstractArrayDefinition) fieldDef;
+ IDeclaration decl = arrayDef.getDeclaration();
+ if (!(decl instanceof CompoundDeclaration)) {
+ throw new IllegalArgumentException("Array definitions should only come from sequence or array declarations"); //$NON-NLS-1$
+ }
+ CompoundDeclaration arrDecl = (CompoundDeclaration) decl;
+ IDeclaration elemType = null;
+ Collection<Definition> definitions = arrayDef.getDefinitions();
+ elemType = arrDecl.getElementType();
+ if (elemType instanceof IntegerDeclaration) {
+ /*
+ * Array of integers => CTFIntegerArrayField, unless it's a
+ * CTFStringField
+ */
+ IntegerDeclaration elemIntType = (IntegerDeclaration) elemType;
+ /* Are the integers characters and encoded? */
+ if (elemIntType.isCharacter()) {
+ /* it's a CTFStringField */
+ field = new CTFStringField(fieldName, arrayDef.toString());
+ } else {
+ /* it's a CTFIntegerArrayField */
+ int size = arrayDef.getDefinitions().size();
+ long[] values = new long[size];
+ for (int i = 0; i < size; i++) {
+ IDefinition elem = arrayDef.getDefinitions().get(i);
+ if (elem == null) {
+ break;
+ }
+ values[i] = ((IntegerDefinition) elem).getValue();
+ }
+ field = new CTFIntegerArrayField(fieldName, values,
+ elemIntType.getBase(),
+ elemIntType.isSigned());
+ }
+ } else {
+ /* Arrays of elements of any other type */
+ CtfTmfEventField[] elements = new CtfTmfEventField[arrayDef.getLength()];
+ /* Parse the elements of the array. */
+ int i = 0;
+ for (IDefinition definition : definitions) {
+ CtfTmfEventField curField = CtfTmfEventField.parseField(
+ definition, fieldName + '[' + i + ']');
+ elements[i] = curField;
+ i++;
+ }
+
+ field = new CTFArrayField(fieldName, elements);
+ }
+ } else if (fieldDef instanceof ICompositeDefinition) {
+ ICompositeDefinition strDef = (ICompositeDefinition) fieldDef;
+
+ List<ITmfEventField> list = new ArrayList<>();
+ /* Recursively parse the fields */
+ for (String curFieldName : strDef.getFieldNames()) {
+ list.add(CtfTmfEventField.parseField(strDef.getDefinition(curFieldName), curFieldName));
+ }
+ field = new CTFStructField(fieldName, list.toArray(new CtfTmfEventField[list.size()]));
+
+ } else if (fieldDef instanceof VariantDefinition) {
+ VariantDefinition varDef = (VariantDefinition) fieldDef;
+
+ String curFieldName = varDef.getCurrentFieldName();
+ IDefinition curFieldDef = varDef.getCurrentField();
+ if (curFieldDef != null) {
+ CtfTmfEventField subField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
+ field = new CTFVariantField(fieldName, subField);
+ } else {
+ /* A safe-guard, but curFieldDef should never be null */
+ field = new CTFStringField(curFieldName, ""); //$NON-NLS-1$
+ }
+
+ } else {
+ /*
+ * Safe-guard, to avoid null exceptions later, field is expected not
+ * to be null
+ */
+ field = new CTFStringField(fieldName, Messages.CtfTmfEventField_UnsupportedType + fieldDef.getClass().toString());
+ }
+ return field;
+ }
+
+ @Override
+ public String toString() {
+ return getName() + '=' + getFormattedValue();
+ }
+
+}
+
+/**
+ * The CTF field implementation for integer fields.
+ *
+ * @author alexmont
+ */
+final class CTFIntegerField extends CtfTmfEventField {
+
+ private final int fBase;
+ private final boolean fSigned;
+
+ /**
+ * A CTF "IntegerDefinition" can be an integer of any byte size, so in the
+ * Java parser this is interpreted as a long.
+ *
+ * @param name
+ * The name of this field
+ * @param longValue
+ * The integer value of this field
+ * @param signed
+ * Is the value signed or not
+ */
+ CTFIntegerField(String name, long longValue, int base, boolean signed) {
+ super(name, longValue, null);
+ fSigned = signed;
+ fBase = base;
+ }
+
+ @Override
+ public Long getValue() {
+ return (Long) super.getValue();
+ }
+
+ @Override
+ public String getFormattedValue() {
+ return IntegerDefinition.formatNumber(getValue(), fBase, fSigned);
+ }
+
+}
+
+/**
+ * The CTF field implementation for string fields
+ *
+ * @author alexmont
+ */
+final class CTFStringField extends CtfTmfEventField {
+
+ /**
+ * Constructor for CTFStringField.
+ *
+ * @param strValue
+ * The string value of this field
+ * @param name
+ * The name of this field
+ */
+ CTFStringField(String name, String strValue) {
+ super(name, strValue, null);
+ }
+
+ @Override
+ public String getValue() {
+ return (String) super.getValue();
+ }
+}
+
+/**
+ * CTF field implementation for arrays of integers.
+ *
+ * @author alexmont
+ */
+final class CTFIntegerArrayField extends CtfTmfEventField {
+
+ private final int fBase;
+ private final boolean fSigned;
+ private String fFormattedValue = null;
+
+ /**
+ * Constructor for CTFIntegerArrayField.
+ *
+ * @param name
+ * The name of this field
+ * @param longValues
+ * The array of integers (as longs) that compose this field's
+ * value
+ * @param signed
+ * Are the values in the array signed or not
+ */
+ CTFIntegerArrayField(String name, long[] longValues, int base, boolean signed) {
+ super(name, longValues, null);
+ fBase = base;
+ fSigned = signed;
+ }
+
+ @Override
+ public long[] getValue() {
+ return (long[]) super.getValue();
+ }
+
+ @Override
+ public synchronized String getFormattedValue() {
+ if (fFormattedValue == null) {
+ List<String> strings = new ArrayList<>();
+ for (long value : getValue()) {
+ strings.add(IntegerDefinition.formatNumber(value, fBase, fSigned));
+ }
+ fFormattedValue = strings.toString();
+ }
+ return fFormattedValue;
+ }
+
+}
+
+/**
+ * CTF field implementation for arrays of arbitrary types.
+ *
+ * @author fdoray
+ */
+final class CTFArrayField extends CtfTmfEventField {
+
+ private String fFormattedValue = null;
+
+ /**
+ * Constructor for CTFArrayField.
+ *
+ * @param name
+ * The name of this field
+ * @param elements
+ * The array elements of this field
+ */
+ CTFArrayField(String name, CtfTmfEventField[] elements) {
+ super(name, elements, elements);
+ }
+
+ @Override
+ public CtfTmfEventField[] getValue() {
+ return (CtfTmfEventField[]) super.getValue();
+ }
+
+ @Override
+ public synchronized String getFormattedValue() {
+ if (fFormattedValue == null) {
+ List<String> strings = new ArrayList<>();
+ for (CtfTmfEventField element : getValue()) {
+ strings.add(element.getFormattedValue());
+ }
+ fFormattedValue = strings.toString();
+ }
+ return fFormattedValue;
+ }
+}
+
+/**
+ * CTF field implementation for floats.
+ *
+ * @author emathko
+ */
+final class CTFFloatField extends CtfTmfEventField {
+
+ /**
+ * Constructor for CTFFloatField.
+ *
+ * @param value
+ * The float value (actually a double) of this field
+ * @param name
+ * The name of this field
+ */
+ protected CTFFloatField(String name, double value) {
+ super(name, value, null);
+ }
+
+ @Override
+ public Double getValue() {
+ return (Double) super.getValue();
+ }
+}
+
+/**
+ * The CTF field implementation for Enum fields
+ *
+ * @author Bernd Hufmann
+ */
+final class CTFEnumField extends CtfTmfEventField {
+
+ /**
+ * Constructor for CTFEnumField.
+ *
+ * @param enumValue
+ * The Enum value consisting of a pair of Enum value name and its
+ * long value
+ * @param name
+ * The name of this field
+ */
+ CTFEnumField(String name, CtfEnumPair enumValue) {
+ super(name, new CtfEnumPair(enumValue.getFirst(),
+ enumValue.getSecond()), null);
+ }
+
+ @Override
+ public CtfEnumPair getValue() {
+ return (CtfEnumPair) super.getValue();
+ }
+}
+
+/**
+ * The CTF field implementation for struct fields with sub-fields
+ *
+ * @author gbastien
+ */
+final class CTFStructField extends CtfTmfEventField {
+
+ /**
+ * Constructor for CTFStructField.
+ *
+ * @param fields
+ * The children of this field
+ * @param name
+ * The name of this field
+ */
+ CTFStructField(String name, CtfTmfEventField[] fields) {
+ super(name, fields, fields);
+ }
+
+ @Override
+ public CtfTmfEventField[] getValue() {
+ return (CtfTmfEventField[]) super.getValue();
+ }
+
+ @Override
+ public String getFormattedValue() {
+ return Arrays.toString(getValue());
+ }
+
+}
+
+/**
+ * The CTF field implementation for variant fields its child
+ *
+ * @author gbastien
+ */
+final class CTFVariantField extends CtfTmfEventField {
+
+ /**
+ * Constructor for CTFVariantField.
+ *
+ * @param field
+ * The field selected for this variant
+ * @param name
+ * The name of this field
+ */
+ CTFVariantField(String name, CtfTmfEventField field) {
+ super(name, field, new CtfTmfEventField[] { field });
+ }
+
+ @Override
+ public CtfTmfEventField getValue() {
+ return (CtfTmfEventField) super.getValue();
+ }
+
+}
+
+/* Implement other possible fields types here... */
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2014 Ericsson
+ *
+ * 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: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
+
+/**
+ * The CTF extension of the TMF event type
+ *
+ * @author Matthew khouzam
+ */
+public class CtfTmfEventType extends TmfEventType {
+
+ /**
+ * Constructor for CtfTmfEventType.
+ *
+ * @param eventName
+ * The event name
+ * @param content
+ * The event field
+ */
+ public CtfTmfEventType(String eventName, ITmfEventField content) {
+ super(eventName, content);
+ }
+
+ /**
+ * Method toString.
+ *
+ * @return String
+ */
+ @Override
+ public String toString() {
+ return getName();
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+
+/**
+ * An implementation of {@link ITmfLostEvent} for use in the CTF adaptor.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
+
+ private final TmfTimeRange fTimeRange;
+ private final long fNbLost;
+
+ /**
+ * Constructor. Only {@link CtfTmfEventFactory} should call this.
+ *
+ * @param trace
+ * The origin trace
+ * @param rank
+ * The rank of the event in the trace
+ * @param content
+ * The event's payload (fields). In case this event has some.
+ * @param fileName
+ * The name of the trace file from which this event comes
+ * @param cpu
+ * The CPU on which this event happened
+ * @param declaration
+ * The CTF Event Declaration object that created this event
+ * @param timeRange
+ * The time range of lost events indicated by this one
+ * @param nbLost
+ * The number of lost events in the range
+ */
+ CtfTmfLostEvent(CtfTmfTrace trace,
+ long rank,
+ String fileName,
+ int cpu,
+ IEventDeclaration declaration,
+ TmfTimeRange timeRange,
+ long nbLost,
+ @NonNull EventDefinition def) {
+ /*
+ * Only the factory should call this method, the case to
+ * (CtfTmfTimestamp) should be safe.
+ */
+ super(trace, rank, (TmfNanoTimestamp) timeRange.getStartTime(), fileName, cpu, declaration, def);
+ fTimeRange = timeRange;
+ fNbLost = nbLost;
+ }
+
+ @Override
+ public TmfTimeRange getTimeRange() {
+ return fTimeRange;
+ }
+
+ @Override
+ public long getNbLostEvents() {
+ return fNbLost;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson.
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message bundle for tmf.ctf.core.event
+ *
+ * @author Matthew Khouzam
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.tracecompass.tmf.ctf.core.event.messages"; //$NON-NLS-1$
+
+ /** Unsupported field type */
+ public static String CtfTmfEventField_UnsupportedType;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+
+/**
+ * Channel aspect for CTF traces
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfChannelAspect implements ITmfEventAspect {
+
+ @Override
+ public String getName() {
+ return Messages.getMessage(Messages.AspectName_Channel);
+ }
+
+ @Override
+ public String getHelpText() {
+ return Messages.getMessage(Messages.AspectHelpText_Channel);
+ }
+
+ @Override
+ public String resolve(ITmfEvent event) {
+ if (!(event instanceof CtfTmfEvent)) {
+ return EMPTY_STRING;
+ }
+ String ret = ((CtfTmfEvent) event).getReference();
+ return (ret == null ? EMPTY_STRING : ret);
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Ericsson
+ *
+ * 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:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
+
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+
+/**
+ * "CPU" event aspect for CTF traces.
+ *
+ * @author Alexandre Montplaisir
+ */
+public class CtfCpuAspect extends TmfCpuAspect {
+
+ @Override
+ public Integer resolve(ITmfEvent event) {
+ if (!(event instanceof CtfTmfEvent)) {
+ return null;
+ }
+ int cpu = ((CtfTmfEvent) event).getCPU();
+ return cpu;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ * 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:
+ * Patrick Tassé - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME =
+ "org.eclipse.tracecompass.tmf.ctf.core.event.aspect.messages"; //$NON-NLS-1$
+
+ public static String AspectName_Channel;
+ public static String AspectHelpText_Channel;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+
+ /**
+ * Helper method to expose externalized strings as non-null objects.
+ */
+ static @NonNull String getMessage(@Nullable String msg) {
+ if (msg == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return msg;
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+AspectName_Channel=Channel
+AspectHelpText_Channel=A channel is a set of events with specific parameters and potentially added context information.
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Patrick Tasse - Initial API and implementation
+ * Bernd Hufmann - Updated for new parent class
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.event.lookup;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite;
+
+/**
+ * CTF TMF call site information for source code lookup.
+ *
+ * @author Patrick Tasse
+ */
+public class CtfTmfCallsite extends TmfCallsite {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ /** The event name. */
+ private final String fEventName;
+
+ /** The instruction pointer. */
+ private final long fInstructionPointer;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Standard Constructor.
+ *
+ * @param callsite
+ * - a CTF call site
+ */
+ public CtfTmfCallsite(CTFCallsite callsite) {
+ super(callsite.getFileName(), callsite.getFunctionName(), callsite.getLineNumber());
+ fEventName = callsite.getEventName();
+ fInstructionPointer = callsite.getIp();
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the event name of the call site.
+ *
+ * @return the event name
+ */
+ public String getEventName() {
+ return fEventName;
+ }
+
+ /**
+ * Returns the instruction pointer of the call site.
+ *
+ * @return the instruction pointer
+ */
+ public long getIntructionPointer() {
+ return fInstructionPointer;
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
+ result = prime * result + (int) (fInstructionPointer ^ (fInstructionPointer >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CtfTmfCallsite other = (CtfTmfCallsite) obj;
+ if (!equalsNullable(fEventName, other.fEventName)) {
+ return false;
+ }
+ if (fInstructionPointer != other.fInstructionPointer) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return getEventName() + "@0x" + Long.toHexString(fInstructionPointer) + ": " + //$NON-NLS-1$ //$NON-NLS-2$
+ getFileName() + ':' + Long.toString(getLineNumber()) + ' ' + getFileName() + "()"; //$NON-NLS-1$
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+CtfTmfEventField_UnsupportedType=Unsupported field type:
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2012, 2015 Ericsson, École Polytechnique de Montréal
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Patrick Tasse - Updated for removal of context clone
+ * Geneviève Bastien - Added the createTimestamp function
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.trace;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.ctf.core.CTFException;
+import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
+import org.eclipse.tracecompass.ctf.core.event.CTFClock;
+import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
+import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
+import org.eclipse.tracecompass.ctf.core.trace.Metadata;
+import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
+import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
+import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIteratorManager;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
+import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceProperties;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceWithPreDefinedEvents;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
+import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpoint;
+import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
+import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
+import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfChannelAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfCpuAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * The CTf trace handler
+ *
+ * @version 1.0
+ * @author Matthew khouzam
+ */
+public class CtfTmfTrace extends TmfTrace
+ implements ITmfTraceProperties, ITmfPersistentlyIndexable,
+ ITmfTraceWithPreDefinedEvents, AutoCloseable {
+
+ // -------------------------------------------
+ // Constants
+ // -------------------------------------------
+
+ /**
+ * Default cache size for CTF traces
+ */
+ protected static final int DEFAULT_CACHE_SIZE = 50000;
+
+ /**
+ * Event aspects available for all CTF traces
+ * @since 1.0
+ */
+ protected static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
+ checkNotNull(ImmutableList.of(
+ ITmfEventAspect.BaseAspects.TIMESTAMP,
+ new CtfChannelAspect(),
+ new CtfCpuAspect(),
+ ITmfEventAspect.BaseAspects.EVENT_TYPE,
+ ITmfEventAspect.BaseAspects.CONTENTS
+ ));
+
+ /**
+ * The Ctf clock unique identifier field
+ */
+ private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
+ private static final int CONFIDENCE = 10;
+ private static final int MIN_CONFIDENCE = 1;
+
+ // -------------------------------------------
+ // Fields
+ // -------------------------------------------
+
+ private final Map<String, CtfTmfEventType> fContainedEventTypes =
+ Collections.synchronizedMap(new HashMap<String, CtfTmfEventType>());
+
+ private final CtfIteratorManager fIteratorManager =
+ new CtfIteratorManager(this);
+
+ /* Reference to the CTF Trace */
+ private CTFTrace fTrace;
+
+ // -------------------------------------------
+ // TmfTrace Overrides
+ // -------------------------------------------
+ /**
+ * Method initTrace.
+ *
+ * @param resource
+ * The resource associated with this trace
+ * @param path
+ * The path to the trace file
+ * @param eventType
+ * The type of events that will be read from this trace
+ * @throws TmfTraceException
+ * If something went wrong while reading the trace
+ */
+ @Override
+ public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType)
+ throws TmfTraceException {
+ /*
+ * Set the cache size. This has to be done before the call to super()
+ * because the super needs to know the cache size.
+ */
+ setCacheSize();
+
+ super.initTrace(resource, path, eventType);
+
+ try {
+ this.fTrace = new CTFTrace(path);
+ CtfTmfContext ctx;
+ /* Set the start and (current) end times for this trace */
+ ctx = (CtfTmfContext) seekEvent(0L);
+ CtfTmfEvent event = getNext(ctx);
+ if ((ctx.getLocation().equals(CtfIterator.NULL_LOCATION)) || (ctx.getCurrentEvent() == null)) {
+ /* Handle the case where the trace is empty */
+ this.setStartTime(TmfTimestamp.BIG_BANG);
+ } else {
+ final ITmfTimestamp curTime = event.getTimestamp();
+ this.setStartTime(curTime);
+ this.setEndTime(curTime);
+ }
+ /*
+ * Register every event type. When you call getType, it will
+ * register a trace to that type in the TmfEventTypeManager
+ */
+ try (CtfIterator iter = fIteratorManager.getIterator(ctx)) {
+ for (IEventDeclaration ied : iter.getEventDeclarations()) {
+ CtfTmfEventType ctfTmfEventType = fContainedEventTypes.get(ied.getName());
+ if (ctfTmfEventType == null) {
+ List<ITmfEventField> content = new ArrayList<>();
+ /* Should only return null the first time */
+ for (String fieldName : ied.getFields().getFieldsList()) {
+ content.add(new TmfEventField(fieldName, null, null));
+ }
+ ITmfEventField contentTree = new TmfEventField(
+ ITmfEventField.ROOT_FIELD_ID,
+ null,
+ content.toArray(new ITmfEventField[content.size()])
+ );
+
+ ctfTmfEventType = new CtfTmfEventType(ied.getName(), contentTree);
+ fContainedEventTypes.put(ctfTmfEventType.getName(), ctfTmfEventType);
+ }
+ }
+ }
+ } catch (final CTFException e) {
+ /*
+ * If it failed at the init(), we can assume it's because the file
+ * was not found or was not recognized as a CTF trace. Throw into
+ * the new type of exception expected by the rest of TMF.
+ */
+ throw new TmfTraceException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void close() {
+ dispose();
+ }
+
+ @Override
+ public synchronized void dispose() {
+ fIteratorManager.dispose();
+ if (fTrace != null) {
+ fTrace = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The default implementation of a CTF trace.
+ *
+ * Firstly a weak validation of the metadata is done to determine if the
+ * path is actually for a CTF trace. After that a full validation is done.
+ *
+ * If the weak and full validation are successful the confidence is set
+ * to 10.
+ *
+ * If the weak validation was successful, but the full validation fails
+ * a TraceValidationStatus with severity warning and confidence of 1 is
+ * returned.
+ *
+ * If both weak and full validation fails an error status is returned.
+ */
+ @Override
+ public IStatus validate(final IProject project, final String path) {
+ boolean isMetadataFile = false;
+ try {
+ isMetadataFile = Metadata.preValidate(path);
+ } catch (final CTFException e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
+ }
+
+ if (isMetadataFile) {
+ // Trace is pre-validated, continue will full validation
+ try {
+ final CTFTrace trace = new CTFTrace(path);
+ if (!trace.majorIsSet()) {
+ if (isMetadataFile) {
+ return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet, null);
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
+ }
+
+ // Validate using reader initialization
+ try (CTFTraceReader ctfTraceReader = new CTFTraceReader(trace)) {}
+
+ // Trace is validated, return with confidence
+ return new CtfTraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID, trace.getEnvironment());
+
+ } catch (final CTFException | BufferOverflowException e ) {
+ // return warning since it's a CTF trace but with errors in it
+ return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError);
+ }
+
+ @Override
+ public Iterable<ITmfEventAspect> getEventAspects() {
+ return CTF_ASPECTS;
+ }
+
+ /**
+ * Method getCurrentLocation. This is not applicable in CTF
+ *
+ * @return null, since the trace has no knowledge of the current location
+ * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getCurrentLocation()
+ */
+ @Override
+ public ITmfLocation getCurrentLocation() {
+ return null;
+ }
+
+ @Override
+ public double getLocationRatio(ITmfLocation location) {
+ final CtfLocation curLocation = (CtfLocation) location;
+ final long startTime = getStartTime().getValue();
+ final double diff = curLocation.getLocationInfo().getTimestamp() - startTime;
+ final double total = getEndTime().getValue() - startTime;
+ return Math.max(0.0, Math.min(1.0, diff / total));
+ }
+
+ /**
+ * Method seekEvent.
+ *
+ * @param location
+ * ITmfLocation<?>
+ * @return ITmfContext
+ */
+ @Override
+ public synchronized ITmfContext seekEvent(final ITmfLocation location) {
+ CtfLocation currentLocation = (CtfLocation) location;
+ CtfTmfContext context = new CtfTmfContext(this);
+ if (fTrace == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
+ }
+ /*
+ * The rank is set to 0 if the iterator seeks the beginning. If not, it
+ * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
+ * by rank for now.
+ */
+ if (currentLocation == null) {
+ currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
+ context.setRank(0);
+ } else {
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
+ currentLocation = new CtfLocation(fTrace.getCurrentEndTime() + 1, 0L);
+ }
+ }
+ /* This will seek and update the location after the seek */
+ context.setLocation(currentLocation);
+ return context;
+ }
+
+ @Override
+ public synchronized ITmfContext seekEvent(double ratio) {
+ CtfTmfContext context = new CtfTmfContext(this);
+ if (fTrace == null) {
+ context.setLocation(null);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
+ }
+ final long end = getEndTime().getValue();
+ final long start = getStartTime().getValue();
+ final long diff = end - start;
+ final long ratioTs = Math.round(diff * ratio) + start;
+ context.seek(ratioTs);
+ context.setRank(ITmfContext.UNKNOWN_RANK);
+ return context;
+ }
+
+ /**
+ * Method readNextEvent.
+ *
+ * @param context
+ * ITmfContext
+ * @return CtfTmfEvent
+ * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getNext(ITmfContext)
+ */
+ @Override
+ public synchronized CtfTmfEvent getNext(final ITmfContext context) {
+ if (fTrace == null) {
+ return null;
+ }
+ CtfTmfEvent event = null;
+ if (context instanceof CtfTmfContext) {
+ if (context.getLocation() == null || CtfLocation.INVALID_LOCATION.equals(context.getLocation().getLocationInfo())) {
+ return null;
+ }
+ CtfTmfContext ctfContext = (CtfTmfContext) context;
+ event = ctfContext.getCurrentEvent();
+
+ if (event != null) {
+ updateAttributes(context, event.getTimestamp());
+ ctfContext.advance();
+ ctfContext.increaseRank();
+ }
+ }
+
+ return event;
+ }
+
+ /**
+ * Ctf traces have a clock with a unique uuid that will be used to identify
+ * the host. Traces with the same clock uuid will be known to have been made
+ * on the same machine.
+ *
+ * Note: uuid is an optional field, it may not be there for a clock.
+ */
+ @Override
+ public String getHostId() {
+ CTFClock clock = fTrace.getClock();
+ if (clock != null) {
+ String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
+ if (clockHost != null) {
+ return clockHost;
+ }
+ }
+ return super.getHostId();
+ }
+
+ /**
+ * Get the first callsite that matches the event name
+ *
+ * @param eventName The event name to look for
+ * @return The best callsite candidate
+ */
+ public @Nullable CtfTmfCallsite getCallsite(String eventName) {
+ CTFCallsite callsite = fTrace.getCallsite(eventName);
+ if (callsite != null) {
+ return new CtfTmfCallsite(callsite);
+ }
+ return null;
+ }
+
+ /**
+ * Get the closest matching callsite for given event name and instruction
+ * pointer
+ *
+ * @param eventName
+ * The event name
+ * @param ip
+ * The instruction pointer
+ * @return The closest matching callsite
+ */
+ public @Nullable CtfTmfCallsite getCallsite(String eventName, long ip) {
+ CTFCallsite calliste = fTrace.getCallsite(eventName, ip);
+ if (calliste != null) {
+ return new CtfTmfCallsite(calliste);
+ }
+ return null;
+ }
+
+ /**
+ * Get the CTF environment variables defined in this CTF trace, in <name,
+ * value> form. This comes from the trace's CTF metadata.
+ *
+ * @return The CTF environment
+ */
+ public Map<String, String> getEnvironment() {
+ return fTrace.getEnvironment();
+ }
+
+ // -------------------------------------------
+ // ITmfTraceProperties
+ // -------------------------------------------
+
+ @Override
+ public Map<String, String> getTraceProperties() {
+ Map<String, String> properties = new HashMap<>();
+ properties.putAll(fTrace.getEnvironment());
+ properties.put(Messages.CtfTmfTrace_HostID, getHostId());
+ return properties;
+ }
+
+ // -------------------------------------------
+ // Clocks
+ // -------------------------------------------
+
+ /**
+ * gets the clock offset
+ *
+ * @return the clock offset in ns
+ */
+ public long getOffset() {
+ if (fTrace != null) {
+ return fTrace.getOffset();
+ }
+ return 0;
+ }
+
+ /**
+ * Convert a CTF timestamp in CPU cycles to its equivalent in nanoseconds
+ * for this trace.
+ *
+ * @param cycles
+ * The timestamp in cycles
+ * @return The timestamp in nanoseconds
+ */
+ public long timestampCyclesToNanos(long cycles) {
+ return fTrace.timestampCyclesToNanos(cycles);
+ }
+
+ /**
+ * Convert a CTF timestamp in nanoseconds to its equivalent in CPU cycles
+ * for this trace.
+ *
+ * @param nanos
+ * The timestamp in nanoseconds
+ * @return The timestamp in cycles
+ */
+ public long timestampNanoToCycles(long nanos) {
+ return fTrace.timestampNanoToCycles(nanos);
+ }
+
+ /**
+ * Gets the list of declared events
+ */
+ @Override
+ public Set<CtfTmfEventType> getContainedEventTypes() {
+ return ImmutableSet.copyOf(fContainedEventTypes.values());
+ }
+
+ /**
+ * Register an event type to this trace.
+ *
+ * Public visibility so that {@link CtfTmfEvent#getType} can call it.
+ *
+ * FIXME This could probably be made cleaner?
+ *
+ * @param eventType
+ * The event type to register
+ */
+ public void registerEventType(CtfTmfEventType eventType) {
+ fContainedEventTypes.put(eventType.getName(), eventType);
+ }
+
+ // -------------------------------------------
+ // Parser
+ // -------------------------------------------
+
+ @Override
+ public CtfTmfEvent parseEvent(ITmfContext context) {
+ CtfTmfEvent event = null;
+ if (context instanceof CtfTmfContext) {
+ final ITmfContext tmpContext = seekEvent(context.getLocation());
+ event = getNext(tmpContext);
+ }
+ return event;
+ }
+
+ /**
+ * Sets the cache size for a CtfTmfTrace.
+ */
+ protected void setCacheSize() {
+ setCacheSize(DEFAULT_CACHE_SIZE);
+ }
+
+ // -------------------------------------------
+ // CtfIterator factory methods
+ // -------------------------------------------
+
+ /**
+ * Get an iterator to the trace
+ *
+ * @return an iterator to the trace
+ */
+ public ITmfContext createIterator() {
+ try {
+ return new CtfIterator(fTrace, this);
+ } catch (CTFException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * Get an iterator to the trace, , which will initially point to the given
+ * location/rank.
+ *
+ * @param ctfLocationData
+ * The initial timestamp the iterator will be pointing to
+ * @param rank
+ * The initial rank
+ * @return The new iterator
+ */
+ public ITmfContext createIterator(CtfLocationInfo ctfLocationData, long rank) {
+ try {
+ return new CtfIterator(fTrace, this, ctfLocationData, rank);
+ } catch (CTFException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * Create the 'CtfIterator' object from a CtfTmfContext.
+ *
+ * @param context
+ * The iterator will initially be pointing to this context
+ * @return A new CtfIterator object
+ * @since 1.0
+ */
+ public ITmfContext createIteratorFromContext(CtfTmfContext context) {
+ return fIteratorManager.getIterator(context);
+ }
+
+ /**
+ * Dispose an iterator that was create with
+ * {@link #createIteratorFromContext}
+ *
+ * @param context
+ * The last context that was pointed to by the iterator (this is
+ * the 'key' to find the correct iterator to dispose).
+ * @since 1.0
+ */
+ public void disposeContext(CtfTmfContext context) {
+ fIteratorManager.removeIterator(context);
+ }
+
+ // ------------------------------------------------------------------------
+ // Timestamp transformation functions
+ // ------------------------------------------------------------------------
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public @NonNull TmfNanoTimestamp createTimestamp(long ts) {
+ return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
+ }
+
+ private static int fCheckpointSize = -1;
+
+ @Override
+ public synchronized int getCheckpointSize() {
+ if (fCheckpointSize == -1) {
+ TmfCheckpoint c = new TmfCheckpoint(new TmfNanoTimestamp(0), new CtfLocation(0, 0), 0);
+ ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
+ b.clear();
+ c.serialize(b);
+ fCheckpointSize = b.position();
+ }
+
+ return fCheckpointSize;
+ }
+
+ @Override
+ protected ITmfTraceIndexer createIndexer(int interval) {
+ return new TmfBTreeTraceIndexer(this, interval);
+ }
+
+ @Override
+ public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
+ return new CtfLocation(bufferIn);
+ }
+
+ @Override
+ public boolean isComplete() {
+ if (getResource() == null) {
+ return true;
+ }
+
+ String host = null;
+ String port = null;
+ String sessionName = null;
+ try {
+ host = getResource().getPersistentProperty(CtfConstants.LIVE_HOST);
+ port = getResource().getPersistentProperty(CtfConstants.LIVE_PORT);
+ sessionName = getResource().getPersistentProperty(CtfConstants.LIVE_SESSION_NAME);
+ } catch (CoreException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ // Something happened to the resource, assume we won't get any more
+ // data from it
+ return true;
+ }
+ return host == null || port == null || sessionName == null;
+ }
+
+ @Override
+ public void setComplete(final boolean isComplete) {
+ super.setComplete(isComplete);
+ try {
+ if (isComplete) {
+ getResource().setPersistentProperty(CtfConstants.LIVE_HOST, null);
+ getResource().setPersistentProperty(CtfConstants.LIVE_PORT, null);
+ getResource().setPersistentProperty(CtfConstants.LIVE_SESSION_NAME, null);
+ }
+ } catch (CoreException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ }
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.trace;
+
+import java.util.Map;
+
+import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
+
+/**
+ * Trace validation status that contains additional information from a CTF
+ * trace for further validation.
+ *
+ * @since 1.0
+ */
+public class CtfTraceValidationStatus extends TraceValidationStatus {
+
+ private final Map<String, String> fEnvironment;
+
+ /**
+ * Constructor
+ *
+ * @param confidence
+ * the confidence level, 0 is lowest
+ * @param pluginId
+ * the unique identifier of the relevant plug-in
+ * @param environment
+ * the CTF trace environment variables
+ */
+ public CtfTraceValidationStatus(int confidence, String pluginId, Map<String, String> environment) {
+ super(confidence, pluginId);
+ fEnvironment = environment;
+ }
+
+ /**
+ * Get the CTF trace environment variables
+ *
+ * @return the CTF trace environment variables
+ */
+ public Map<String, String> getEnvironment() {
+ return fEnvironment;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 Ericsson.
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.core.trace;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message bundle for tmf.ctf.core.trace
+ *
+ * @author Matthew Khouzam
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.tracecompass.tmf.ctf.core.trace.messages"; //$NON-NLS-1$
+
+ /** Buffer overflow detected */
+ public static String CtfTmfTrace_BufferOverflowErrorMessage;
+
+ /** Text for host ID */
+ public static String CtfTmfTrace_HostID;
+
+ /** Major version number not set */
+ public static String CtfTmfTrace_MajorNotSet;
+
+ /** Reading error */
+ public static String CtfTmfTrace_ReadingError;
+
+ /** No event */
+ public static String CtfTmfTrace_NoEvent;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+CtfTmfTrace_BufferOverflowErrorMessage=Buffer overflow exception, trace is malformed
+CtfTmfTrace_HostID=host ID
+CtfTmfTrace_MajorNotSet=Major version number not set
+CtfTmfTrace_ReadingError=Reading error
+CtfTmfTrace_NoEvent=Trace has no events
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+screenshots/
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
+org.eclipse.jdt.core.compiler.problem.deadCode=error
+org.eclipse.jdt.core.compiler.problem.deprecation=error
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=error
+org.eclipse.jdt.core.compiler.problem.emptyStatement=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=error
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=error
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
+org.eclipse.jdt.core.compiler.source=1.7
+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_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+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.alignment_for_union_type_in_multicatch=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=0
+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.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+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.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+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=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=250
+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_on_off_tags=false
+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.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_tmf-style
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- /dev/null
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_JAVADOC_TAG=Warning
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Ignore
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=false
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Error
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
--- /dev/null
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=2
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=1
+compilers.p.discouraged-class=1
+compilers.p.internal=1
+compilers.p.missing-packages=2
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=2
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=1
+compilers.p.unknown-element=1
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=1
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+eclipse.preferences.version=1
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;singleton:=true
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Export-Package: org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests
+Require-Bundle: org.junit;bundle-version="4.0.0",
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.tracecompass.tmf.core,
+ org.eclipse.tracecompass.tmf.ui,
+ org.eclipse.tracecompass.tmf.ui.swtbot.tests,
+ org.eclipse.tracecompass.tmf.ctf.core,
+ org.eclipse.tracecompass.tmf.ctf.core.tests
+Import-Package: org.apache.log4j,
+ org.apache.log4j.varia,
+ org.eclipse.swtbot.eclipse.finder,
+ org.eclipse.swtbot.eclipse.finder.widgets,
+ org.eclipse.swtbot.swt.finder,
+ org.eclipse.swtbot.swt.finder.finders,
+ org.eclipse.swtbot.swt.finder.junit,
+ org.eclipse.swtbot.swt.finder.results,
+ org.eclipse.swtbot.swt.finder.utils,
+ org.eclipse.swtbot.swt.finder.waits,
+ org.eclipse.swtbot.swt.finder.widgets
--- /dev/null
+<!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>June 5, 2006</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
--- /dev/null
+###############################################################################
+# Copyright (c) 2014, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
+additional.bundles = org.eclipse.jdt.annotation
+jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
--- /dev/null
+###############################################################################
+# Copyright (c) 2014 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+Bundle-Vendor = Eclipse Trace Compass
+Bundle-Name = CTF Support for TMF UI SWTBot Tests Plug-in
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2014 Ericsson
+
+ 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
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <name>CTF Support for TMF SWTBot Tests Plug-in</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</testSuite>
+ <testClass>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests.AllTests</testClass>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine>
+ <product>org.eclipse.platform.ide</product>
+ <environmentVariables>
+ <SWT_GTK3>${SWT_GTK3}</SWT_GTK3>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <groupId>org.eclipse.tracecompass</groupId>
+</project>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ * (Extracted from ImportAndReadSmokeTest.java)
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.varia.NullAppender;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
+import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
+import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView;
+import org.eclipse.tracecompass.tmf.ui.views.statistics.TmfStatisticsView;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+/**
+ * Abstract SWTBot Smoke test class.
+ *
+ * @author Matthew Khouzam
+ * @author Bernd Hufmann
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public abstract class AbstractImportAndReadSmokeTest {
+
+ /** Trace name */
+ protected static final String TRACE_NAME = "scp_dest";
+ /** Trace folder */
+ protected static final String TRACE_FOLDER = "synctraces";
+ /** Trace type name for generic CTF traces */
+ protected static final String TRACE_TYPE_NAME = "Generic CTF Trace";
+ /** A Generic CTF Trace*/
+ protected static final CtfTmfTestTrace fTrace = CtfTmfTestTrace.SYNC_DEST;
+ /** SWT BOT workbench reference */
+ protected static SWTWorkbenchBot fBot;
+ /** Wizard to use */
+ protected static Wizard fWizard;
+
+ /** The Log4j logger instance. */
+ protected static final Logger fLogger = Logger.getRootLogger();
+
+ /** Test Class setup */
+ @BeforeClass
+ public static void init() {
+ assumeTrue(fTrace.exists());
+ SWTBotUtils.failIfUIThread();
+
+ /* set up for swtbot */
+ SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */
+ fLogger.removeAllAppenders();
+ fLogger.addAppender(new NullAppender());
+ fBot = new SWTWorkbenchBot();
+
+ SWTBotUtils.closeView("welcome", fBot);
+
+ SWTBotUtils.switchToTracingPerspective();
+ /* finish waiting for eclipse to load */
+ SWTBotUtils.waitForJobs();
+ }
+
+ /**
+ * Test Class teardown
+ */
+ @AfterClass
+ public static void terminate() {
+ fLogger.removeAllAppenders();
+ }
+
+ /**
+ * Creates a tracing projects
+ */
+ protected void createProject() {
+ SWTBotUtils.focusMainWindow(fBot.shells());
+ fBot.menu("File").menu("New").menu("Project...").click();
+
+ fBot.shell("New Project").setFocus();
+ SWTBotTree tree = fBot.tree();
+ assertNotNull(tree);
+ final String tracingKey = "Tracing";
+ fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(tracingKey, tree));
+ final SWTBotTreeItem tracingNode = tree.expandNode(tracingKey);
+
+ tracingNode.select();
+ final String projectKey = "Tracing Project";
+ fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(projectKey, tracingNode));
+ final SWTBotTreeItem tracingProject = tracingNode.getNode(projectKey);
+ assertNotNull(tracingProject);
+
+ tracingProject.select();
+ tracingProject.click();
+
+ SWTBotButton nextButton = fBot.button("Next >");
+ fBot.waitUntil(Conditions.widgetIsEnabled(nextButton));
+ nextButton.click();
+ fBot.shell("Tracing Project").setFocus();
+
+ final SWTBotText text = fBot.text();
+ text.setText(getProjectName());
+
+ fBot.button("Finish").click();
+ SWTBotUtils.waitForJobs();
+ }
+
+ /**
+ * Finishes the wizard
+ */
+ protected void importFinish() {
+ SWTBotShell shell = fBot.activeShell();
+ final SWTBotButton finishButton = fBot.button("Finish");
+ finishButton.click();
+ fBot.waitUntil(Conditions.shellCloses(shell));
+ SWTBotUtils.waitForJobs();
+ }
+
+ /**
+ * Gets the project Name
+ * @return the project name
+ */
+ protected abstract String getProjectName();
+
+ // ---------------------------------------------
+ // Helpers for testing views
+ // ---------------------------------------------
+
+ /**
+ * Verifies the properties view for a given view part
+ *
+ * @param vp
+ * a view part
+ */
+ protected void testPropertyView(IViewPart vp) {
+ PropertySheet pv = (PropertySheet) vp;
+ assertNotNull(pv);
+ }
+
+ /**
+ * Verifies the Histogram View
+ * @param vp
+ * the view part
+ * @param tmfEd
+ * the events editor
+ */
+ protected void testHistogramView(IViewPart vp, final TmfEventsEditor tmfEd) {
+ final CtfTmfEvent desiredEvent1 = getEvent(100);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ tmfEd.setFocus();
+ tmfEd.selectionChanged(new SelectionChangedEvent(tmfEd, new StructuredSelection(desiredEvent1)));
+ }
+ });
+
+ SWTBotUtils.waitForJobs();
+ SWTBotUtils.delay(1000);
+
+ final CtfTmfEvent desiredEvent2 = getEvent(10000);
+ SWTBotView hvBot = fBot.viewById(HistogramView.ID);
+ List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
+ for (SWTBotToolbarButton hvTool : hvTools) {
+ if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
+ hvTool.click();
+ }
+ }
+ HistogramView hv = (HistogramView) vp;
+ final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent1.getTimestamp());
+ final TmfSelectionRangeUpdatedSignal signal2 = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent2.getTimestamp());
+ hv.updateTimeRange(100000);
+ SWTBotUtils.waitForJobs();
+ hv.selectionRangeUpdated(signal);
+ hv.broadcast(signal);
+ SWTBotUtils.waitForJobs();
+ SWTBotUtils.delay(1000);
+
+ hv.updateTimeRange(1000000000);
+ SWTBotUtils.waitForJobs();
+ hv.selectionRangeUpdated(signal2);
+ hv.broadcast(signal2);
+ SWTBotUtils.waitForJobs();
+ SWTBotUtils.delay(1000);
+ assertNotNull(hv);
+ }
+
+ /**
+ * Verifies the statistics view
+ * @param vp
+ * the view part
+ */
+ protected void testStatisticsView(IViewPart vp) {
+ TmfStatisticsView sv = (TmfStatisticsView) vp;
+ assertNotNull(sv);
+ }
+
+ // ---------------------------------------------
+ // Trace helpers
+ // ---------------------------------------------
+
+ /**
+ * Gets an event at a given rank
+ * @param rank
+ * a rank
+ * @return the event at given rank
+ */
+ protected CtfTmfEvent getEvent(int rank) {
+ try (CtfTmfTrace trace = fTrace.getTrace()) {
+ ITmfContext ctx = trace.seekEvent(0);
+ for (int i = 0; i < rank; i++) {
+ trace.getNext(ctx);
+ }
+ return trace.getNext(ctx);
+ }
+ }
+
+ /**
+ * Gets a view part based on view title
+ * @param viewTile
+ * a view title
+ * @return the view part
+ */
+ protected IViewPart getViewPart(final String viewTile) {
+ final IViewPart[] vps = new IViewPart[1];
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
+ for (IViewReference viewRef : viewRefs) {
+ IViewPart vp = viewRef.getView(true);
+ if (vp.getTitle().equals(viewTile)) {
+ vps[0] = vp;
+ return;
+ }
+ }
+ }
+ });
+
+ return vps[0];
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * SWTBot test suite for tmf.ui
+ *
+ * @author Matthew Khouzam
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ ImportAndReadSmokeTest.class,
+ StandardImportAndReadSmokeTest.class,
+ TestInvalidCtfTrace.class
+})
+public class AllTests {
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle
+ * Bernd Hufmann - Extracted functionality to class AbstractImportAndReadSmokeTest
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
+import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * SWTBot Smoke test. base for other tests
+ *
+ * @author Matthew Khouzam
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class ImportAndReadSmokeTest extends AbstractImportAndReadSmokeTest {
+
+ private static final String TRACE_PROJECT_NAME = "test";
+
+ /**
+ * Main test case
+ */
+ @Test
+ public void test() {
+ createProject();
+
+ batchImportOpenWizard();
+ batchImportSelecTraceType();
+ batchImportAddDirectory();
+ batchImportSelectTrace();
+ importFinish();
+
+ TmfEventsEditor tmfEd = SWTBotUtils.openEditor(fBot, getProjectName(), new Path(TRACE_NAME));
+
+ testHistogramView(getViewPart("Histogram"), tmfEd);
+ testPropertyView(getViewPart("Properties"));
+ testStatisticsView(getViewPart("Statistics"));
+ fBot.closeAllEditors();
+
+ SWTBotUtils.deleteProject(getProjectName(), fBot);
+ }
+
+ private static void batchImportOpenWizard() {
+ fWizard = new BatchImportTraceWizard();
+
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ @Override
+ public void run() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ // Fire the Import Trace Wizard
+ if (workbench != null) {
+ final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ Shell shell = activeWorkbenchWindow.getShell();
+ assertNotNull(shell);
+ ((BatchImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
+ WizardDialog dialog = new WizardDialog(shell, fWizard);
+ dialog.open();
+ }
+ }
+ });
+
+ fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
+ }
+
+ private static void batchImportSelecTraceType() {
+ final SWTBotTree tree = fBot.tree();
+ final String ctfId = "Common Trace Format";
+ fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(ctfId, tree));
+ fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_TYPE_NAME, tree.getTreeItem(ctfId)));
+ tree.getTreeItem(ctfId).getNode(TRACE_TYPE_NAME).check();
+ batchImportClickNext();
+ }
+
+ private static void batchImportAddDirectory() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ ((BatchImportTraceWizard) fWizard).addFileToScan(fTrace.getPath());
+ }
+ });
+ final SWTBotButton removeButton = fBot.button("Remove");
+ fBot.waitUntil(Conditions.widgetIsEnabled(removeButton));
+ removeButton.click();
+ fBot.waitUntil(Conditions.tableHasRows(fBot.table(), 1));
+
+ batchImportClickNext();
+ }
+
+ private static void batchImportSelectTrace() {
+ SWTBotTree tree = fBot.tree();
+ fBot.waitUntil(Conditions.widgetIsEnabled(tree));
+ final SWTBotTreeItem genericCtfTreeItem = tree.getTreeItem(TRACE_TYPE_NAME);
+ fBot.waitUntil(Conditions.widgetIsEnabled(genericCtfTreeItem));
+ genericCtfTreeItem.expand();
+ genericCtfTreeItem.check();
+ batchImportClickNext();
+ }
+
+ private static void batchImportClickNext() {
+ IWizardPage currentPage = fWizard.getContainer().getCurrentPage();
+ IWizardPage desiredPage = fWizard.getNextPage(currentPage);
+ SWTBotButton nextButton = fBot.button("Next >");
+ nextButton.click();
+ fBot.waitUntil(ConditionHelpers.isWizardOnPage(fWizard, desiredPage));
+ }
+
+ @Override
+ protected String getProjectName() {
+ return TRACE_PROJECT_NAME;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014, 2015 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ * Marc-Andre Laperle - Added tests for extracting archives during import
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizard;
+import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizardPage;
+import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.Messages;
+import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
+import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement;
+import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
+import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
+import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
+import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * SWTBot Smoke test using ImportTraceWizard.
+ *
+ * @author Bernd Hufmann
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class StandardImportAndReadSmokeTest extends AbstractImportAndReadSmokeTest {
+
+ private static final String TRACE_FOLDER_PARENT_PATH = fTrace.getPath() + File.separator + ".." + File.separator + ".." + File.separator;
+ private static final String ARCHIVE_FILE_NAME = "synctraces.tar.gz";
+ private static final String TRACE_ARCHIVE_PATH = TRACE_FOLDER_PARENT_PATH + ARCHIVE_FILE_NAME;
+ private static final String TRACE_FOLDER_PARENT_NAME = "traces";
+ private static final String TRACE_PROJECT_NAME = "Tracing";
+
+ private static final String ARCHIVE_ROOT_ELEMENT_NAME = "/";
+ private static final String GENERATED_ARCHIVE_NAME = "testtraces.zip";
+ private static final String URI_SEPARATOR = "/";
+ private static final String URI_FILE_SCHEME = "file:";
+ private static final String URI_JAR_FILE_SCHEME = "jar:file:";
+ private static final boolean IS_WIN32 = System.getProperty("os.name").startsWith("Windows"); //$NON-NLS-1$//$NON-NLS-2$
+ private static final String URI_DEVICE_SEPARATOR = IS_WIN32 ? URI_SEPARATOR : "";
+
+ /**
+ * Test import from directory
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromDirectory() throws Exception {
+ testImport(0, false, false);
+ }
+
+ /**
+ * Test import from directory, create links
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromDirectoryLinks() throws Exception {
+ testImport(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE, false, false);
+ }
+
+ /**
+ * Test import from directory, preserve folder structure
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromDirectoryPreserveFolder() throws Exception {
+ testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false, false);
+ }
+
+ /**
+ * Test import from directory, create links, preserve folder structure
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromDirectoryLinksPreserveFolder() throws Exception {
+ int options = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
+ testImport(options, false, false);
+ }
+
+ /**
+ * Test import from directory, overwrite all
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromDirectoryOverwrite() throws Exception {
+ testImport(0, false, false);
+ testImport(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false, false);
+ }
+
+ /**
+ * Test import from archive
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromArchive() throws Exception {
+ testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, true, true);
+ }
+
+ /**
+ * Test import from directory, preserve folder structure
+ * @throws Exception on error
+ */
+ @Test
+ public void testImportFromArchivePreserveFolder() throws Exception {
+ testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false, true);
+ }
+
+ /**
+ * Test import from directory, overwrite all
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testImportFromArchiveOverwrite() throws Exception {
+ testImport(0, false, true);
+ testImport(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false, true);
+ }
+
+ /**
+ * Test import from directory containing archives
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testExtractArchivesFromDirectory() throws Exception {
+ testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false);
+ }
+
+ /**
+ * Test import from directory containing archives, create links
+ * @throws Exception on error
+ */
+ @Test
+ public void testExtractArchivesFromDirectoryLinks() throws Exception {
+ testImportAndExtractArchives(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false);
+ }
+
+ /**
+ * Test import from directory containing archives, create links, preserve folder structure
+ * @throws Exception on error
+ */
+ @Test
+ public void testExtractArchivesFromDirectoryLinksPreserveStruture() throws Exception {
+ testImportAndExtractArchives(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false);
+ }
+
+ /**
+ * Test import from archive containing archives
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testExtractArchivesFromArchive() throws Exception {
+ testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, true);
+ }
+
+ /**
+ * Test import from archive containing archives, preserve folder structure
+ *
+ * @throws Exception
+ * on error
+ */
+ @Test
+ public void testExtractArchivesFromArchivePreserveFolder() throws Exception {
+ testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, true);
+ }
+
+ private void testImport(int options, boolean testViews, boolean fromArchive) throws Exception {
+ createProject();
+ String expectedSourceLocation = null;
+ openImportWizard();
+ if (fromArchive) {
+ expectedSourceLocation = URI_JAR_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(TRACE_ARCHIVE_PATH).getCanonicalPath()) + "!" + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
+ selectImportFromArchive(TRACE_ARCHIVE_PATH);
+ selectFolder(ARCHIVE_ROOT_ELEMENT_NAME);
+ SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
+ assertFalse(checkBox.isEnabled());
+ } else {
+ String sourcePath = TRACE_FOLDER_PARENT_PATH + File.separator + TRACE_FOLDER + File.separator + TRACE_NAME;
+ expectedSourceLocation = URI_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(sourcePath).getCanonicalPath()) + URI_SEPARATOR;
+ selectImportFromDirectory(TRACE_FOLDER_PARENT_PATH);
+ selectFolder(new String [] {TRACE_FOLDER_PARENT_NAME, TRACE_FOLDER });
+ }
+
+ setOptions(options, ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
+ importFinish();
+
+ IPath expectedElementPath = new Path(TRACE_NAME);
+ if ((options & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) {
+ expectedElementPath = new Path(TRACE_FOLDER).append(expectedElementPath);
+ }
+
+ checkOptions(options, expectedSourceLocation, expectedElementPath);
+ TmfEventsEditor tmfEd = SWTBotUtils.openEditor(fBot, getProjectName(), expectedElementPath);
+ if (testViews) {
+ testViews(tmfEd);
+ }
+
+ fBot.closeAllEditors();
+
+ SWTBotUtils.deleteProject(getProjectName(), fBot);
+ }
+
+ private void testImportAndExtractArchives(int options, boolean fromArchive) throws Exception {
+ createProject();
+
+ String expectedSourceLocation;
+ IPath expectedElementPath;
+ if (fromArchive) {
+ String testArchivePath = createArchive();
+ openImportWizard();
+ selectImportFromArchive(testArchivePath);
+ selectFile(ARCHIVE_FILE_NAME, ARCHIVE_ROOT_ELEMENT_NAME, TRACE_PROJECT_NAME, TRACE_FOLDER_PARENT_NAME);
+
+ expectedSourceLocation = URI_JAR_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(testArchivePath).getCanonicalPath()) + "!" + URI_SEPARATOR + TRACE_PROJECT_NAME + URI_SEPARATOR + TRACE_FOLDER_PARENT_NAME + URI_SEPARATOR + ARCHIVE_FILE_NAME
+ + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
+ expectedElementPath = new Path(TRACE_PROJECT_NAME).append(TRACE_FOLDER_PARENT_NAME).append(ARCHIVE_FILE_NAME).append(TRACE_FOLDER).append(TRACE_NAME);
+ } else {
+ openImportWizard();
+ selectImportFromDirectory(TRACE_FOLDER_PARENT_PATH);
+ selectFile(ARCHIVE_FILE_NAME, TRACE_FOLDER_PARENT_NAME);
+ expectedElementPath = new Path(ARCHIVE_FILE_NAME).append(TRACE_FOLDER).append(TRACE_NAME);
+ expectedSourceLocation = URI_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(TRACE_FOLDER_PARENT_PATH).getCanonicalPath()) + URI_SEPARATOR + ARCHIVE_FILE_NAME + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
+ }
+
+ if ((options & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) == 0) {
+ expectedElementPath = new Path(TRACE_NAME);
+ }
+
+ setOptions(options, ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
+ importFinish();
+ // Archives should never be imported as links
+ int expectedOptions = options & ~ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
+ checkOptions(expectedOptions, expectedSourceLocation, expectedElementPath);
+
+ TmfEventsEditor editor = SWTBotUtils.openEditor(fBot, TRACE_PROJECT_NAME, expectedElementPath);
+ testViews(editor);
+
+ SWTBotUtils.deleteProject(getProjectName(), fBot);
+ }
+
+ /**
+ * Create a temporary archive containing a nested archive. For example,
+ * testtraces.zip/synctraces.tar.gz can be used to test a nested archive.
+ */
+ private String createArchive() throws URISyntaxException, CoreException, IOException {
+
+ // Link to the test traces folder. We use a link so that we can safely
+ // delete the entire project when we are done.
+ IProject project = getProjectResource();
+ String canonicalPath = new File(TRACE_FOLDER_PARENT_PATH).getCanonicalPath();
+ IFolder folder = project.getFolder(TRACE_FOLDER_PARENT_NAME);
+ folder.createLink(new Path(canonicalPath), IResource.REPLACE, null);
+
+ SWTBotTreeItem traceFilesProject = SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME);
+ traceFilesProject.contextMenu("Export...").click();
+
+ fBot.waitUntil(Conditions.shellIsActive("Export"));
+ SWTBotShell activeShell = fBot.activeShell();
+ SWTBotTree exportWizardsTree = fBot.tree();
+ SWTBotTreeItem treeItem = SWTBotUtils.getTreeItem(fBot, exportWizardsTree, "General", "Archive File");
+ treeItem.select();
+ fBot.button("Next >").click();
+ fBot.button("&Deselect All").click();
+ selectFile(ARCHIVE_FILE_NAME, TRACE_PROJECT_NAME, TRACE_FOLDER_PARENT_NAME);
+
+ String workspacePath = URIUtil.toFile(URIUtil.fromString(System.getProperty("osgi.instance.area"))).getAbsolutePath();
+ final String archiveDestinationPath = workspacePath + File.separator + TRACE_PROJECT_NAME + File.separator + GENERATED_ARCHIVE_NAME;
+ fBot.comboBox().setText(archiveDestinationPath);
+ fBot.button("&Finish").click();
+ fBot.waitUntil(Conditions.shellCloses(activeShell));
+ return archiveDestinationPath;
+ }
+
+ private void testViews(TmfEventsEditor editor) {
+ testHistogramView(getViewPart("Histogram"), editor);
+ testPropertyView(getViewPart("Properties"));
+ testStatisticsView(getViewPart("Statistics"));
+ }
+
+ private static void openImportWizard() {
+ fWizard = new ImportTraceWizard();
+
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ @Override
+ public void run() {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ // Fire the Import Trace Wizard
+ if (workbench != null) {
+ final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
+ Shell shell = activeWorkbenchWindow.getShell();
+ assertNotNull(shell);
+ ((ImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
+ WizardDialog dialog = new WizardDialog(shell, fWizard);
+ dialog.open();
+ }
+ }
+ });
+
+ fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
+ }
+
+ private static void selectImportFromDirectory(String directoryPath) {
+ SWTBotRadio button = fBot.radio("Select roo&t directory:");
+ button.click();
+
+ SWTBotCombo sourceCombo = fBot.comboBox();
+ File traceFolderParent = new File(directoryPath);
+ sourceCombo.setText(traceFolderParent.getAbsolutePath());
+
+ SWTBotText text = fBot.text();
+ text.setFocus();
+ }
+
+ private static void selectImportFromArchive(String archivePath) {
+ SWTBotRadio button = fBot.radio("Select &archive file:");
+ button.click();
+
+ SWTBotCombo sourceCombo = fBot.comboBox(1);
+
+ sourceCombo.setText(new File(archivePath).getAbsolutePath());
+
+ SWTBotText text = fBot.text();
+ text.setFocus();
+ }
+
+ private static void selectFolder(String... treePath) {
+ SWTBotTree tree = fBot.tree();
+ fBot.waitUntil(Conditions.widgetIsEnabled(tree));
+ SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(fBot, tree, treePath);
+ folderNode.check();
+ }
+
+ private static void selectFile(String fileName, String... folderTreePath) {
+ SWTBotTree folderTree = fBot.tree();
+ fBot.waitUntil(Conditions.widgetIsEnabled(folderTree));
+ SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(fBot, folderTree, folderTreePath);
+ folderNode.select();
+
+ SWTBotTable fileTable = fBot.table();
+ fBot.waitUntil(Conditions.widgetIsEnabled(fileTable));
+ fBot.waitUntil(ConditionHelpers.isTableItemAvailable(fileName, fileTable));
+ SWTBotTableItem tableItem = fileTable.getTableItem(fileName);
+ tableItem.check();
+ }
+
+ private static void setOptions(int optionFlags, String traceTypeName) {
+ SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
+ if (checkBox.isEnabled()) {
+ if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0) {
+ checkBox.select();
+ } else {
+ checkBox.deselect();
+ }
+ }
+
+ checkBox = fBot.checkBox(Messages.ImportTraceWizard_PreserveFolderStructure);
+ if ((optionFlags & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) {
+ checkBox.select();
+ } else {
+ checkBox.deselect();
+ }
+
+ checkBox = fBot.checkBox(Messages.ImportTraceWizard_ImportUnrecognized);
+ if ((optionFlags & ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES) != 0) {
+ checkBox.select();
+ } else {
+ checkBox.deselect();
+ }
+
+ checkBox = fBot.checkBox(Messages.ImportTraceWizard_OverwriteExistingTrace);
+ if ((optionFlags & ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES) != 0) {
+ checkBox.select();
+ } else {
+ checkBox.deselect();
+ }
+
+ SWTBotCombo comboBox = fBot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
+ if (traceTypeName != null && !traceTypeName.isEmpty()) {
+ comboBox.setSelection(traceTypeName);
+ } else {
+ comboBox.setSelection(ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
+ }
+ }
+
+ private void checkOptions(int optionFlags, String expectedSourceLocation, IPath expectedElementPath) throws CoreException {
+ IProject project = getProjectResource();
+ assertTrue(project.exists());
+ TmfProjectElement tmfProject = TmfProjectRegistry.getProject(project, true);
+ assertNotNull(tmfProject);
+ TmfTraceFolder tracesFolder = tmfProject.getTracesFolder();
+ assertNotNull(tracesFolder);
+ List<TmfTraceElement> traces = tracesFolder.getTraces();
+ assertFalse(traces.isEmpty());
+ Collections.sort(traces, new Comparator<TmfTraceElement>() {
+ @Override
+ public int compare(TmfTraceElement arg0, TmfTraceElement arg1) {
+ return arg0.getElementPath().compareTo(arg1.getElementPath());
+ }
+ });
+
+ TmfTraceElement tmfTraceElement = traces.get(0);
+ IResource traceResource = tmfTraceElement.getResource();
+
+ assertEquals((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0, traceResource.isLinked());
+
+ // i.e. /Tracing/Traces
+ IPath expectedPath = Path.ROOT.append(new Path(TRACE_PROJECT_NAME)).append(TmfTracesFolder.TRACES_FOLDER_NAME).append(expectedElementPath);
+ assertEquals(expectedPath, traceResource.getFullPath());
+
+ String sourceLocation = traceResource.getPersistentProperty(TmfCommonConstants.SOURCE_LOCATION);
+ assertNotNull(sourceLocation);
+ assertEquals(expectedSourceLocation, sourceLocation);
+ }
+
+ @Override
+ protected String getProjectName() {
+ return TRACE_PROJECT_NAME;
+ }
+
+ private IProject getProjectResource() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2015 Ericsson
+ *
+ * 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:
+ * Matthew Khouzam - Initial API and implementation
+ * Patrick Tasse - Fix editor handling
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
+
+import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertContains;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Logger;
+import org.apache.log4j.SimpleLayout;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test invalid trace openning
+ *
+ * @author Matthew Khouzam
+ */
+@RunWith(Parameterized.class)
+public class TestInvalidCtfTrace {
+
+ private static final String PROJET_NAME = "TestInvalidCtfTraces";
+ private static final Path BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces", "ctf-testsuite", "tests", "1.8");
+
+ /** The Log4j logger instance. */
+ private static final Logger fLogger = Logger.getRootLogger();
+
+ private static SWTWorkbenchBot fBot;
+
+ private final File fLocation;
+
+ private final String fExpectedMessage;
+
+ private static final Map<String, String> ERRORS = new HashMap<>();
+ static {
+ // metadata
+ ERRORS.put("array-redefinition", "MismatchedTokenException(57!=72)");
+ ERRORS.put("array-size-identifier", "Is not an integer: x");
+ ERRORS.put("array-size-keyword", "NoViableAltException(75@[])");
+ ERRORS.put("array-size-negative", "Array length is negative");
+ ERRORS.put("array-size-not-present", "NoViableAltException(14@[])");
+ ERRORS.put("array-size-string", "Is not an integer: x");
+ ERRORS.put("array-size-type-field", "Is not an integer: uint32_t");
+ ERRORS.put("array-size-type", "Is not an integer: uint32_t");
+ ERRORS.put("integer-encoding-as-string", "Invalid value for encoding");
+ ERRORS.put("integer-encoding-invalid", "Invalid value for encoding");
+ ERRORS.put("integer-negative-bit-size", "Invalid value for size");
+ ERRORS.put("integer-range", "Invalid integer format: 23452397856348975623897562893746589237465289374658923764598237645897234658723648579236");
+ ERRORS.put("integer-signed-as-string", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
+ ERRORS.put("integer-signed-invalid", "Invalid boolean value svp");
+ ERRORS.put("integer-size-as-string", "Invalid value for size");
+ ERRORS.put("integer-size-missing", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
+ ERRORS.put("struct-align-enum", "Invalid value for alignment");
+ ERRORS.put("struct-align-huge", "Invalid integer format: 0xFFFFFFFFU");
+ ERRORS.put("struct-align-negative", "Invalid value for alignment : -8");
+ ERRORS.put("struct-align-string", "Invalid value for alignment");
+ ERRORS.put("struct-align-zero", "Invalid value for alignment : 0");
+ ERRORS.put("struct-duplicate-field-name", "Identifier has already been defined:xxx");
+ ERRORS.put("struct-duplicate-struct-name", "struct a already defined.");
+ ERRORS.put("struct-field-name-keyword", "NoViableAltException(73@[])");
+ // streams
+ ERRORS.put("content-size-larger-than-packet-size", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-alignment-empty-struct", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-alignment-integer", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-array-of-integers", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-float", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-integer", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-len-of-sequence", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-sequence-between-elements", "UNKNOWN"); //FIXME
+ ERRORS.put("cross-packet-event-sequence-start", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-empty-event-with-aligned-struct", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-float", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-integer", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-large-sequence-length", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-len-of-sequence", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-packet-header", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-sequence-between-elements", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-sequence-start", "UNKNOWN"); //FIXME
+ ERRORS.put("out-of-bound-sequence-within-element", "UNKNOWN"); //FIXME
+
+ }
+
+ /**
+ * Populate the parameters
+ *
+ * @return the parameters. Basically all the errors with lookuped paths
+ */
+ @Parameters(name = "{index}: {0}")
+ public static Iterable<Object[]> getTracePaths() {
+ final List<Object[]> dirs = new LinkedList<>();
+
+ FileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+ final Path fileName = dir.getFileName();
+ String res = ERRORS.get(fileName.toString());
+ if (res != null) {
+ dirs.add(new Object[] { dir.toFile(), res });
+ return FileVisitResult.SKIP_SUBTREE;
+ }
+ return FileVisitResult.CONTINUE;
+ }
+
+ };
+ /* TODO: add way of handling an error in a trace during a run */
+ /* when that is done, we can add regression/stream/fail */
+
+ Path badMetadata = BASE_PATH.resolve(Paths.get("regression", "metadata", "fail"));
+ try {
+ Files.walkFileTree(badMetadata, visitor);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return dirs;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param location
+ * trace file
+ * @param errorMessage
+ * error message
+ */
+ public TestInvalidCtfTrace(File location, String errorMessage) {
+ fLocation = location;
+ fExpectedMessage = errorMessage;
+ }
+
+ /**
+ * Initialization
+ */
+ @Before
+ public void init() {
+ SWTBotUtils.failIfUIThread();
+ Thread.currentThread().setName("SWTBot Thread"); // for the debugger
+ /* set up for swtbot */
+ SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
+ fLogger.removeAllAppenders();
+ fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
+ fBot = new SWTWorkbenchBot();
+
+ SWTBotUtils.closeView("welcome", fBot);
+
+ SWTBotUtils.switchToTracingPerspective();
+ /* finish waiting for eclipse to load */
+ SWTBotUtils.waitForJobs();
+ SWTBotUtils.createProject(PROJET_NAME);
+
+ }
+
+ /**
+ * Delete file
+ */
+ @After
+ public void cleanup() {
+ SWTBotUtils.deleteProject(PROJET_NAME, fBot);
+ fLogger.removeAllAppenders();
+ }
+
+ /**
+ * Open an invalid trace and see the message
+ */
+ @Test
+ public void testOpen() {
+ SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME);
+ SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.ui.type.ctf");
+ fBot.waitUntil(Conditions.shellIsActive("Open Trace"));
+ final SWTBotShell shell = fBot.activeShell();
+ final SWTBot dialogBot = shell.bot();
+ String text = dialogBot.label(1).getText();
+ dialogBot.button().click();
+ fBot.waitUntil(Conditions.shellCloses(shell));
+ assertContains(fExpectedMessage, text);
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tracecompass.tmf.ctf</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null
+eclipse.preferences.version=1
+line.separator=\n
--- /dev/null
+###############################################################################
+# Copyright (c) 2013, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+bin.includes = feature.xml,\
+ feature.properties,\
+ p2.inf
+src.includes = sourceTemplateFeature/p2.inf
--- /dev/null
+###############################################################################
+# Copyright (c) 2009, 2015 Ericsson
+#
+# 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:
+# Ericsson - Initial API and implementation
+###############################################################################
+
+featureName=CTF (Common Trace Format) Analysis
+
+description=Plug-ins to add support for reading and analyzing traces in the \
+Common Trace Format (CTF) to the Tracing and Monitoring Framework (TMF).
+
+featureProvider=Eclipse Trace Compass
+
+copyright=Copyright 2015 Ericsson
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- For PDE build, remove "ws" and "arch" -->
+<feature
+ id="org.eclipse.tracecompass.tmf.ctf"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%featureProvider"
+ license-feature="org.eclipse.license"
+ license-feature-version="0.0.0">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.tracecompass.tmf"
+ version="0.0.0"
+ name="Tracing and Monitoring Framework (TMF)"/>
+
+ <includes
+ id="org.eclipse.tracecompass.ctf"
+ version="0.0.0"
+ name="Common Trace Format (CTF)"/>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.tracecompass.ctf.core" version="1.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.tracecompass.tmf.core" version="1.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.tracecompass.tmf.ui" version="1.0.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.help"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.tracecompass.tmf.ctf.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
--- /dev/null
+update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.tmf.ctf.feature.group' || pc.name == 'org.eclipse.tracecompass.tmf.ctf.feature.group'))
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2011, Red Hat, Inc.
+
+ 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
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.tmf.ctf</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+
+ <name>CTF support for TMF Feature</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho.extras</groupId>
+ <artifactId>tycho-source-feature-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>source-feature</id>
+ <phase>package</phase>
+ <goals>
+ <goal>source-feature</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>attached-p2-metadata</id>
+ <phase>package</phase>
+ <goals>
+ <goal>p2-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.tmf.ctf.source.feature.group' || pc.name == 'org.eclipse.tracecompass.tmf.ctf.source.feature.group'))
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2015, Ericsson, EfficiOS 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
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <prerequisites>
+ <maven>3.0</maven>
+ </prerequisites>
+
+ <parent>
+ <artifactId>org.eclipse.tracecompass</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.tracecompass.ctf-parent</artifactId>
+ <groupId>org.eclipse.tracecompass</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Trace Compass CTF Support Parent</name>
+
+ <modules>
+ <module>org.eclipse.tracecompass.ctf</module>
+ <module>org.eclipse.tracecompass.ctf.core</module>
+ <module>org.eclipse.tracecompass.ctf.core.tests</module>
+ <module>org.eclipse.tracecompass.ctf.parser</module>
+ <module>org.eclipse.tracecompass.ctf.parser.tests</module>
+
+ <module>org.eclipse.tracecompass.tmf.ctf</module>
+ <module>org.eclipse.tracecompass.tmf.ctf.core</module>
+ <module>org.eclipse.tracecompass.tmf.ctf.core.tests</module>
+ <module>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</module>
+ </modules>
+
+</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="perf"/>
- <classpathentry kind="src" path="shared"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.ctf.core.tests</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=2
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.ctf.core.tests;singleton:=true
-Bundle-Activator: org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.junit;bundle-version="4.0.0",
- org.eclipse.core.runtime;bundle-version="3.8.0",
- org.eclipse.tracecompass.ctf.core,
- org.eclipse.tracecompass.common.core
-Export-Package: org.eclipse.tracecompass.ctf.core.tests;x-friends:="org.eclipse.tracecompass.alltests",
- org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;x-internal:=true,
- org.eclipse.tracecompass.ctf.core.tests.event;x-internal:=true,
- org.eclipse.tracecompass.ctf.core.tests.io;x-internal:=true,
- org.eclipse.tracecompass.ctf.core.tests.perf,
- org.eclipse.tracecompass.ctf.core.tests.perf.trace;x-internal:=true,
- org.eclipse.tracecompass.ctf.core.tests.scope,
- org.eclipse.tracecompass.ctf.core.tests.shared,
- org.eclipse.tracecompass.ctf.core.tests.synthetictraces;x-friends:="org.eclipse.tracecompass.tmf.remote.ui.swtbot.tests",
- org.eclipse.tracecompass.ctf.core.tests.trace;x-internal:=true,
- org.eclipse.tracecompass.ctf.core.tests.types;x-internal:=true
-Import-Package: com.google.common.collect,
- org.antlr.runtime;version="3.2.0",
- org.eclipse.test.performance
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = shared,\
- src/,\
- perf/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- traces/get-traces.xml,\
- about.html
-src.includes = about.html
-additional.bundles = org.eclipse.jdt.annotation
-jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial implementation and API
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.perf;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Run all performance test suites.
- *
- * @author Alexandre Montplaisir
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.ctf.core.tests.perf.trace.AllPerfTests.class
-})
-public class AllPerfTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CTFTraceCallsitePerformanceTest.class,
- TraceReadBenchmark.class,
- TraceSeekBenchmark.class
-})
-public class AllPerfTests {
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Random;
-import java.util.TreeSet;
-
-import org.eclipse.test.performance.Dimension;
-import org.eclipse.test.performance.Performance;
-import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test the performance of the callsite storage in the CTF trace.
- *
- * @author Matthew Khouzam
- */
-public class CTFTraceCallsitePerformanceTest {
-
- private static final String TEST_SUITE_NAME = "CTF Callsite Benchmark";
- private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private static final int NUMBER_OF_SEEKS = 100000;
-
- private final String[] callsites = { "Alligator", "Bunny", "Cat",
- "Dolphin", "Echidna", "Gazelle", "Heron", "Ibex", "Jackalope",
- "Koala", "Lynx", "Meerkat", "Narwhal", "Ocelot", "Pangolin",
- "Quetzal", "Ringtail", "Sandpiper", "Tiger", "Urchin", "Vulture",
- "Walrus", "X-Ray Tetra", "Zonkey" };
-
- private final String[] functions = { "sentence", "together", "children",
- "mountain", "chipmunk", "crashing", "drinking", "insisted",
- "insulted", "invented", "squinted", "standing", "swishing",
- "talented", "whiplash", "complain", "granddad", "sprinkle",
- "surprise", "umbrella", "anything", "anywhere", "baseball",
- "birthday", "bluebird", "cheerful", "colorful", "daylight",
- "doghouse", "driveway", "everyone" };
-
- private final String[] files = { "Adult.java", "Aeroplane.java",
- "Air.java", "Airforce.java", "Airport.java", "Album.java",
- "Alphabet.java", "Apple.java", "Arm.java", "Army.java", "Babby.java" };
-
- Random rnd = new Random();
- CTFTrace fTrace = null;
-
- /**
- * main, launches the tests.
- *
- * @param args
- * not read
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(CTFTraceCallsitePerformanceTest.class);
- }
-
- /**
- * sets up the test by making a new trace.
- *
- * @throws CTFException
- * an exception from the reader
- * @throws SecurityException
- * an exception from accessing files illegally
- * @throws IllegalArgumentException
- * an exception for passing bad values
- */
- @Before
- public void setup() throws CTFException, SecurityException,
- IllegalArgumentException {
- assumeTrue(testTrace.exists());
- fTrace = new CTFTrace(testTrace.getPath());
- }
-
- private void addCallsites(int numCallsites) {
- long stepSize = (Long.MAX_VALUE / (numCallsites + 1));
- int jitter = (int) Math.min(stepSize, Integer.MAX_VALUE);
- for (int i = 0; i < numCallsites; i++) {
- final long ip = ((i)) * stepSize + rnd.nextInt(jitter);
- fTrace.addCallsite(getRandomElement(callsites),
- getRandomElement(functions), ip, getRandomElement(files),
- (ip / 1000000) * 100);
- }
- }
-
- private String getRandomElement(String[] array) {
- return array[rnd.nextInt(array.length)];
- }
-
- private void testMain(PerformanceMeter pm) {
- TreeSet<CTFCallsite> l = fTrace.getCallsiteCandidates(callsites[0]);
- CTFCallsite cs = fTrace.getCallsite(1);
- CTFCallsite cs1 = fTrace.getCallsite(callsites[0]);
- CTFCallsite cs2 = fTrace.getCallsite(callsites[0], 1);
- assertNotNull(l);
- assertNotNull(cs);
- assertNotNull(cs1);
- assertNotNull(cs2);
- /* performance test */
- pm.start();
- perfTest();
- pm.stop();
- }
-
- /**
- * @param callsiteSize
- */
- private void test(int callsiteSize) {
- String testName = "Test" + callsiteSize + " callsites";
- addCallsites(callsiteSize);
- Performance perf = Performance.getDefault();
- PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
- perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + callsiteSize + " callsites", Dimension.CPU_TIME);
- testMain(pm);
- pm.commit();
- }
-
- private void perfTest() {
- for (int i = 0; i < NUMBER_OF_SEEKS; i++) {
- fTrace.getCallsite((((long) rnd.nextInt()) << 16L));
- }
- }
-
- /**
- * Test seeks with 1000 callsites
- */
- @Test
- public void test1KCallsites() {
-
- test(1000);
- }
-
- /**
- * Test seeks with 2000 callsites
- */
- @Test
- public void test2KCallsites() {
- test(2000);
- }
-
- /**
- * Test seeks with 5000 callsites
- */
- @Test
- public void test5KCallsites() {
- test(5000);
- }
-
- /**
- * Test seeks with 10000 callsites
- */
- @Test
- public void test10KCallsites() {
- test(10000);
- }
-
- /**
- * Test seeks with 20000 callsites
- */
- @Test
- public void test20KCallsites() {
- test(20000);
- }
-
- /**
- * Test seeks with 50000 callsites
- */
- @Test
- public void test50KCallsites() {
- test(50000);
- }
-
- /**
- * Test seeks with 100000 callsites
- */
- @Test
- public void test100KCallsites() {
- test(100000);
- }
-
- /**
- * Test seeks with 1000000 callsites
- */
- @Test
- public void test1MCallsites() {
- test(1000000);
- }
-
- /**
- * Test seeks with 2000000 callsites
- */
- @Test
- public void test2MCallsites() {
- test(2000000);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Convert to a org.eclipse.test.performance test
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
-
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.test.performance.Dimension;
-import org.eclipse.test.performance.Performance;
-import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Test;
-
-/**
- * Benchmark of the CTF parser for reading a trace
- *
- * @author Matthew Khouzam
- * @author Alexandre Montplaisir
- */
-public class TraceReadBenchmark {
-
- private static final String TEST_SUITE_NAME = "CTF Read Benchmark";
- private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
- private static final int LOOP_COUNT = 100;
-
- /**
- * Benchmark reading the trace "kernel"
- */
- @Test
- public void testKernelTrace() {
- readTrace(CtfTestTrace.KERNEL, "trace-kernel", true);
- }
-
- /**
- * Benchmark reading the bigger trace "kernel_vm"
- */
- @Test
- public void testKernelVmTrace() {
- readTrace(CtfTestTrace.KERNEL_VM, "trace-kernel-vm", false);
- }
-
- private static void readTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) {
- assumeTrue(testTrace.exists());
-
- Performance perf = Performance.getDefault();
- PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
- perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
-
- if (inGlobalSummary) {
- perf.tagAsGlobalSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
- }
-
- for (int loop = 0; loop < LOOP_COUNT; loop++) {
- pm.start();
- try {
- CTFTrace trace = testTrace.getTrace();
- try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
-
- while (traceReader.hasMoreEvents()) {
- EventDefinition ed = traceReader.getCurrentEventDef();
- /* Do something with the event */
- ed.getCPU();
- traceReader.advance();
- }
- }
- } catch (CTFException e) {
- /* Should not happen if assumeTrue() passed above */
- fail("Test failed at iteration " + loop + ':' + e.getMessage());
- }
- pm.stop();
- }
- pm.commit();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Convert to a org.eclipse.test.performance test
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.perf.trace;
-
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Random;
-
-import org.eclipse.test.performance.Dimension;
-import org.eclipse.test.performance.Performance;
-import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Test;
-
-/**
- * Tests for performance regressions of the ctf reader. It only tests the ctf
- * reader, not tmf. <br>
- * This test runs in 3 passes.
- * <ul>
- * <li>first it opens a trace</li>
- * <li>then it reads the trace completely</li>
- * <li>then it randomly (seeded) seeks NB_SEEKS locations in the trace and reads
- * one event at each position.</li>
- * </ul>
- *
- * @author Matthew Khouzam
- * @author Alexandre Montplaisir
- */
-public class TraceSeekBenchmark {
-
- private static final Random RND = new Random(1000);
-
- private static final int LOOP_COUNT = 25;
- private static final int NB_SEEKS = 500;
- private static final String TEST_SUITE_NAME = "CTF Read & Seek Benchmark (" + NB_SEEKS + " seeks)";
- private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
-
- /**
- * Run the benchmark scenario for the trace "kernel"
- *
- * @throws CTFException
- * Should not happen
- */
- @Test
- public void testKernelTrace() throws CTFException {
- readAndSeekTrace(CtfTestTrace.KERNEL, "trace-kernel", true);
- }
-
- private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) throws CTFException {
- assumeTrue(testTrace.exists());
-
- Performance perf = Performance.getDefault();
- PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + '#' + testName);
- perf.tagAsSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
-
- if (inGlobalSummary) {
- perf.tagAsGlobalSummary(pm, TEST_SUITE_NAME + ':' + testName, Dimension.CPU_TIME);
- }
-
- for (int loop = 0; loop < LOOP_COUNT; loop++) {
- CTFTrace trace = testTrace.getTrace();
- try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
-
- /* Read the whole trace to find out the start and end times */
- EventDefinition firstEvent = traceReader.getCurrentEventDef();
- final long startTime = firstEvent.getTimestamp();
- long endTime = startTime;
- while (traceReader.hasMoreEvents()) {
- EventDefinition ev = traceReader.getCurrentEventDef();
- endTime = ev.getTimestamp();
- traceReader.advance();
- }
-
- /* Generate the timestamps we will seek to */
- List<Long> seekTimestamps = new LinkedList<>();
- final long range = endTime - startTime;
- for (int i = 0; i < NB_SEEKS; i++) {
- long delta = (RND.nextLong() % range);
- if (delta < 0) {
- delta += range;
- }
- seekTimestamps.add(startTime + delta);
- }
-
- /* Benchmark seeking to the generated timestamps */
- pm.start();
- for (Long ts : seekTimestamps) {
- traceReader.seek(ts);
- traceReader.advance();
- }
- pm.stop();
-
- } catch (CTFException e) {
- /* Should not happen if assumeTrue() passed above */
- fail("Test failed at iteration " + loop + ':' + e.getMessage());
- }
- }
- pm.commit();
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-#Properties file for org.eclipse.tracecompass.ctf.core.tests
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = Trace Compass CTF Core Tests Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2014 Ericsson
-
- 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
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <name>Trace Compass CTF Core Tests Plug-in</name>
- <groupId>org.eclipse.tracecompass</groupId>
- <artifactId>org.eclipse.tracecompass.ctf.core.tests</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <properties>
- <ctfTestSuiteCommit>0f8beba86ae551f42adeb81d1bfddd5645f31013</ctfTestSuiteCommit>
- </properties>
-
- <!-- Do not download the test traces if "maven.test.skip" is set -->
- <profiles>
- <profile>
- <id>download-traces</id>
- <activation>
- <property>
- <name>!maven.test.skip</name>
- </property>
- </activation>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <id>prepare</id>
- <phase>pre-integration-test</phase>
- <configuration>
- <target>
- <property name="ctf-test-suite-commit" value="${ctfTestSuiteCommit}"/>
- <ant antfile="get-traces.xml" dir="traces" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>**/AllCtfCoreTests.*</include>
- </includes>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <product>org.eclipse.platform.ide</product>
- </configuration>
- </plugin>
-
- <!-- We don't use the ant file to clean because of http://jira.codehaus.org/browse/MANTRUN-78 -->
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.6.1</version>
- <executions>
- <execution>
- <id>clean-traces</id>
- <phase>clean</phase>
- <configuration>
- <filesets>
- <fileset><directory>traces/ctf-testsuite</directory></fileset>
- <fileset><directory>traces/cyg-profile</directory></fileset>
- <fileset><directory>traces/django-benchmark</directory></fileset>
- <fileset><directory>traces/funky_trace</directory></fileset>
- <fileset><directory>traces/hello-lost</directory></fileset>
- <fileset><directory>traces/kernel</directory></fileset>
- <fileset><directory>traces/kernel_vm</directory></fileset>
- <fileset><directory>traces/synctraces</directory></fileset>
- <fileset><directory>traces/synthetic-trace</directory></fileset>
- <fileset><directory>traces/trace2</directory></fileset>
- <fileset><directory>traces/exp</directory></fileset>
- <fileset><directory>traces/flipping-endianness</directory></fileset>
- </filesets>
- </configuration>
- <goals>
- <goal>clean</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.shared;
-
-import java.io.File;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.tests.synthetictraces.LttngKernelTraceGenerator;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-
-/**
- * Here is the list of the available test traces for the CTF parser.
- *
- * Make sure you run the traces/get-traces.xml Ant script to download them
- * first!
- *
- * @author Alexandre Montplaisir
- */
-public enum CtfTestTrace {
- /**
- * Example kernel trace
- *
- * <pre>
- * Trace Size: 13 MB
- * Tracer: lttng-modules 2.0.0
- * Event count: 695 319
- * Kernel version: 3.0.0-16-generic-pae
- * Trace length: 10s
- * </pre>
- */
- KERNEL("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel", 695319, 10),
-
- /**
- * Another kernel trace
- *
- * <pre>
- * Trace Size: 14 MB
- * Tracer: lttng-modules 2.0.0
- * Event count: 595 641
- * Kernel version: 3.2.0-18-generic
- * Trace length: 11s
- * </pre>
- */
- TRACE2("../org.eclipse.tracecompass.ctf.core.tests/traces/trace2", 595641, 11),
-
- /**
- * Kernel trace with event contexts: pid, ppid, tid, procname,
- * perf_page_fault, perf_major_faults, perf_minor_faults
- *
- * <pre>
- * Trace Size: 56 MB
- * Tracer: lttng-modules 2.1.0
- * Event count: 714 484
- * Kernel version: 3.8.1
- * Trace length: 29s
- * </pre>
- */
- KERNEL_VM("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel_vm", 714484, 29),
-
- /**
- * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
- * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
- * events. Can be used along with {@link CtfTestTrace#SYNC_DEST} for trace
- * synchronization.
- *
- * <pre>
- * Trace Size: 2.4 MB
- * Tracer: lttng-modules 2.1.0
- * Event count: 110 771
- * Kernel version: 3.6.11-1-ARCH
- * Trace length: 23s
- * </pre>
- */
- SYNC_SRC("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_src", 110771, 23),
-
- /**
- * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
- * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
- * events. Can be used along with {@link CtfTestTrace#SYNC_SRC} for trace
- * synchronization.
- *
- * <pre>
- * Trace Size: 1.9 MB
- * Tracer: lttng-modules 2.1.0
- * Event count: 85 729
- * Kernel version: 3.6.11-1-ARCH
- * Trace length: 17s
- * </pre>
- */
- SYNC_DEST("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_dest", 85729, 17),
-
- /**
- * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
- * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
- * be used along with {@link CtfTestTrace#DJANGO_DB} and
- * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
- *
- * <pre>
- * Trace Size: 33 MB
- * Tracer: lttng-modules 2.4.0
- * Event count: 754 787
- * Kernel version: 3.13.0-24-generic
- * Trace length: 15s
- * </pre>
- */
- DJANGO_CLIENT("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-client", 754787, 15),
-
- /**
- * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
- * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
- * be used along with {@link CtfTestTrace#DJANGO_CLIENT} and
- * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
- *
- * <pre>
- * Trace Size: 28 MB
- * Tracer: lttng-modules 2.4.0
- * Event count: 692 098
- * Kernel version: 3.13.0-24-generic
- * Trace length: 14s
- * </pre>
- */
- DJANGO_DB("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-db", 692098, 14),
-
- /**
- * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
- * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
- * be used along with {@link CtfTestTrace#DJANGO_DB} and
- * {@link CtfTestTrace#DJANGO_CLIENT} for trace synchronization.
- *
- * <pre>
- * Trace Size: 31 MB
- * Tracer: lttng-modules 2.4.0
- * Event count: 779 096
- * Kernel version:3.13.0-24-generic
- * Trace length: 13s
- * </pre>
- */
- DJANGO_HTTPD("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-httpd", 779096, 13),
-
- /**
- * UST trace with lots of lost events
- *
- * <pre>
- * Trace Size: 3.4 MB
- * Tracer: lttng-ust 2.3
- * Event count: 1 000 000, with 967 700 lost events
- * Trace length: 279ms
- * </pre>
- */
- HELLO_LOST("../org.eclipse.tracecompass.ctf.core.tests/traces/hello-lost", 1000000, 0),
-
- /**
- * UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions)
- *
- * <pre>
- * Trace Size: 236 KB
- * Tracer: lttng-ust 2.3
- * Event count: 4 977
- * Trace length: 10s
- * </pre>
- */
- CYG_PROFILE("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile", 4977, 10),
-
- /**
- * UST trace with lttng-ust-cyg-profile-fast events (no address in
- * func_exit)
- *
- * <pre>
- * Trace Size: 184 KB
- * Tracer: lttng-ust 2.3
- * Event count: 5 161
- * Trace length: 11s
- * </pre>
- */
- CYG_PROFILE_FAST("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast", 5161, 11),
-
- /** Autogenerated Syntetic trace */
- SYNTHETIC_TRACE(LttngKernelTraceGenerator.getPath(), -1, -1),
-
- /** Trace with non-standard field sizes */
- FUNKY_TRACE("../org.eclipse.tracecompass.ctf.core.tests/traces/funky_trace", 100002, 0),
-
- /**
- * Kernel Trace with 64 bit aligned headers
- *
- * <pre>
- * Trace Size: 1.1 MB
- * Tracer: lttng-kernel 2.5
- * Event count: 31 556
- * Trace length: 6 s
- * </pre>
- */
- ARM_64_BIT_HEADER("../org.eclipse.tracecompass.ctf.core.tests/traces/bug446190", 31556, 6),
-
- /**
- * Kernel Trace with flipping endianness
- *
- * <pre>
- * Trace Size: 327 KB
- * Tracer: lttng-kernel 2.5
- * Event count: 14 310
- * Trace length: 41 s
- * </pre>
- */
- FLIPPING_ENDIANNESS("../org.eclipse.tracecompass.ctf.core.tests/traces/flipping-endianness", 14310, 41),
-
- /** Set of many traces, do not call getTrace */
- TRACE_EXPERIMENT("../org.eclipse.tracecompass.ctf.core.tests/traces/exp", -1, -1);
-
- private final String fPath;
- private CTFTrace fTrace = null;
- private CTFTrace fTraceFromFile = null;
- private final int fNbEvent;
- private int fDuration;
-
- private CtfTestTrace(String path, int nbEvent, int time) {
- fPath = path;
- fNbEvent = nbEvent;
- fDuration = time;
- }
-
- /** @return The path to the test trace */
- public String getPath() {
- return fPath;
- }
-
- /**
- * Get the number of events for a trace
- *
- * @return the number of events, -1 if irrelevant
- */
- public int getNbEvents() {
- return fNbEvent;
- }
-
- /**
- * Get the duration in seconds of a trace
- *
- * @return the duration in seconds of a trace, -1 if irrelevant
- */
- public int getDuration() {
- return fDuration;
- }
-
- /**
- * Get a CTFTrace instance of a test trace. Make sure {@link #exists()}
- * before calling this!
- *
- * @return The CTFTrace object
- * @throws CTFException
- * If the trace cannot be found.
- */
- public CTFTrace getTrace() throws CTFException {
- if (fTrace == null) {
- fTrace = new CTFTrace(fPath);
- }
- return fTrace;
- }
-
- /**
- * Get a CTFTrace instance created from a File. Make sure {@link #exists()}
- * before calling this!
- *
- * @return The CTFTrace object
- * @throws CTFException
- * If the trace cannot be found.
- */
- public CTFTrace getTraceFromFile() throws CTFException {
- if (fTraceFromFile == null) {
- fTraceFromFile = new CTFTrace(new File(fPath));
- }
- return fTraceFromFile;
- }
-
- /**
- * Check if this test trace actually exists on disk.
- *
- * @return If the trace exists
- */
- public boolean exists() {
- try {
- getTrace();
- } catch (CTFException e) {
- return false;
- }
- return true;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version 1.0
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfCorePluginTest.class,
- org.eclipse.tracecompass.ctf.core.tests.ctftestsuite.TestAll.class,
- org.eclipse.tracecompass.ctf.core.tests.event.TestAll.class,
- org.eclipse.tracecompass.ctf.core.tests.io.TestAll.class,
- org.eclipse.tracecompass.ctf.core.tests.scope.TestAll.class,
- org.eclipse.tracecompass.ctf.core.tests.trace.TestAll.class,
- org.eclipse.tracecompass.ctf.core.tests.types.TestAll.class
-})
-public class AllCtfCoreTests {
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Ericsson
- *
- * 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:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.eclipse.tracecompass.internal.ctf.core.Activator;
-import org.junit.Test;
-
-/**
- * <b><u>CtfCorePluginTest</u></b>
- * <p>
- * Test the CTF core plug-in activator
- */
-@SuppressWarnings("javadoc")
-public class CtfCorePluginTest {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- // Plug-in instantiation
- private final static Activator fPlugin = Activator.getDefault();
-
-
- // ------------------------------------------------------------------------
- // Test cases
- // ------------------------------------------------------------------------
-
- @Test
- public void testCtfCorePluginId() {
- assertEquals(
- "Plugin ID", "org.eclipse.tracecompass.ctf.core", Activator.PLUGIN_ID);
- }
-
- @Test
- public void testGetDefault() {
- Activator plugin = Activator.getDefault();
- assertEquals("getDefault()", plugin, fPlugin);
- }
-
- @Test
- public void testLog() {
- try {
- Activator.log("Some message");
- } catch (Exception e) {
- fail();
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests;
-
-import java.io.File;
-import java.net.URISyntaxException;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.tracecompass.internal.ctf.core.Activator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CtfCoreTestPlugin extends Plugin {
-
- private static final String TEMP_DIR_NAME = ".temp"; //$NON-NLS-1$
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /** The plug-in ID */
- public static final String PLUGIN_ID = "org.eclipse.tracecompass.ctf.core.tests";
-
- // The shared instance
- private static CtfCoreTestPlugin fPlugin;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The constructor
- */
- public CtfCoreTestPlugin() {
- setDefault(this);
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * @return the shared instance
- */
- public static CtfCoreTestPlugin getDefault() {
- return fPlugin;
- }
-
- /**
- * @param plugin
- * the shared instance
- */
- private static void setDefault(CtfCoreTestPlugin plugin) {
- fPlugin = plugin;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- setDefault(this);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- setDefault(null);
- super.stop(context);
- }
-
- /**
- * Get the temporary directory path. If there is an instance of Eclipse
- * running, the temporary directory will reside under the workspace.
- *
- * @return the temporary directory path suitable to be passed to the
- * java.io.File constructor without a trailing separator
- */
- public static String getTemporaryDirPath() {
- String property = System.getProperty("osgi.instance.area"); //$NON-NLS-1$
- if (property != null) {
- try {
- File dir = URIUtil.toFile(URIUtil.fromString(property));
- dir = new File(dir.getAbsolutePath() + File.separator + TEMP_DIR_NAME);
- if (!dir.exists()) {
- dir.mkdirs();
- }
- return dir.getAbsolutePath();
- } catch (URISyntaxException e) {
- Activator.logError(e.getLocalizedMessage(), e);
- }
- }
- return System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * Parameterized test class running the CTF Test Suite
- *
- * (from https://github.com/efficios/ctf-testsuite).
- *
- * @author Alexandre Montplaisir
- */
-@RunWith(Parameterized.class)
-public class CtfTestSuiteTests {
-
- /** Time-out tests after 10 seconds. */
- @Rule
- public TestRule globalTimeout = new Timeout(10000);
-
- private static final Path BASE_PATH = Paths.get("traces", "ctf-testsuite", "tests", "1.8");
-
- /**
- * Test we know are currently failing. Ignore them so we can at least run
- * the others.
- *
- * TODO Actually fix them!
- */
- private static final Path[] IGNORED_TESTS = {
- BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "sequence-typedef-length")),
- BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "array-of-struct")),
- BASE_PATH.resolve(Paths.get("regression", "stream", "pass", "integer-large-size")),
- BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "metadata-packetized-endianness-mismatch"))
- };
-
- private final String fTracePath;
- private final boolean fExpectSuccess;
-
- // ------------------------------------------------------------------------
- // Methods for the Parametrized runner
- // ------------------------------------------------------------------------
-
- /**
- * Get the existing trace paths in the CTF-Testsuite git tree.
- *
- * @return The list of CTF traces (directories) to test
- */
- @Parameters(name = "{index}: {0}")
- public static Iterable<Object[]> getTracePaths() {
- final List<Object[]> dirs = new LinkedList<>();
-
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "metadata", "fail")), false);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "metadata", "pass")), true);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "stream", "fail")), false);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("fuzzing", "stream", "pass")), true);
-
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "metadata", "fail")), false);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "metadata", "pass")), true);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "stream", "fail")), false);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("regression", "stream", "pass")), true);
-
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "fail")), false);
- addDirsOneLevelDeepFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "pass")), true);
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "fail")), false);
- addDirsOneLevelDeepFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "pass")), true);
-
- return dirs;
- }
-
- private static void addDirsFrom(List<Object[]> dirs, Path path, boolean expectSuccess) {
- if (!Files.exists(path)) {
- /* Some planned directories may not exist yet in the test suite */
- return;
- }
- try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, DIR_FILTER);) {
- for (Path p : ds) {
- /* Add this test case to the list of tests to run */
- Object array[] = new Object[] { p.toString(), expectSuccess };
- dirs.add(array);
- }
- } catch (IOException e) {
- /* Something is wrong with the layout of the test suite? */
- e.printStackTrace();
- }
- }
-
- /**
- * Some test traces are not in pass/trace1, pass/trace2, etc. but rather
- * pass/test1/trace1, pass/test1/trace2, etc.
- *
- * This methods adds the directories one level "down" instead of the very
- * next level.
- */
- private static void addDirsOneLevelDeepFrom(List<Object[]> dirs, Path path,
- boolean expectSuccess) {
- if (!Files.exists(path)) {
- return;
- }
- try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, DIR_FILTER);) {
- for (Path p : ds) {
- addDirsFrom(dirs, p, expectSuccess);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- private static final DirectoryStream.Filter<Path> DIR_FILTER =
- new DirectoryStream.Filter<Path>() {
- @Override
- public boolean accept(Path entry) {
- /* Only accept directories and non-blacklisted tests */
- if (!Files.isDirectory(entry)) {
- return false;
- }
- for (Path ignoredTestPath : IGNORED_TESTS) {
- if (entry.equals(ignoredTestPath)) {
- System.err.println("Skipping test " + entry.toString() + " as requested.");
- return false;
- }
- }
- return true;
- }
- };
-
- // ------------------------------------------------------------------------
- // Test constructor
- // ------------------------------------------------------------------------
-
- /**
- * Constructor for the parametrized tests
- *
- * @param tracePath
- * The complete path to the trace to test
- * @param expectSuccess
- * Should this trace parse successfully, or not.
- */
- public CtfTestSuiteTests(String tracePath, boolean expectSuccess) {
- fTracePath = tracePath;
- fExpectSuccess = expectSuccess;
- }
-
- // ------------------------------------------------------------------------
- // Test methods
- // ------------------------------------------------------------------------
-
- /**
- * Test opening and reading the trace
- */
- @Test
- public void testTrace() {
- try {
- /* Instantiate the trace (which implies parsing the metadata) */
- CTFTrace trace = new CTFTrace(fTracePath);
- /* Read the trace until the end */
- try (CTFTraceReader reader = new CTFTraceReader(trace);) {
-
- reader.getCurrentEventDef();
- while (reader.advance()) {
- assertNotNull(reader.getCurrentEventDef());
- }
-
- checkIfWeShoudlSucceed();
- }
- } catch (CTFException e) {
- checkIfWeShouldFail(e);
- } catch (OutOfMemoryError e) {
- checkIfWeShouldFail(e);
- }
- }
-
- private void checkIfWeShoudlSucceed() {
- if (!fExpectSuccess) {
- fail("Trace was expected to fail parsing: " + fTracePath);
- }
- }
-
- private void checkIfWeShouldFail(Throwable e) {
- if (fExpectSuccess) {
- fail("Trace was expected to succeed, but failed parsing: " +
- fTracePath + " (" + e.getMessage() + ")");
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.ctftestsuite;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfTestSuiteTests.class
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-import org.junit.Test;
-
-/**
- * The class <code>CTFCallsiteTest</code> contains tests for the class
- * <code>{@link CTFCallsite}</code>.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-
-public class CTFCallsiteTest {
-
- private static CTFCallsite GenerateCS(long ip){
- return new CTFCallsite("event name", "func name", ip, "file.java", 1);
- }
-
- /**
- * Test the constructor
- */
- @Test
- public void constructorTest(){
- CTFCallsite cs = GenerateCS(0x01);
- assertNotNull(cs);
- }
-
- /**
- * Test the getters
- */
- @Test
- public void getterTest(){
- CTFCallsite cs = GenerateCS(0x01);
- assertEquals("ip", 1, cs.getIp());
- assertEquals("ip", "event name", cs.getEventName());
- assertEquals("ip", "file.java", cs.getFileName());
- assertEquals("ip", "func name", cs.getFunctionName());
- }
-
- /**
- * Test the hash code
- */
- @Test
- public void hashCodeTest(){
- CTFCallsite cs = GenerateCS(0x01);
- Map<CTFCallsite, Object> test = new HashMap<>();
- test.put(cs, new Object());
- assertTrue(test.containsKey(cs));
- assertTrue(test.containsKey(GenerateCS(0x01)));
- assertFalse(test.containsKey(GenerateCS(0x02)));
- assertFalse(test.containsKey(new CTFCallsite("event nam", "func name", 1, "file.java", 1)));
- assertFalse(test.containsKey(new CTFCallsite("event name", "func nam", 1, "file.java", 1)));
- assertFalse(test.containsKey(new CTFCallsite("event name", "func name", 1, "file.jav", 1)));
- assertFalse(test.containsKey(new CTFCallsite("event name", "func name", 1, "file.java", 2)));
- }
-
- /**
- * Test the comparator (it should sort using the IP)
- */
- @Test
- public void comparatorTest(){
- CTFCallsite cs[] = new CTFCallsite[5];
- long vals[] = {1L, 0L, -2L, 2L, -1L};
- for(int i = 0 ; i < 5 ; i++ ){
- cs[i] = GenerateCS(vals[i]);
- }
-
- assertEquals(1, cs[0].compareTo(cs[1]));
- assertEquals(-1, cs[1].compareTo(cs[0]));
- assertEquals(0, cs[0].compareTo(cs[0]));
- assertEquals(-1, cs[0].compareTo(cs[2]));
- assertEquals(1, cs[2].compareTo(cs[0]));
-
- Arrays.sort(cs);
-
- assertEquals( 0L, cs[0].getIp());
- assertEquals( 1L, cs[1].getIp());
- assertEquals( 2L, cs[2].getIp());
- assertEquals( -2L , cs[3].getIp());
- assertEquals( -1L, cs[4].getIp());
- }
-
- /**
- * Tests the output of a callsite toString function
- */
- @Test
- public void toStringTest(){
- CTFCallsite cs = GenerateCS(0x01);
- assertEquals("file.java/func name:1", cs.toString());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test the event definition
- *
- * @author Matthew Khouzam
- *
- */
-public class CTFEventDefinitionTest {
- List<EventDefinition> fixture;
-
- /**
- * Making a power set of configurations to test the event definition
- */
- @Before
- public void init() {
- fixture = new ArrayList<>();
- IntegerDeclaration pidDec = IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 8);
- IntegerDeclaration ctxDec = IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 8);
- IntegerDefinition pid = new IntegerDefinition(pidDec, null, "pid", 3);
- IntegerDefinition pod = new IntegerDefinition(pidDec, null, "pod", 3);
- IntegerDefinition ctx = new IntegerDefinition(pidDec, null, "ctx", 3);
-
- StructDeclaration streamContextDec = new StructDeclaration(8);
- streamContextDec.addField("pid", pidDec);
- streamContextDec.addField("ctx", ctxDec);
- StructDeclaration eventContextDec = new StructDeclaration(8);
- eventContextDec.addField("pod", pidDec);
- eventContextDec.addField("ctx", pidDec);
- StructDeclaration fDec = new StructDeclaration(8);
- EventDeclaration eventDeclaration = new EventDeclaration();
-
- fDec.addField("pid", pidDec);
- fDec.addField("ctx", ctxDec);
- fDec.addField("pod", pidDec);
-
- Definition[] sDefs = { pid, ctx };
- Definition[] eDefs = { pod, ctx };
- Definition[] fDefs = { pid, ctx, pod };
-
- StructDeclaration pContextDec = new StructDeclaration(8);
-
- StructDefinition sContext = new StructDefinition(streamContextDec, null, ILexicalScope.STREAM_PACKET_CONTEXT.getPath(), sDefs);
- StructDefinition eContext = new StructDefinition(eventContextDec, null, ILexicalScope.STREAM_EVENT_CONTEXT.getPath(), eDefs);
- StructDefinition pContext = new StructDefinition(pContextDec, null, ILexicalScope.FIELDS.getPath(), new Definition[0]);
- StructDefinition fields = new StructDefinition(fDec, null, ILexicalScope.FIELDS.getPath(), fDefs);
-
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, null, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, null, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, pContext, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, null, pContext, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, null, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, null, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, pContext, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, null, eContext, pContext, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, null, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, null, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, pContext, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, null, pContext, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, null, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, null, fields));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, pContext, null));
- fixture.add(new EventDefinition(eventDeclaration, null, 100, sContext, eContext, pContext, fields));
- }
-
- /**
- * Test all the events
- */
- @Test
- public void testEvents() {
- int i = 0;
- for (EventDefinition ed : fixture) {
- test(i, ed);
- i++;
- }
- }
-
- private static void test(int rank, EventDefinition ed) {
- String title = "event #" + rank;
- assertEquals(title, 100L, ed.getTimestamp());
- ICompositeDefinition context = ed.getContext();
- if (rank >= 4) {
- assertNotNull(title, context);
- if (rank >= 12) {
- assertEquals(title, 3, context.getFieldNames().size());
- } else {
- assertEquals(title, 2, context.getFieldNames().size());
- }
-
- } else {
- assertNull(title, context);
- }
- if (((rank / 4) % 2) == 1) {
- assertNotNull(title, ed.getEventContext());
- }else{
- assertNull(title, ed.getEventContext());
- }
- if (rank % 2 == 1) {
- assertNotNull(title, ed.getFields());
- assertEquals(title, 3, ed.getFields().getFieldNames().size());
- } else {
- assertNull(title, ed.getFields());
- }
- assertTrue(title, ed.toString().startsWith("Event type: null" + System.getProperty("line.separator") + "Timestamp: 100"));
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.junit.Test;
-
-/**
- * The class <code>CTFEventFieldTest</code> contains tests for the class
- * <code>{@link CTFEventField}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFEventFieldTest {
-
- @NonNull
- private static final String fieldName = "id";
-
- /**
- * Run the CTFEventField parseField(Definition,String) method test.
- *
- * @throws CTFException
- */
- @Test
- public void testParseField_complex() throws CTFException {
- int len = 32;
- IntegerDeclaration id = IntegerDeclaration.createDeclaration(
- len,
- false,
- len,
- ByteOrder.LITTLE_ENDIAN,
- Encoding.ASCII,
- "",
- len);
- String lengthName = "LengthName";
- StructDeclaration structDec = new StructDeclaration(0);
- structDec.addField(lengthName, id);
- StructDefinition structDef = new StructDefinition(
- structDec,
- null,
- lengthName,
- new Definition[] {
- new IntegerDefinition(
- id,
- null,
- lengthName,
- 32)
- });
-
- SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
- ByteBuffer byb = testMemory(ByteBuffer.allocate(1024));
- for (int i = 0; i < 1024; i++) {
- byb.put((byte) i);
- }
- BitBuffer bb = new BitBuffer(byb);
- IDefinition fieldDef = sd.createDefinition(structDef, "fff-fffield", bb);
-
- assertNotNull(fieldDef);
- }
-
- @NonNull
- private static ByteBuffer testMemory(ByteBuffer buffer) {
- if (buffer == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- return buffer;
- }
-
- /**
- * Run the CTFEventField parseField(Definition,String) method test.
- *
- * @throws CTFException
- */
- @Test
- public void testParseField_simple() throws CTFException {
- final StringDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- byte[] bytes = { 'T', 'e', 's', 't', '\0' };
- ByteBuffer bb = testMemory(ByteBuffer.wrap(bytes));
- IDefinition fieldDef = elemType.createDefinition(null, fieldName, new BitBuffer(bb));
-
- assertNotNull(fieldDef);
- }
-
- /**
- * Run the CTFEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_simple2() {
- IntegerDefinition fieldDef = new IntegerDefinition(
- IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
- Encoding.ASCII, "", 8), null, fieldName, 1L);
-
- assertNotNull(fieldDef);
- }
-
- /**
- *
- */
- @Test
- public void testParseField_simple3() {
- StringDefinition fieldDef = new StringDefinition(
- StringDeclaration.getStringDeclaration(Encoding.UTF8), null, fieldName, "Hello World");
-
- String other = "\"Hello World\"";
- assertNotNull(fieldDef);
- assertEquals(fieldDef.toString(), other);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.event;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CTFCallsiteTest.class,
- CTFEventDefinitionTest.class,
- CTFEventFieldTest.class
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Alexandre Montplaisir - Extracted from BitBufferTest, cleanup
- * Matthew Khouzam - Additional tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.io;
-
-import static org.junit.Assert.assertEquals;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Part of the {@link BitBuffer} tests which test the methods to read/write
- * integers. These are separated from the main file because the fixture is
- * different.
- *
- * @author Alexandre Montplaisir
- */
-public class BitBufferIntTest {
-
- private BitBuffer fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * Out of bounds, won't happen
- */
- @Before
- public void setUp() throws CTFException {
- ByteBuffer allocateDirect = ByteBuffer.allocateDirect(128);
- if (allocateDirect == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- fixture = new BitBuffer(allocateDirect);
- fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
- fixture = createBuffer();
- }
-
- private static BitBuffer createBuffer() throws CTFException {
- return createBuffer(16);
- }
-
- private static BitBuffer createBuffer(int j) throws CTFException {
- final byte[] bytes = new byte[j];
- for (int i = 0; i < j; i++) {
- bytes[i] = (byte) (i % 0xff);
- }
- ByteBuffer wrap = ByteBuffer.wrap(bytes);
- if (wrap == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer fixture = new BitBuffer(wrap);
- fixture.position(1);
- return fixture;
- }
-
- /**
- * Test {@link BitBuffer#getInt} with a basic value
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_base() throws CTFException {
- int result = fixture.getInt();
- assertEquals(0x020406, result);
- }
-
- /**
- * Test {@link BitBuffer#getInt} with explicit seek at pos 0.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_pos0() throws CTFException {
- fixture.position(0);
- int result = fixture.getInt();
- assertEquals(0x010203, result);
- }
-
- /**
- * Test {@link BitBuffer#get} with seek at pos 1.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_pos1() throws CTFException {
- fixture.position(1);
-
- long result = fixture.get(1, true);
- assertEquals(0, result);
- }
-
- /**
- * Test {@link BitBuffer#get} with seek at pos 2.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_pos2() throws CTFException {
- fixture.position(2);
-
- long result = fixture.get(0, true);
- assertEquals(0, result);
- }
-
- /**
- * Test {@link BitBuffer#get} with explicit little-endian reading.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_le2() throws CTFException {
- BitBuffer leFixture = createBuffer(128);
- leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- leFixture.position(0);
- long result = leFixture.get(24, false);
- assertEquals(0x020100, result);
- }
-
- /**
- * Test {@link BitBuffer#get} with explicit little-endian reading, with an
- * offset.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testGetInt_le1() throws CTFException {
- BitBuffer leFixture = createBuffer(128);
- leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- leFixture.position(1);
- long result = leFixture.get(24, false);
- assertEquals(0x810080, result); /* 0x020100 down-shifted */
- }
-
- /**
- * Test {@link BitBuffer#get} with a 32-bit out-of-bounds read. Should throw
- * an exception.
- *
- * @throws CTFException
- * Expected
- */
- @Test(expected = CTFException.class)
- public void testGetInt_invalid() throws CTFException {
- BitBuffer smallFixture = createBuffer(2);
- smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN);
-
- smallFixture.position(10);
-
- /* This will attempt to read past the buffer's end. */
- smallFixture.get(32, true);
- }
-
- /**
- * Test {@link BitBuffer#get} with a 64-bit out-of-bounds read. Should throw
- * an exception.
- *
- * @throws CTFException
- * Expected
- */
- @Test(expected = CTFException.class)
- public void testGetInt_invalid2() throws CTFException {
- BitBuffer smallFixture = createBuffer(2);
- smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN);
-
- smallFixture.position(1);
-
- /* This will attempt to read past the buffer's end. */
- smallFixture.get(64, true);
- }
-
- /**
- * Test {@link BitBuffer#getLong}.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos0() throws CTFException {
- fixture.position(0);
- long result = fixture.getLong();
- assertEquals(0x01020304050607L, result);
- }
-
- /**
- * Test {@link BitBuffer#getLong} with an offset of 7.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos7() throws CTFException {
- fixture.position(7);
- long result = fixture.getLong();
- assertEquals(0x81018202830384L, result);
- }
-
- /**
- * Test {@link BitBuffer#getLong} with an offset of 8.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos8() throws CTFException {
- fixture.position(8);
- long result = fixture.getLong();
- assertEquals(0x0102030405060708L, result);
- }
-
- /**
- * Test {@link BitBuffer#getLong} with a little-endian buffer.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos0LE() throws CTFException {
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.getLong();
- assertEquals(0x0706050403020100L, result);
- }
-
- /**
- * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 7.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos7LE() throws CTFException {
- fixture.position(7);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.getLong();
- assertEquals(0x100e0c0a08060402L, result);
- }
-
- /**
- * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 8.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong_pos8LE() throws CTFException {
- fixture.position(8);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.getLong();
- assertEquals(0x0807060504030201L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGet35_pos0BE() throws CTFException {
- fixture.position(0);
- long result = fixture.get(35, false);
- assertEquals(0x081018L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length at an offset position.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGet35_pos8BE() throws CTFException {
- fixture.position(8);
- long result = fixture.get(35, false);
- assertEquals(0x08101820L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length in little-endian.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGet35_pos0LE() throws CTFException {
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, false);
- assertEquals(0x0403020100L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at
- * position 7.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong35_pos7LE() throws CTFException {
- fixture.position(7);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, false);
- assertEquals(0x0208060402L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at
- * position 8.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong35_pos8LE() throws CTFException {
- fixture.position(8);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, false);
- assertEquals(0x0504030201L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
- * a signed value.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong35s_pos0LE() throws CTFException {
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, true);
- assertEquals(0xfffffffc03020100L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
- * a signed value, at position 7.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong35s_pos7LE() throws CTFException {
- fixture.position(7);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, true);
- assertEquals(0x0208060402L, result);
- }
-
- /**
- * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for
- * a signed value, at position 8.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetLong35s_pos8LE() throws CTFException {
- fixture.position(8);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- long result = fixture.get(35, true);
- assertEquals(0xfffffffd04030201L, result);
- }
-
- /**
- * Test reading negative values as signed values.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetSigned() throws CTFException {
- fixture.position(0);
- fixture.putInt(-1);
- fixture.putInt(-1);
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
- long result = fixture.get(32, true);
- assertEquals(-1L, result);
- }
-
- /**
- * Test reading negative values as unsigned values.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetUnsigned() throws CTFException {
- fixture.position(0);
- fixture.putInt(-1);
- fixture.putInt(-1);
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
- long result = fixture.get(32, false);
- assertEquals(0xFFFFFFFFL, result);
- }
-
- /**
- * Test reading 24 bits of a 32-bit negative value as a signed value.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGet24Signed() throws CTFException {
- fixture.position(0);
- fixture.putInt(-1);
- fixture.putInt(-1);
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
- long result = fixture.get(24, true);
- assertEquals(-1L, result);
- }
-
- /**
- * Test reading 24 bits of a 32-bit negative value as an unsigned value.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGet24Unsigned() throws CTFException {
- fixture.position(0);
- fixture.putInt(-1);
- fixture.putInt(-1);
- fixture.position(0);
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-
- long result = fixture.get(24, false);
- assertEquals(0xFFFFFFL, result);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int)}
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutInt() throws CTFException {
- fixture.position(1);
- fixture.putInt(1);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int, int)}
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutInt_length1() throws CTFException {
- fixture.position(1);
- fixture.putInt(1, 1);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int, int)} with length = 0.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutInt_length0() throws CTFException {
- fixture.position(1);
- fixture.putInt(0, 1);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int)} Little endian
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutIntLe() throws CTFException {
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- fixture.position(1);
- fixture.putInt(1);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int, int)} Little endian
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutIntLe_length1() throws CTFException {
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- fixture.position(1);
- fixture.putInt(1, 1);
- }
-
- /**
- * Test {@link BitBuffer#putInt(int, int)} with length = 0. Little endian
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutIntLe_length0() throws CTFException {
- fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN);
- fixture.position(1);
- fixture.putInt(0, 1);
- }
-
- /**
- * Test writing and reading a value defined in hex format.
- *
- * @throws CTFException
- * Not expected
- */
- @Test
- public void testPutInt_hex() throws CTFException {
- final int value = 0x010203;
-
- for (int i = 0; i <= 32; i++) {
- fixture.position(i);
- fixture.putInt(value);
-
- fixture.position(i);
- int read = fixture.getInt();
-
- assertEquals(value, read);
- }
- }
-
- /**
- * Test {@link BitBuffer#putInt} with an out-of-bounds length. An exception
- * should be thrown.
- *
- * @throws CTFException
- * Expected
- */
- @Test(expected = CTFException.class)
- public void testPutInt_invalid() throws CTFException {
- BitBuffer fixture2;
- fixture2 = createBuffer(4);
- fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
- fixture2.position(1);
-
- /* This will try writing past the buffer's end */
- fixture2.putInt(32, 1);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.io;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>BitBufferTest</code> contains tests for the class
- * <code>{@link BitBuffer}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class BitBufferTest {
-
- private BitBuffer fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * An error that cannot happen (position is under 128)
- */
- @Before
- public void setUp() throws CTFException {
- fixture = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(1)));
- fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
- fixture.position(1);
- }
-
- /**
- * Run the BitBuffer() constructor test.
- */
- @Test
- public void testBitBuffer() {
- BitBuffer result = new BitBuffer();
-
- assertNotNull(result);
- assertEquals(0, result.position());
- assertNotNull(result.getByteBuffer());
- }
-
- /**
- * Run the BitBuffer(ByteBuffer) constructor test.
- */
- @Test
- public void testBitBuffer_fromByteBuffer() {
- BitBuffer result = new BitBuffer(Util.testMemory(ByteBuffer.allocate(0)));
- assertNotNull(result);
- assertEquals(0, result.position());
- }
-
- /**
- * Run the boolean canRead(int) method test.
- */
- @Test
- public void testCanRead_1param() {
- int length = 1;
- boolean result = fixture.canRead(length);
-
- assertEquals(true, result);
- }
-
- /**
- * Run the void clear() method test.
- */
- @Test
- public void testClear() {
- fixture.clear();
- }
-
- /**
- * Run the ByteBuffer getByteBuffer() method test.
- */
- @Test
- public void testGetByteBuffer() {
- ByteBuffer result = fixture.getByteBuffer();
-
- assertNotNull(result);
- assertEquals("java.nio.DirectByteBuffer[pos=0 lim=1 cap=1]", result.toString());
- assertEquals(true, result.isDirect());
- assertEquals(false, result.hasArray());
- assertEquals(1, result.limit());
- assertEquals(1, result.remaining());
- assertEquals(0, result.position());
- assertEquals(1, result.capacity());
- assertEquals(true, result.hasRemaining());
- assertEquals(false, result.isReadOnly());
- }
-
- /**
- * Run the ByteOrder getByteOrder() method test.
- */
- @Test
- public void testGetByteOrder() {
- ByteOrder result = fixture.getByteOrder();
-
- assertNotNull(result);
- assertEquals("BIG_ENDIAN", result.toString());
- }
-
- /**
- * Run the ByteOrder order() method test.
- */
- @Test
- public void testGetOrder() {
- ByteOrder result = fixture.getByteOrder();
-
- assertNotNull(result);
- assertEquals("BIG_ENDIAN", result.toString());
- }
-
- /**
- * Run the void order(ByteOrder) method test.
- */
- @Test
- public void testSetOrder() {
- ByteOrder order = ByteOrder.BIG_ENDIAN;
-
- fixture.setByteOrder(order);
- }
-
- /**
- * Run the int position() method test.
- */
- @Test
- public void testGetPosition() {
- long result = fixture.position();
-
- assertEquals(1, result);
- }
-
- /**
- * Run the void position(int) method test.
- *
- * @throws CTFException
- * out of bounds? won't happen
- */
- @Test
- public void testSetPosition() throws CTFException {
- int newPosition = 1;
- fixture.position(newPosition);
- }
-
- /**
- * Run the void setByteOrder(ByteOrder) method test.
- */
- @Test
- public void testSetByteOrder() {
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
- fixture.setByteOrder(byteOrder);
- }
-
- /**
- * Test the get function
- */
- @Test
- public void testGetBytes() {
- @NonNull
- byte[] data = new byte[2];
- ByteBuffer bb = ByteBuffer.allocate(10);
- bb.put((byte) 0);
- bb.put((byte) 1);
- bb.put((byte) 1);
- bb.put((byte) 0);
- fixture = new BitBuffer(bb);
- fixture.get(data);
- assertEquals(0, data[0]);
- assertEquals(1, data[1]);
- fixture.get(data);
- assertEquals(1, data[0]);
- assertEquals(0, data[1]);
- }
-
- /**
- * Test the get function
- *
- * @throws CTFException
- * won't happen but we seek in a buffer
- */
- @Test
- public void testGetBytesMiddle() throws CTFException {
- @NonNull
- byte[] data = new byte[5];
- // this string has been carefully selected and tested... don't change
- // the string and expect the result to be the same.
- fixture = new BitBuffer(Util.testMemory(ByteBuffer.wrap(new String("hello world").getBytes())));
- fixture.position(6 * 8);
- fixture.get(data);
- String actual = new String(data);
- assertEquals("world", actual);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.io;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- BitBufferIntTest.class,
- BitBufferTest.class
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.io;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Helpers for the tests
- *
- * @author Matthew Khouzam
- */
-public final class Util {
-
- private Util() {
- }
-
- /**
- * Wrapper to make sure the bytebuffer is not null
- *
- * @param buffer
- * a potentially null byte buffer
- * @return a non-null byte buffer or an illegal state exception
- */
- @NonNull
- public static ByteBuffer testMemory(ByteBuffer buffer) {
- if (buffer == null) {
- throw new IllegalStateException("Failed to alloc");
- }
- return buffer;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.scope;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.junit.Test;
-
-/**
- * Lexical test
- *
- * @author Matthew Khouzam
- */
-public class LexicalScopeTest {
-
- /**
- * Root test
- */
- @Test
- public void testRoot() {
- ILexicalScope scope = ILexicalScope.ROOT;
- assertNotNull(scope);
- }
-
- /**
- * Test a more complex node
- */
- @Test
- public void testComplexNode() {
- ILexicalScope scope = ILexicalScope.STREAM_EVENT_CONTEXT;
- assertEquals("context", scope.getName());
- assertEquals("stream.event.context", scope.getPath());
- }
-
- /**
- * Test that getChild returns the same items for event headers
- */
- @Test
- public void testEventHeaders() {
- ILexicalScope child = ILexicalScope.ROOT.getChild("event");
- assertNotNull(child);
- ILexicalScope scope2 = child.getChild("header");
- ILexicalScope scope3 = ILexicalScope.ROOT.getChild("event.header");
- assertEquals(ILexicalScope.EVENT_HEADER, scope2);
- assertEquals(ILexicalScope.EVENT_HEADER, scope3);
- // they should be the same
- assert (ILexicalScope.EVENT_HEADER == scope2);
-
- assertNotNull(scope2);
- ILexicalScope id = scope2.getChild("id");
- assertNotNull(id);
- assert (ILexicalScope.EVENT_HEADER_ID == id);
- ILexicalScope ts = scope2.getChild("v.timestamp");
- ILexicalScope v = scope2.getChild("v");
- assert (ILexicalScope.EVENT_HEADER_V_TIMESTAMP == ts);
- assert (ILexicalScope.EVENT_HEADER_V == v);
- assertNotNull(v);
- ILexicalScope ts2 = v.getChild("timestamp");
- assert (ILexicalScope.EVENT_HEADER_V_TIMESTAMP == ts2);
- assertNotNull(v);
- id = v.getChild("id");
- assert (ILexicalScope.EVENT_HEADER_V_ID == id);
- assertNotNull(v);
- ILexicalScope other = v.getChild("other");
- assertNull(other);
- }
-
- /**
- * Test that getChild returns the same items for event headers
- */
- @Test
- public void testFields() {
- ILexicalScope child = ILexicalScope.ROOT.getChild("fields");
- assertNotNull(child);
- ILexicalScope scope2 = child.getChild("_ret");
- ILexicalScope scope3 = child.getChild("_tid");
- ILexicalScope empty = child.getChild("other");
-
- assertEquals(ILexicalScope.FIELDS_RET, scope2);
- // they should be the same
- assert (ILexicalScope.FIELDS_RET == scope2);
-
- assertEquals(ILexicalScope.FIELDS_TID, scope3);
- // they should be the same
- assert (ILexicalScope.FIELDS_TID == scope2);
-
- assertNull(empty);
- }
-
- /**
- * Check contexts are not equals
- */
- @Test
- public void testNotEquals() {
- assertNotEquals(ILexicalScope.CONTEXT, ILexicalScope.EVENT);
- LexicalScope context = new LexicalScope(ILexicalScope.CONTEXT, "context");
- LexicalScope otherContext = new LexicalScope(ILexicalScope.CONTEXT, "context2");
- assertNotEquals(context, otherContext);
- assertNotEquals(context, null);
- }
-
- /**
- * Test to strings
- */
- @Test
- public void testGetPath() {
- ILexicalScope child = ILexicalScope.ROOT.getChild("fields");
- assertNotNull(child);
- ILexicalScope scope2 = child.getChild("_ret");
- assertNotNull(scope2);
- assertEquals("fields._ret", scope2.getPath());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.scope;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- LexicalScopeTest.class
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Marc-Andre Laperle - Move generation to traces folder
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.synthetictraces;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin;
-
-/**
- * Generate a kernel trace
- *
- * @author Matthew Khouzam
- */
-public class LttngKernelTraceGenerator {
-
- private static final String metadata = "/* CTF 1.8 */ \n" +
- "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n" +
- "typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n" +
- "typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n" +
- "typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n" +
- "typealias integer { size = 32; align = 8; signed = false; } := unsigned long;\n" +
- "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n" +
- "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n" +
- "\n" +
- "trace {\n" +
- " major = 1;\n" +
- " minor = 8;\n" +
- " uuid = \"11111111-1111-1111-1111-111111111111\";\n" +
- " byte_order = le;\n" +
- " packet.header := struct {\n" +
- " uint32_t magic;\n" +
- " uint8_t uuid[16];\n" +
- " uint32_t stream_id;\n" +
- " };\n" +
- "};\n" +
- "\n" +
- "env {\n" +
- " hostname = \"synthetic-host\";\n" +
- " domain = \"kernel\";\n" +
- " sysname = \"FakeLinux\";\n" +
- " kernel_release = \"1.0\";\n" +
- " kernel_version = \"Fake Os Synthetic Trace\";\n" +
- " tracer_name = \"lttng-modules\";\n" +
- " tracer_major = 2;\n" +
- " tracer_minor = 1;\n" +
- " tracer_patchlevel = 0;\n" +
- "};\n" +
- "\n" +
- "clock {\n" +
- " name = monotonic;\n" +
- " uuid = \"bbff68f0-c633-4ea1-92cd-bd11024ec4de\";\n" +
- " description = \"Monotonic Clock\";\n" +
- " freq = 1000000000; /* Frequency, in Hz */\n" +
- " /* clock value offset from Epoch is: offset * (1/freq) */\n" +
- " offset = 1368000272650993664;\n" +
- "};\n" +
- "\n" +
- "typealias integer {\n" +
- " size = 27; align = 1; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- "} := uint27_clock_monotonic_t;\n" +
- "\n" +
- "typealias integer {\n" +
- " size = 32; align = 8; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- "} := uint32_clock_monotonic_t;\n" +
- "\n" +
- "typealias integer {\n" +
- " size = 64; align = 8; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- "} := uint64_clock_monotonic_t;\n" +
- "\n" +
- "struct packet_context {\n" +
- " uint64_clock_monotonic_t timestamp_begin;\n" +
- " uint64_clock_monotonic_t timestamp_end;\n" +
- " uint64_t content_size;\n" +
- " uint64_t packet_size;\n" +
- " unsigned long events_discarded;\n" +
- " uint32_t cpu_id;\n" +
- "};\n" +
- "\n" +
- "struct event_header_compact {\n" +
- " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n" +
- " variant <id> {\n" +
- " struct {\n" +
- " uint27_clock_monotonic_t timestamp;\n" +
- " } compact;\n" +
- " struct {\n" +
- " uint32_t id;\n" +
- " uint64_clock_monotonic_t timestamp;\n" +
- " } extended;\n" +
- " } v;\n" +
- "} align(8);\n" +
- "\n" +
- "struct event_header_large {\n" +
- " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n" +
- " variant <id> {\n" +
- " struct {\n" +
- " uint32_clock_monotonic_t timestamp;\n" +
- " } compact;\n" +
- " struct {\n" +
- " uint32_t id;\n" +
- " uint64_clock_monotonic_t timestamp;\n" +
- " } extended;\n" +
- " } v;\n" +
- "} align(8);\n" +
- "\n" +
- "stream {\n" +
- " id = 0;\n" +
- " event.header := struct event_header_compact;\n" +
- " packet.context := struct packet_context;\n" +
- "};\n" +
- "\n" +
- "event {\n" +
- " name = sched_switch;\n" +
- " id = 0;\n" +
- " stream_id = 0;\n" +
- " fields := struct {\n" +
- " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _prev_comm[16];\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid;\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio;\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_state;\n" +
- " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _next_comm[16];\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid;\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio;\n" +
- " };\n" +
- "};\n" +
- "\n";
-
- private final List<String> fProcesses;
- private final long fDuration;
- private final long fNbEvents;
- private final int fNbChans;
-
- private static final String[] sfProcesses = {
- "IDLE",
- "gnuplot",
- "starcraft 2:pt3",
- "bash",
- "smash",
- "thrash",
- "fireball",
- "Half-life 3",
- "ST: The game"
- };
-
-
- private static final String TRACES_DIRECTORY = "traces";
- private static final String TRACE_NAME = "synthetic-trace";
-
- /**
- * Main, not always needed
- *
- * @param args
- * args
- */
- public static void main(String[] args) {
- // not using createTempFile as this is a directory
- String path = CtfCoreTestPlugin.getTemporaryDirPath() + File.separator + TRACE_NAME;
- generateLttngKernelTrace(new File(path));
- }
-
- /**
- * Gets the name of the trace (top directory name)
- *
- * @return the name of the trace
- */
- public static String getName() {
- return TRACE_NAME;
- }
-
- /**
- * Get the path
- *
- * @return the path
- */
- public static String getPath() {
- CtfCoreTestPlugin plugin = CtfCoreTestPlugin.getDefault();
- if (plugin == null) {
- return null;
- }
- URL location = FileLocator.find(plugin.getBundle(), new Path(TRACES_DIRECTORY), null);
- File file = null;
- try {
- IPath path = new Path(FileLocator.toFileURL(location).getPath()).append(TRACE_NAME);
- file = path.toFile();
- } catch (IOException e) {
- // Shouldn't happen but at least throw something to get the test to fail early
- throw new IllegalStateException();
- }
-
- if (!file.exists()) {
- generateLttngKernelTrace(file);
- }
- return file.getAbsolutePath();
- }
-
- /**
- * Generate a trace
- *
- * @param file
- * the file to write the trace to
- */
- public static void generateLttngKernelTrace(File file) {
- final int cpus = 25;
- LttngKernelTraceGenerator gt = new LttngKernelTraceGenerator(2l * Integer.MAX_VALUE - 100, 500000, cpus);
- gt.writeTrace(file);
- }
-
- /**
- * Make a kernel trace
- *
- * @param duration
- * the duration of the trace
- * @param events
- * the number of events in a trace
- * @param nbChannels
- * the number of channels in the trace
- */
- public LttngKernelTraceGenerator(long duration, long events, int nbChannels) {
- fProcesses = Arrays.asList(sfProcesses);
- fDuration = duration;
- fNbEvents = events;
- fNbChans = nbChannels;
- }
-
- /**
- * Write the trace to a file
- *
- * @param file
- * the file to write the trace to
- */
- public void writeTrace(File file) {
-
- if (!file.exists()) {
- file.mkdir();
- } else {
- if (file.isFile()) {
- file.delete();
- file.mkdir();
- } else {
- // the ctf parser doesn't recurse, so we don't need to.
- final File[] listFiles = file.listFiles();
- for (File child : listFiles) {
- child.delete();
- }
- }
- }
-
- File metadataFile = new File(file.getPath() + File.separator + "metadata");
- File[] streams = new File[fNbChans];
- FileChannel[] channels = new FileChannel[fNbChans];
-
- try {
- for (int i = 0; i < fNbChans; i++) {
- streams[i] = new File(file.getPath() + File.separator + "channel" + i);
- channels[i] = new FileOutputStream(streams[i]).getChannel();
- }
- } catch (FileNotFoundException e) {
- }
- // determine the number of events per channel
- long evPerChan = fNbEvents / fNbChans;
- long delta = (int) (fDuration / evPerChan);
- long offsetTime = 0;
- for (int chan = 0; chan < fNbChans; chan++) {
- int currentSpace = 0;
- ByteBuffer bb = ByteBuffer.allocate(65536);
- bb.order(ByteOrder.LITTLE_ENDIAN);
- Random rnd = new Random(1337);
- int rnd0 = rnd.nextInt(fProcesses.size());
- String prevComm = fProcesses.get(rnd0);
- int prevPID = rnd0 + chan * fProcesses.size();
- if (rnd0 == 0) {
- prevPID = 0;
- }
- int prevPrio = 0;
- int prevPos = -1;
- for (int eventNb = 0; eventNb < evPerChan; eventNb++) {
- long ts = eventNb * delta + delta / (fNbChans + 1) * chan;
-
- int pos = rnd.nextInt((int) (fProcesses.size() * 1.5));
- if (pos >= fProcesses.size()) {
- pos = 0;
- }
- while (pos == prevPos) {
- pos = rnd.nextInt((int) (fProcesses.size() * 1.5));
- if (pos >= fProcesses.size()) {
- pos = 0;
- }
- }
- String nextComm = fProcesses.get(pos);
- int nextPID = pos + fProcesses.size() * chan;
- if (pos == 0) {
- nextPID = 0;
- }
- int nextPrio = 0;
- if (EventWriter.SIZE > currentSpace) {
- // pad to end
- for (int i = 0; i < currentSpace; i++) {
- bb.put((byte) 0x00);
- }
- // write new packet
- PacketWriter pw = new PacketWriter(bb);
- long tsBegin = ts;
- offsetTime = ts;
- long tsEnd = (eventNb + (PacketWriter.SIZE / EventWriter.SIZE)) * delta + 1;
- pw.writeNewHeader(tsBegin, tsEnd, chan);
- currentSpace = PacketWriter.CONTENT_SIZE;
- }
- EventWriter ew = new EventWriter(bb);
- int prev_state = rnd.nextInt(100);
- if (prev_state != 0) {
- prev_state = 1;
- }
- final long shrunkenTimestamp = ts - offsetTime;
- final int tsMask = (1 << 27) - 1;
- if (shrunkenTimestamp > ((1 << 27) + tsMask)) {
- /* allow only one compact timestamp overflow per packet */
- throw new IllegalStateException("Invalid timestamp overflow:" + shrunkenTimestamp);
- }
- final int clampedTs = (int) (ts & tsMask);
- int evSize = ew.writeEvent(clampedTs, prevComm, prevPID, prevPrio, prev_state, nextComm, nextPID, nextPrio);
- currentSpace -= evSize;
- prevComm = nextComm;
- prevPID = nextPID;
- prevPrio = nextPrio;
- if (bb.position() > 63000) {
- writeToDisk(channels, chan, bb);
- }
- }
- for (int i = 0; i < currentSpace; i++) {
- bb.put((byte) 0x00);
- }
- writeToDisk(channels, chan, bb);
- try {
- channels[chan].close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- try (FileOutputStream fos = new FileOutputStream(metadataFile);) {
- fos.write(metadata.getBytes());
- } catch (IOException e) {
- }
- }
-
- private static void writeToDisk(FileChannel[] channels, int chan, ByteBuffer bb) {
- try {
- bb.flip();
- channels[chan].write(bb);
- bb.clear();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- private class EventWriter {
- public static final int SIZE =
- 4 + // timestamp
- 16 + // prev_comm
- 4 + // prev_tid
- 4 + // prev_prio
- 4 + // prev_state
- 16 + // current_comm
- 4 + // next_tid
- 4; // next_prio
- private final ByteBuffer data;
-
- public EventWriter(ByteBuffer bb) {
- data = bb;
- }
-
- public int writeEvent(int ts, String prev_comm, int prev_tid, int prev_prio, int prev_state, String next_comm, int next_tid, int next_prio) {
- byte[] bOut = new byte[16];
- byte[] bIn = new byte[16];
- byte[] temp = prev_comm.getBytes();
- for (int i = 0; i < Math.min(temp.length, 16); i++) {
- bOut[i] = temp[i];
- }
- temp = next_comm.getBytes();
- for (int i = 0; i < Math.min(temp.length, 16); i++) {
- bIn[i] = temp[i];
- }
-
- int timestamp = ts << 5;
-
- data.putInt(timestamp);
- data.put(bOut);
- data.putInt(prev_tid);
- data.putInt(prev_prio);
- data.putInt(prev_state);
- data.put(bIn);
- data.putInt(next_tid);
- data.putInt(next_prio);
- return SIZE;
- }
-
- }
-
- private class PacketWriter {
- private static final int SIZE = 4096;
- private static final int HEADER_SIZE = 64;
- private static final int CONTENT_SIZE = SIZE - HEADER_SIZE;
-
- private final ByteBuffer data;
-
- public PacketWriter(ByteBuffer bb) {
- data = bb;
- }
-
- public void writeNewHeader(long tsBegin, long tsEnd, int cpu) {
- final int magicLE = 0xC1FC1FC1;
- byte uuid[] = {
- 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11 };
- // packet header
-
- // magic number 4
- data.putInt(magicLE);
- // uuid 16
- data.put(uuid);
- // stream ID 4
- data.putInt(0);
-
- // packet context
- // timestamp_begin 8
- data.putLong(tsBegin);
-
- // timestamp_end 8
- data.putLong(tsEnd);
-
- // content_size 8
- data.putLong((CONTENT_SIZE / EventWriter.SIZE * EventWriter.SIZE + HEADER_SIZE) * 8);
-
- // packet_size 8
- data.putLong((SIZE) * 8);
-
- // events_discarded 4
- data.putInt(0);
-
- // cpu_id 4
- data.putInt(cpu);
-
- }
-
- }
-
-
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StreamInputPacketIndexEntryTest</code> contains tests for the
- * class <code>{@link StreamInputPacketIndexEntry}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class CTFStreamInputPacketIndexEntryTest {
-
- private ICTFPacketDescriptor fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new StreamInputPacketIndexEntry(1L, 1L);
- }
-
- /**
- * Run the StreamInputPacketIndexEntry(long) constructor test.
- */
- @Test
- public void testStreamInputPacketIndexEntry_1() {
- String expectedResult = "StreamInputPacketIndexEntry [offsetBits=1, " +
- "timestampBegin=" + Long.MIN_VALUE +
- ", timestampEnd=" + Long.MAX_VALUE +
- "]";
-
- assertNotNull(fixture);
- assertEquals(expectedResult, fixture.toString());
- assertEquals(1, fixture.getOffsetBits());
- assertEquals(0, fixture.getOffsetBytes());
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor1() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- sd.addField("load_factor", new FloatDeclaration(24, 8, ByteOrder.nativeOrder(), 8));
- sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(100);
- bb.getByteBuffer().putInt(200);
- bb.getByteBuffer().putFloat((float) .75);
- bb.getByteBuffer().put(("Test").getBytes());
- bb.getByteBuffer().put((byte) 0);
- bb.getByteBuffer().put((byte) 0);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertNull(sipie.getTarget());
- assertEquals(100, sipie.getTimestampBegin());
- assertEquals(200, sipie.getTimestampEnd());
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor2() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
- sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(100);
- bb.getByteBuffer().putInt(200);
- bb.getByteBuffer().putInt(128);
- bb.getByteBuffer().put(("Test").getBytes());
- bb.getByteBuffer().put((byte) 0);
- bb.getByteBuffer().put((byte) 0);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertNull(sipie.getTarget());
- assertEquals(100, sipie.getTimestampBegin());
- assertEquals(200, sipie.getTimestampEnd());
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor3() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- sd.addField("packet_size", IntegerDeclaration.INT_32B_DECL);
- sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- sd.addField("intruder", new StructDeclaration(8));
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(100);
- bb.getByteBuffer().putInt(200);
- bb.getByteBuffer().putInt(128);
- bb.getByteBuffer().put(("Test").getBytes());
- bb.getByteBuffer().put((byte) 0);
- bb.getByteBuffer().put((byte) 0);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertNull(sipie.getTarget());
- assertEquals(100, sipie.getTimestampBegin());
- assertEquals(200, sipie.getTimestampEnd());
- assertTrue(sipie.includes(150));
- assertFalse(sipie.includes(10));
- assertFalse(sipie.includes(250));
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor4() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
- sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(0);
- bb.getByteBuffer().put(("Test").getBytes());
- bb.getByteBuffer().put((byte) 0);
- bb.getByteBuffer().put((byte) 0);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertNull(sipie.getTarget());
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
- assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor5() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
- sd.addField("device", StringDeclaration.getStringDeclaration(Encoding.ASCII));
- sd.addField("Enum", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(-1);
- bb.getByteBuffer().putInt(0);
- bb.getByteBuffer().put(("Test66").getBytes());
- bb.getByteBuffer().put((byte) 0);
- bb.getByteBuffer().put((byte) 0);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 0);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
- assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
- assertEquals("Test66", sipie.getTarget());
- assertEquals(66, sipie.getTargetId());
- }
-
- /**
- * Test the constructor
- *
- * @throws CTFException
- * exception
- */
- @Test
- public void testStreamInputPacketIndexEntryConstructor6() throws CTFException {
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- sd.addField("content_size", IntegerDeclaration.INT_32B_DECL);
- sd.addField("cpu_id", IntegerDeclaration.INT_32B_DECL);
- sd.addField("events_discarded", IntegerDeclaration.INT_32B_DECL);
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
- bb.getByteBuffer().putInt(-1);
- bb.getByteBuffer().putInt(0);
- bb.getByteBuffer().putInt(66);
- bb.getByteBuffer().putInt(300);
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- ICTFPacketDescriptor sipie = new StreamInputPacketIndexEntry(0, sdef, 128, 100);
- assertEquals(Long.MIN_VALUE, sipie.getTimestampBegin());
- assertEquals(Long.MAX_VALUE, sipie.getTimestampEnd());
- assertEquals("CPU66", sipie.getTarget());
- assertEquals(66, sipie.getTargetId());
- assertEquals(200, sipie.getLostEvents());
- assertEquals(0, sipie.getOffsetBits());
- assertEquals(1024, sipie.getPacketSizeBits());
- }
-
- /**
- * Run the String toString() method test.
- *
- * @throws CTFException
- * won't happen
- */
- @Test
- public void testToString() throws CTFException {
-
- String expectedResult = "StreamInputPacketIndexEntry [offsetBits=0, timestampBegin=0, timestampEnd=0]";
- StructDeclaration sd = new StructDeclaration(8);
- sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL);
- sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL);
- @SuppressWarnings("null")
- BitBuffer bb = new BitBuffer(ByteBuffer.allocate(128));
-
- StructDefinition sdef = sd.createDefinition(null, ILexicalScope.PACKET_HEADER, bb);
- assertEquals(expectedResult, new StreamInputPacketIndexEntry(0, sdef, 10000, 0).toString());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StreamInputPacketIndexTest</code> contains tests for the
- * class <code>{@link StreamInputPacketIndex}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFStreamInputPacketIndexTest {
-
- private StreamInputPacketIndex fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- fixture = new StreamInputPacketIndex();
- fixture.append(new StreamInputPacketIndexEntry(1L,0L));
- }
-
- /**
- * Run the StreamInputPacketIndex() constructor test.
- */
- @Test
- public void testStreamInputPacketIndex() {
- assertNotNull(fixture);
- assertNotNull(fixture.getElement(0));
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFResponse;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StreamInputReaderTest</code> contains tests for the class
- * <code>{@link CTFStreamInputReader}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFStreamInputReaderTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private CTFStreamInputReader fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- fixture = getStreamInputReader();
- fixture.setName(1);
- fixture.setCurrentEvent(new EventDefinition(new EventDeclaration(),
- getStreamInputReader(), 0, null, null,
- new StructDefinition(
- new StructDeclaration(0),
- null,
- "packet",
- new Definition[] { new StringDefinition(StringDeclaration.getStringDeclaration(Encoding.UTF8), null, "field", "test") }),
- null)
- );
- }
-
- private static CTFStreamInputReader getStreamInputReader() throws CTFException {
- assumeTrue(testTrace.exists());
- CTFTrace trace = testTrace.getTrace();
- CTFStream s = trace.getStream((long) 0);
- Set<CTFStreamInput> streamInput = s.getStreamInputs();
- CTFStreamInputReader retVal = null;
- for (CTFStreamInput si : streamInput) {
- /*
- * For the tests, we'll use the stream input corresponding to the
- * CPU 0
- */
- if (si.getFilename().endsWith("0_0")) {
- retVal = new CTFStreamInputReader(si);
- break;
- }
- }
- return retVal;
- }
-
- /**
- * Run the StreamInputReader(StreamInput) constructor test, with a valid
- * trace.
- */
- @Test
- public void testStreamInputReader_valid() {
- assertNotNull(fixture);
- }
-
- /**
- * Run the StreamInputReader(StreamInput) constructor test, with an invalid
- * trace.
- *
- * @throws CTFException
- * @throws IOException
- */
- @Test(expected = CTFException.class)
- public void testStreamInputReader_invalid() throws CTFException, IOException {
- CTFStreamInput streamInput = new CTFStreamInput(new CTFStream(new CTFTrace("")), new File(""));
- try (CTFStreamInputReader result = new CTFStreamInputReader(streamInput)) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the int getCPU() method test.
- */
- @Test
- public void testGetCPU() {
- int result = fixture.getCPU();
- assertEquals(0, result);
- }
-
- /**
- * Run the EventDefinition getCurrentEvent() method test.
- */
- @Test
- public void testGetCurrentEvent() {
- EventDefinition result = fixture.getCurrentEvent();
- assertNotNull(result);
- }
-
- /**
- * Run the StructDefinition getCurrentPacketContext() method test.
- */
- @Test
- public void testGetCurrentPacketContext() {
- ICompositeDefinition result = fixture.getCurrentEvent().getPacketContext();
- assertNotNull(result);
- }
-
- /**
- * Run the int getName() method test.
- */
- @Test
- public void testGetName() {
- int result = fixture.getName();
- assertEquals(1, result);
- }
-
- /**
- * Run the void goToLastEvent() method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGoToLastEvent1() throws CTFException {
- final long endTimestamp = goToEnd();
- final long endTime = 4287422460315L;
- assertEquals(endTime, endTimestamp);
- }
-
- /**
- * Run the void goToLastEvent() method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGoToLastEvent2() throws CTFException {
- long timestamp = -1;
- while (fixture.readNextEvent().equals(CTFResponse.OK)) {
- timestamp = fixture.getCurrentEvent().getTimestamp();
- }
- long endTimestamp = goToEnd();
- assertEquals(0, timestamp - endTimestamp);
- }
-
- private long goToEnd() throws CTFException {
- fixture.goToLastEvent();
- return fixture.getCurrentEvent().getTimestamp();
- }
-
- /**
- * Run the boolean readNextEvent() method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testReadNextEvent() throws CTFException {
- assertEquals(CTFResponse.OK, fixture.readNextEvent());
- }
-
- /**
- * Run the void seek(long) method test. Seek by direct timestamp
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testSeek_timestamp() throws CTFException {
- long timestamp = 1L;
- fixture.seek(timestamp);
- }
-
- /**
- * Run the seek test. Seek by passing an EventDefinition to which we've
- * given the timestamp we want.
- *
- * @throws CTFException
- */
- @Test
- public void testSeek_eventDefinition() throws CTFException {
- EventDefinition eventDefinition = new EventDefinition(
- new EventDeclaration(), getStreamInputReader(), 1L, null, null, null, null);
- fixture.setCurrentEvent(eventDefinition);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputReaderTimestampComparator;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StreamInputReaderTimestampComparatorTest</code> contains
- * tests for the class <code>{@link StreamInputReaderTimestampComparator}</code>
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class CTFStreamInputReaderTimestampComparatorTest {
-
- private StreamInputReaderTimestampComparator fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new StreamInputReaderTimestampComparator();
- }
-
- /**
- * Run the StreamInputReaderTimestampComparator() constructor test.
- */
- @Test
- public void testStreamInputReaderTimestampComparator_1() {
- assertNotNull(fixture);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StreamInputTest</code> contains tests for the class
- * <code>{@link CTFStreamInput}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFStreamInputTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private CTFStreamInput fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- assumeTrue(testTrace.exists());
- fixture = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile());
- fixture.setTimestampEnd(1L);
- }
-
- @NonNull
- private static File createFile() {
- File path = new File(testTrace.getPath());
- final File[] listFiles = path.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- if (name.contains("hann")) {
- return true;
- }
- return false;
- }
- });
- assertNotNull(listFiles);
- final File returnFile = listFiles[0];
- assertNotNull(returnFile);
- return returnFile;
- }
-
- /**
- * Run the StreamInput(Stream,FileChannel,File) constructor test.
- */
- @Test
- public void testStreamInput() {
- assertNotNull(fixture);
- }
-
- /**
- * Run the String getFilename() method test.
- */
- @Test
- public void testGetFilename() {
- String result = fixture.getFilename();
- assertNotNull(result);
- }
-
- /**
- * Run the String getPath() method test.
- */
- @Test
- public void testGetPath() {
- String result = fixture.getScopePath().getPath();
- assertNotNull(result);
- }
-
- /**
- * Run the Stream getStream() method test.
- */
- @Test
- public void testGetStream() {
- CTFStream result = fixture.getStream();
- assertNotNull(result);
- }
-
- /**
- * Run the long getTimestampEnd() method test.
- */
- @Test
- public void testGetTimestampEnd() {
- long result = fixture.getTimestampEnd();
- assertTrue(0L < result);
- }
-
- /**
- * Run the Definition lookupDefinition(String) method test.
- */
- @Test
- public void testLookupDefinition() {
- IDefinition result = fixture.lookupDefinition("id");
- assertNull(result);
- }
-
- /**
- * Run the void setTimestampEnd(long) method test.
- */
- @Test
- public void testSetTimestampEnd() {
- fixture.setTimestampEnd(1L);
- assertEquals(fixture.getTimestampEnd(), 1L);
- }
-
- CTFStreamInput s1;
- CTFStreamInput s2;
-
- @Test
- public void testEquals1() throws CTFException {
- s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
- createFile());
- assertFalse(s1.equals(null));
- }
-
- @Test
- public void testEquals2() throws CTFException {
- s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
- createFile());
- assertFalse(s1.equals(new Long(23L)));
-
- }
-
- @Test
- public void testEquals3() throws CTFException {
- s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
- createFile());
- assertEquals(s1, s1);
-
- }
-
- @Test
- public void testEquals4() throws CTFException {
- s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
- createFile());
- s2 = new CTFStreamInput(new CTFStream(testTrace.getTrace()),
- createFile());
- assertEquals(s1, s2);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInput;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * The class <code>StreamTest</code> contains tests for the class
- * <code>{@link CTFStream}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFStreamTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private CTFStream fixture;
-
- private CTFStreamInput fInput;
-
- @BeforeClass
- public static void initialize() {
- assumeTrue(testTrace.exists());
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- fixture = new CTFStream(testTrace.getTrace());
- fixture.setEventContext(new StructDeclaration(1L));
- fixture.setPacketContext(new StructDeclaration(1L));
- fixture.setEventHeader(new StructDeclaration(1L));
- fixture.setId(1L);
- fInput = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile());
- fixture.addInput(fInput);
- }
-
- @NonNull
- private static File createFile() {
- File path = new File(testTrace.getPath());
- final File[] listFiles = path.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- if (name.contains("hann")) {
- return true;
- }
- return false;
- }
- });
- assertNotNull(listFiles);
- final File returnFile = listFiles[0];
- assertNotNull(returnFile);
- return returnFile;
- }
-
- /**
- * Run the Stream(CTFTrace) constructor test.
- *
- * @throws CTFException
- */
- @Test
- public void testStream() throws CTFException {
- CTFTrace trace = testTrace.getTrace();
- CTFStream result = new CTFStream(trace);
- assertNotNull(result);
- }
-
- /**
- * Run the void addEvent(EventDeclaration) method test with the basic event.
- *
- * @throws ParseException
- */
- @Test
- public void testAddEvent_base() throws ParseException {
- EventDeclaration event = new EventDeclaration();
- fixture.addEvent(event);
- }
-
- /**
- * Run the boolean eventContextIsSet() method test.
- */
- @Test
- public void testEventContextIsSet() {
- assertTrue(fixture.isEventContextSet());
- }
-
- /**
- * Run the boolean eventContextIsSet() method test.
- */
- @Test
- public void testToString() {
- assertNotNull(fixture.toString());
- }
-
- /**
- * Run the boolean eventHeaderIsSet() method test.
- */
- @Test
- public void testEventHeaderIsSet() {
- assertTrue(fixture.isEventHeaderSet());
- }
-
- /**
- * Run the StructDeclaration getEventContextDecl() method test.
- */
- @Test
- public void testGetEventContextDecl() {
- assertNotNull(fixture.getEventContextDecl());
- }
-
- /**
- * Run the StructDeclaration getEventHeaderDecl() method test.
- */
- @Test
- public void testGetEventHeaderDecl() {
- IDeclaration eventHeaderDecl = fixture.getEventHeaderDeclaration();
- assertNotNull(eventHeaderDecl);
- }
-
- /**
- * Run the HashMap<Long, EventDeclaration> getEvents() method test.
- */
- @Test
- public void testGetEvents() {
- assertNotNull(fixture.getEventDeclarations());
- }
-
- /**
- * Run the Long getId() method test.
- */
- @Test
- public void testGetId() {
- Long result = fixture.getId();
- assertNotNull(result);
- }
-
- /**
- * Run the StructDeclaration getPacketContextDecl() method test.
- */
- @Test
- public void testGetPacketContextDecl() {
- StructDeclaration result = fixture.getPacketContextDecl();
- assertNotNull(result);
- }
-
- /**
- * Run the Set<StreamInput> getStreamInputs() method test.
- */
- @Test
- public void testGetStreamInputs() {
- Set<CTFStreamInput> result = fixture.getStreamInputs();
- assertNotNull(result);
- }
-
- /**
- * Run the CTFTrace getTrace() method test.
- */
- @Test
- public void testGetTrace() {
- CTFTrace result = fixture.getTrace();
- assertNotNull(result);
- }
-
- /**
- * Run the boolean idIsSet() method test.
- */
- @Test
- public void testIdIsSet() {
- boolean result = fixture.isIdSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean packetContextIsSet() method test.
- */
- @Test
- public void testPacketContextIsSet() {
- boolean result = fixture.isPacketContextSet();
- assertTrue(result);
- }
-
- /**
- * Run the void setEventContext(StructDeclaration) method test.
- */
- @Test
- public void testSetEventContext() {
- StructDeclaration eventContext = new StructDeclaration(1L);
- fixture.setEventContext(eventContext);
- }
-
- /**
- * Run the void setEventHeader(StructDeclaration) method test.
- */
- @Test
- public void testSetEventHeader() {
- StructDeclaration eventHeader = new StructDeclaration(1L);
- fixture.setEventHeader(eventHeader);
- }
-
- /**
- * Run the void setId(long) method test.
- */
- @Test
- public void testSetId() {
- long id = 1L;
- fixture.setId(id);
- }
-
- /**
- * Run the void setPacketContext(StructDeclaration) method test.
- */
- @Test
- public void testSetPacketContext() {
- StructDeclaration packetContext = new StructDeclaration(1L);
- fixture.setPacketContext(packetContext);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.attribute.FileAttribute;
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests growing streams
- *
- * @author Matthew Khouzam
- *
- */
-public class CTFTraceGrowingStreamTest {
-
- private Path fCtfDirectory;
- private File fGrowingStream;
- private byte[][] fPackets;
- private CTFTrace fFixture;
- private UUID fUUID;
-
- /**
- * Run before every test
- *
- * @throws IOException won't happen
- * @throws CTFException won't happen
- */
- @Before
- public void init() throws IOException, CTFException {
- fCtfDirectory = Files.createTempDirectory("temptrace", new FileAttribute<?>[] {});
- File metadata = new File(fCtfDirectory.toString() + "/" + "metadata");
- fGrowingStream = new File(fCtfDirectory.toString() + "/" + "stream");
- fUUID = UUID.randomUUID();
- fPackets = new byte[2][];
- fPackets[0] = new byte[32];
- fPackets[1] = new byte[32];
- try (PrintWriter pw = new PrintWriter(metadata)) {
- pw.println("/*CTF 1.8*/");
- pw.println("typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t;");
- pw.println("typealias integer { size = 32; align = 32; signed = false; base = hex; } := uint32_t;");
-
- pw.println("trace {");
- pw.println(" major = 0;");
- pw.println(" minor = 1;");
- pw.println(" uuid = \"" + fUUID.toString() + "\";");
- pw.println(" byte_order = le;");
- pw.println(" packet.header := struct {");
- pw.println(" uint32_t magic;");
- pw.println(" uint8_t uuid[16];");
- pw.println(" };");
- pw.println("};");
- pw.println("");
- pw.println("stream {");
- pw.println(" packet.context := struct {");
- pw.println(" uint32_t packet_size;");
- pw.println(" uint32_t content_size;");
- pw.println(" };");
- pw.println("};");
- pw.println("");
- pw.println("event {");
- pw.println(" name = thing;");
- pw.println(" fields := struct { uint32_t f; };");
- pw.println("};");
- pw.println("");
- pw.close();
- }
- setupPacket(fPackets[0], 41);
- setupPacket(fPackets[1], 0xbab4face);
-
- try (FileOutputStream fos = new FileOutputStream(fGrowingStream)) {
- fos.write(fPackets[0]);
- }
- fFixture = new CTFTrace(fCtfDirectory.toString());
- }
-
- private void setupPacket(byte data[], int value) {
- ByteBuffer bb = ByteBuffer.wrap(data);
- bb.clear();
- bb.order(ByteOrder.LITTLE_ENDIAN);
- bb.putInt(0xc1fc1fc1);
- bb.order(ByteOrder.BIG_ENDIAN);
- bb.putLong(fUUID.getMostSignificantBits());
- bb.putLong(fUUID.getLeastSignificantBits());
- bb.order(ByteOrder.LITTLE_ENDIAN);
- bb.putInt(256);
- bb.putInt(256);
- bb.putInt(value);
- }
-
- /**
- * Test a growing stream
- *
- * @throws CTFException won't happen
- * @throws IOException won't happen
- * @throws FileNotFoundException won't happen
- */
- @Test
- public void testGrowingLive() throws CTFException, FileNotFoundException, IOException {
- try (CTFTraceReader reader = new CTFTraceReader(fFixture);) {
- reader.setLive(true);
- assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
- reader.advance();
- try (FileOutputStream fos = new FileOutputStream(fGrowingStream, true)) {
- fos.write(fPackets[1]);
- }
- reader.advance();
- assertNotNull(reader.getCurrentEventDef());
- assertEquals("0xbab4face", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
- }
- }
-
- /**
- * Test a growing stream
- *
- * @throws CTFException won't happen
- * @throws IOException won't happen
- * @throws FileNotFoundException won't happen
- */
- @Test
- public void testGrowingNotLive() throws CTFException, FileNotFoundException, IOException {
- try (CTFTraceReader reader = new CTFTraceReader(fFixture);) {
- reader.setLive(false);
- assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString());
- reader.advance();
- try (FileOutputStream fos = new FileOutputStream(fGrowingStream, true)) {
- fos.write(fPackets[1]);
- }
- reader.advance();
- assertNull(reader.getCurrentEventDef());
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.eclipse.tracecompass.ctf.core.trace.Metadata;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for streaming support
- *
- * @author Matthew Khouzam
- *
- */
-public class CTFTraceGrowingTest {
- final private String fPathName = CtfTestTrace.SYNTHETIC_TRACE.getPath();
-
- final private CTFTrace fixture = new CTFTrace();
-
- /**
- * Init
- *
- * @throws IOException
- * an IO error
- * @throws FileNotFoundException
- * file's not there
- * @throws CTFException
- * error in metadata
- */
- @Before
- public void init() throws FileNotFoundException, IOException, CTFException {
- Metadata md = new Metadata(fixture);
- File metadata = new File(fPathName + "/" + "metadata");
-
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(metadata)))) {
-
- StringBuilder sb = new StringBuilder();
- String line = null;
- while ((line = reader.readLine()) != null) {
- sb.append(line);
- }
- String result = sb.toString();
- md.parseText(result);
- }
- }
-
- /**
- * Empty trace test
- *
- * @throws CTFException
- * will not happen
- */
- @Test
- public void testEmptyStream() throws CTFException {
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- assertNull(reader.getCurrentEventDef());
- }
- }
-
- /**
- * Add a stream
- *
- * @throws CTFException
- * should not happen
- */
- @Test
- public void testAddStream() throws CTFException {
- File stream = new File(fPathName + "/" + "channel1");
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- fixture.addStreamFile(stream);
- reader.update();
- assertTrue(reader.advance());
- assertNotNull(reader.getCurrentEventDef());
- }
- }
-
- /**
- * Adds two a stream
- *
- * @throws CTFException
- * should not happen
- */
- @Test
- public void testAddTwoStreams1() throws CTFException {
- File stream = new File(fPathName + "/" + "channel1");
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- fixture.addStreamFile(stream);
- stream = new File(fPathName + "/" + "channel2");
- fixture.addStreamFile(stream);
- reader.update();
- assertTrue(reader.advance());
- EventDefinition currentEventDef = reader.getCurrentEventDef();
- assertNotNull(reader.getCurrentEventDef());
- assertEquals(16518l, currentEventDef.getTimestamp());
- }
- }
-
- /**
- * Adds two a stream
- *
- * @throws CTFException
- * should not happen
- */
- @Test
- public void testAddTwoStreams2() throws CTFException {
- File stream = new File(fPathName + "/" + "channel1");
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- fixture.addStreamFile(stream);
- stream = new File(fPathName + "/" + "channel2");
- reader.update();
- assertTrue(reader.advance());
- fixture.addStreamFile(stream);
- reader.update();
- assertTrue(reader.advance());
- EventDefinition currentEventDef = reader.getCurrentEventDef();
- assertNotNull(currentEventDef);
- assertEquals(223007L, currentEventDef.getTimestamp());
- }
- }
-
- /**
- * Tests that update does not change the position
- *
- * @throws CTFException
- * should not happen
- */
- @Test
- public void testAddTwoStreams3() throws CTFException {
- File stream = new File(fPathName + "/" + "channel1");
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- fixture.addStreamFile(stream);
- stream = new File(fPathName + "/" + "channel2");
- reader.update();
- reader.update();
- reader.update();
- assertTrue(reader.advance());
- fixture.addStreamFile(stream);
- reader.update();
- reader.update();
- reader.update();
- reader.update();
- assertTrue(reader.advance());
- EventDefinition currentEventDef = reader.getCurrentEventDef();
- assertNotNull(currentEventDef);
- assertEquals(223007L, currentEventDef.getTimestamp());
- }
- }
-
- /**
- * Test adding a bad stream
- *
- * @throws CTFException
- * should happen
- */
- @Test(expected = CTFException.class)
- public void testAddStreamFail() throws CTFException {
- File stream = new File(fPathName + "/" + "metadata");
- try (CTFTraceReader reader = new CTFTraceReader(fixture);) {
- fixture.addStreamFile(stream);
- assertNull(reader.getCurrentEventDef());
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CTFTraceReaderTest</code> contains tests for the class
- * <code>{@link CTFTraceReader}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class CTFTraceReaderTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private CTFTraceReader fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- assumeTrue(testTrace.exists());
- fixture = new CTFTraceReader(testTrace.getTrace());
- }
-
- /**
- * Run the CTFTraceReader(CTFTrace) constructor test. Open a known good
- * trace.
- *
- * @throws CTFException
- */
- @Test
- public void testOpen_existing() throws CTFException {
- CTFTrace trace = testTrace.getTrace();
- try (CTFTraceReader result = new CTFTraceReader(trace);) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the CTFTraceReader(CTFTrace) constructor test. Open a non-existing
- * trace, expect the exception.
- *
- * @throws CTFException
- */
- @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
- public void testOpen_nonexisting() throws CTFException {
- CTFTrace trace = new CTFTrace("badfile.bad");
- try (CTFTraceReader result = new CTFTraceReader(trace);) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the CTFTraceReader(CTFTrace) constructor test. Try to pen an invalid
- * path, expect exception.
- *
- * @throws CTFException
- */
- @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
- public void testOpen_invalid() throws CTFException {
- CTFTrace trace = new CTFTrace("");
- try (CTFTraceReader result = new CTFTraceReader(trace);) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the boolean advance() method test. Test advancing normally.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testAdvance_normal() throws CTFException {
- boolean result = fixture.advance();
- assertTrue(result);
- }
-
- /**
- * Run the boolean advance() method test. Test advancing when we're at the
- * end, so we expect that there is no more events.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testAdvance_end() throws CTFException {
- int i = 0;
- boolean result = fixture.advance();
- while (result) {
- result = fixture.advance();
- i++;
- }
- fixture.seek(0);
- fixture.advance();
- fixture.goToLastEvent();
- i = 1;
- result = fixture.advance();
- while (result) {
- result = fixture.advance();
- i++;
- }
- assertFalse(result);
- assertEquals(i, 1);
- }
-
- /**
- * Run the CTFTraceReader copy constructor test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testCopyFrom() throws CTFException {
- try (CTFTraceReader result = fixture.copyFrom();) {
- assertNotNull(result);
- }
- }
-
- /**
- * Test the hashCode method.
- */
- @Test
- public void testHash() {
- int result = fixture.hashCode();
- assertTrue(0 != result);
- }
-
- /**
- * Test the equals method. Uses the class-wide 'fixture' and another
- * method-local 'fixture2', which both point to the same trace.
- *
- * Both trace reader are different objects, so they shouldn't "equals" each
- * other.
- *
- * @throws CTFException
- */
- @Test
- public void testEquals() throws CTFException {
- try (CTFTraceReader fixture2 = new CTFTraceReader(testTrace.getTrace());) {
- assertEquals(fixture, fixture2);
- }
- }
-
- /**
- * Run the getCurrentEventDef() method test. Get the first event's
- * definition.
- */
- @Test
- public void testGetCurrentEventDef_first() {
- EventDefinition result = fixture.getCurrentEventDef();
- assertNotNull(result);
- }
-
- /**
- * Run the getCurrentEventDef() method test. Get the last event's
- * definition.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGetCurrentEventDef_last() throws CTFException {
- fixture.goToLastEvent();
- EventDefinition result = fixture.getCurrentEventDef();
- assertNotNull(result);
- }
-
- /**
- * Run the long getEndTime() method test.
- */
- @Test
- public void testGetEndTime() {
- long result = fixture.getEndTime();
- assertTrue(0L < result);
- }
-
- /**
- * Run the long getStartTime() method test.
- */
- @Test
- public void testGetStartTime() {
- long result = fixture.getStartTime();
- assertTrue(0L < result);
- }
-
- /**
- * Run the void goToLastEvent() method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testGoToLastEvent() throws CTFException {
- fixture.goToLastEvent();
- long ts1 = getTimestamp();
- long ts2 = fixture.getEndTime();
- assertEquals(ts1, ts2);
- }
-
- /**
- * Run the boolean hasMoreEvents() method test.
- *
- * @throws CTFException
- */
- @Test
- public void testHasMoreEvents() {
- boolean result = fixture.hasMoreEvents();
- assertTrue(result);
- }
-
- /**
- * Run the void printStats() method test with no 'width' parameter.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_noparam() throws CTFException {
- fixture.advance();
- fixture.printStats();
- }
-
- /**
- * Run the void printStats(int) method test with width = 0.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_width0() throws CTFException {
- fixture.advance();
- fixture.printStats(0);
- }
-
- /**
- * Run the void printStats(int) method test with width = 1.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_width1() throws CTFException {
- fixture.advance();
- fixture.printStats(1);
- }
-
- /**
- * Run the void printStats(int) method test with width = 2.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_width2() throws CTFException {
- fixture.advance();
- fixture.printStats(2);
- }
-
- /**
- * Run the void printStats(int) method test with width = 10.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_width10() throws CTFException {
- fixture.advance();
- fixture.printStats(10);
- }
-
- /**
- * Run the void printStats(int) method test with width = 100.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testPrintStats_100() throws CTFException {
- for (int i = 0; i < 1000; i++) {
- fixture.advance();
- }
- fixture.printStats(100);
- }
-
- /**
- * Run the boolean seek(long) method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testSeek() throws CTFException {
- long timestamp = 1L;
- boolean result = fixture.seek(timestamp);
- assertTrue(result);
- }
-
- /**
- * @return
- */
- private long getTimestamp() {
- if (fixture.getCurrentEventDef() != null) {
- return fixture.getTrace().timestampCyclesToNanos(fixture.getCurrentEventDef().getTimestamp());
- }
- return -1;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Marc-Andre Laperle - Test in traces directory recursively
- * Simon Delisle - Add test for getCallsite(eventName, ip)
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.nio.ByteOrder;
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.CTFClock;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CTFTraceTest</code> contains tests for the class
- * <code>{@link CTFTrace}</code>.
- *
- * @author ematkho
- */
-public class CTFTraceTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private CTFTrace fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- assumeTrue(testTrace.exists());
- try {
- fixture = testTrace.getTraceFromFile();
- } catch (CTFException e) {
- /* If the assumeTrue() call passed, this should not happen. */
- fail();
- }
- fixture.setMinor(1L);
- fixture.setUUID(UUID.randomUUID());
- fixture.setPacketHeader(new StructDeclaration(1L));
- fixture.setMajor(1L);
- fixture.setByteOrder(ByteOrder.BIG_ENDIAN);
- }
-
- /**
- * Run the CTFTrace(File) constructor test with a known existing trace.
- */
- @Test
- public void testOpen_existing() {
- try {
- CTFTrace result = testTrace.getTraceFromFile();
- assertNotNull(result.getUUID());
- } catch (CTFException e) {
- fail();
- }
- }
-
- /**
- * Run the CTFTrace(File) constructor test with an invalid path.
- *
- * @throws CTFException
- * is expected
- */
- @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class)
- public void testOpen_invalid() throws CTFException {
- File path = new File("");
- CTFTrace result = new CTFTrace(path);
- assertNotNull(result);
- }
-
- /**
- * Run the boolean UUIDIsSet() method test.
- */
- @Test
- public void testUUIDIsSet() {
- boolean result = fixture.uuidIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the void addStream(Stream) method test.
- */
- @Test
- public void testAddStream() {
- // test number of streams
- int nbStreams = fixture.nbStreams();
- assertEquals(1, nbStreams);
-
- // Add a stream
- try {
- CTFStream stream = new CTFStream(testTrace.getTrace());
- stream.setId(1234);
- fixture.addStream(stream);
- } catch (CTFException e) {
- fail();
- } catch (ParseException e) {
- fail();
- }
-
- // test number of streams
- nbStreams = fixture.nbStreams();
- assertEquals(2, nbStreams);
- }
-
- /**
- * Run the boolean byteOrderIsSet() method test.
- */
- @Test
- public void testByteOrderIsSet() {
- boolean result = fixture.byteOrderIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the ByteOrder getByteOrder() method test.
- */
- @Test
- public void testGetByteOrder_1() {
- ByteOrder result = fixture.getByteOrder();
- assertNotNull(result);
- }
-
- /**
- * Run the long getMajor() method test.
- */
- @Test
- public void testGetMajor() {
- long result = fixture.getMajor();
- assertEquals(1L, result);
- }
-
- /**
- * Run the long getMinor() method test.
- */
- @Test
- public void testGetMinor() {
- long result = fixture.getMinor();
- assertEquals(1L, result);
- }
-
- /**
- * Run the StructDeclaration getPacketHeader() method test.
- */
- @Test
- public void testGetPacketHeader() {
- StructDeclaration result = fixture.getPacketHeader();
- assertNotNull(result);
- }
-
- /**
- * Run the String getPath() method test.
- */
- @Test
- public void testGetPath() {
- String result = fixture.getPath();
- assertNotNull(result);
- }
-
- /**
- * Run the Stream getStream(Long) method test.
- */
- @Test
- public void testGetStream() {
- Long id = new Long(0L);
- CTFStream result = fixture.getStream(id);
- assertNotNull(result);
- }
-
- /**
- * Run the File getTraceDirectory() method test.
- */
- @Test
- public void testGetTraceDirectory() {
- File result = fixture.getTraceDirectory();
- assertNotNull(result);
- }
-
- /**
- * Run the UUID getUUID() method test.
- */
- @Test
- public void testGetUUID() {
- UUID result = fixture.getUUID();
- assertNotNull(result);
- }
-
- /**
- * Run the Definition lookupDefinition(String) method test.
- */
- @Test
- public void testLookupDefinition() {
- String lookupPath = "trace.packet.header";
- IDefinition result = fixture.lookupDefinition(lookupPath);
- assertNotNull(result);
- }
-
- /**
- * Run the boolean majorIsSet() method test.
- */
- @Test
- public void testMajorIsSet() {
- boolean result = fixture.majorIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean minorIsSet() method test.
- */
- @Test
- public void testMinorIsSet() {
- boolean result = fixture.minorIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean packetHeaderIsSet() method test with a valid header set.
- */
- @Test
- public void testPacketHeaderIsSet_valid() {
- boolean result = fixture.packetHeaderIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean packetHeaderIsSet() method test, without having a valid
- * header set.
- */
- @Test
- public void testPacketHeaderIsSet_invalid() {
- try {
- CTFTrace fixture2 = testTrace.getTraceFromFile();
- fixture2.setMinor(1L);
- fixture2.setUUID(UUID.randomUUID());
- /*
- * it's null here!
- */
- fixture2.setPacketHeader((StructDeclaration) null);
- fixture2.setMajor(1L);
- fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
-
- boolean result = fixture2.packetHeaderIsSet();
- assertFalse(result);
- } catch (CTFException e) {
- fail();
- }
- }
-
- /**
- * Run the void setByteOrder(ByteOrder) method test.
- */
- @Test
- public void testSetByteOrder() {
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
- fixture.setByteOrder(byteOrder);
- }
-
- /**
- * Run the void setMajor(long) method test.
- */
- @Test
- public void testSetMajor() {
- long major = 1L;
- fixture.setMajor(major);
- }
-
- /**
- * Run the void setMinor(long) method test.
- */
- @Test
- public void testSetMinor() {
- long minor = 1L;
- fixture.setMinor(minor);
- }
-
- /**
- * Run the void setPacketHeader(StructDeclaration) method test.
- */
- @Test
- public void testSetPacketHeader() {
- StructDeclaration packetHeader = new StructDeclaration(1L);
- fixture.setPacketHeader(packetHeader);
- }
-
- /**
- * Run the void setUUID(UUID) method test.
- */
- @Test
- public void testSetUUID() {
- UUID uuid = UUID.randomUUID();
- fixture.setUUID(uuid);
- }
-
- /**
- * Run the CTFClock getClock/setClock method test.
- */
- @Test
- public void testGetSetClock_1() {
- String name = "clockyClock";
- fixture.addClock(name, new CTFClock());
- CTFClock result = fixture.getClock(name);
-
- assertNotNull(result);
- }
-
- /**
- * Run the CTFClock getClock/setClock method test.
- */
- @Test
- public void testGetSetClock_2() {
- String name = "";
- CTFClock ctfClock = new CTFClock();
- ctfClock.addAttribute("name", "Bob");
- ctfClock.addAttribute("pi", new Double(java.lang.Math.PI));
- fixture.addClock(name, ctfClock);
- CTFClock result = fixture.getClock(name);
-
- assertNotNull(result);
- assertTrue((Double) ctfClock.getProperty("pi") > 3.0);
- assertTrue(ctfClock.getName().equals("Bob"));
- }
-
- /**
- * Run the String lookupEnvironment(String) method test.
- */
- @Test
- public void testLookupEnvironment_1() {
- String key = "";
- String result = fixture.getEnvironment().get(key);
- assertNull(result);
- }
-
- /**
- * Run the String lookupEnvironment(String) method test.
- */
- @Test
- public void testLookupEnvironment_2() {
- String key = "otherTest";
- String result = fixture.getEnvironment().get(key);
- assertNull(result);
- }
-
- /**
- * Run the String lookupEnvironment(String) method test.
- */
- @Test
- public void testLookupEnvironment_3() {
- String key = "test";
- fixture.addEnvironmentVar(key, key);
- String result = fixture.getEnvironment().get(key);
- assertTrue(result.equals(key));
- }
-
- /**
- * Run the String lookupEnvironment(String) method test.
- */
- @Test
- public void testLookupEnvironment_4() {
- String key = "test";
- fixture.addEnvironmentVar(key, "bozo");
- fixture.addEnvironmentVar(key, "the clown");
- String result = fixture.getEnvironment().get(key);
- assertNotNull(result);
- }
-
- /**
- * Test for getCallsite(eventName, ip)
- *
- * @throws CTFException
- * not expected
- */
- @Test
- public void callsitePosition() throws CTFException {
- long ip1 = 2;
- long ip2 = 5;
- long ip3 = 7;
- CTFTrace callsiteTest = testTrace.getTraceFromFile();
- callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
- callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
- callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
-
- assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
- assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
- assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
- assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
- assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
- assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
- assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.net.URISyntaxException;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceWriter;
-import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * CTFTraceWriter test cases
- *
- * @author Bernd Hufmann
- *
- */
-@SuppressWarnings("javadoc")
-@RunWith(Parameterized.class)
-public class CTFTraceWriterTest {
-
- private static File fTempDir;
-
- // Trace details
- private static final long CLOCK_OFFSET = 1332166405241713987L;
- private static final int TOTAL_NB_EVENTS = 695319;
- private static final long LAST_EVENT_TIME = 1332170692664579801L;
-
- // Stream 0 values
- private static final long STREAM0_FIRST_PACKET_TIME = CLOCK_OFFSET + 4277170993912L;
- private static final long STREAM0_FIRST_EVENT_TIME = 1332170682440316151L;
- private static final long STREAM0_LAST_EVENT_TIME = 1332170682702066969L;
- private static final int STREAM0_FIRST_PACKET_NB_EVENTS = 14219;
-
- // Stream 1 values
- private static final long STREAM1_FIRST_PACKET_TIME = CLOCK_OFFSET + 4277171555436L;
- private static final int STREAM1_FIRST_PACKET_NB_EVENTS = 8213;
- private static final long STREAM1_FIRST_EVENT_TIME = 1332170682440133097L;
- private static final long STREAM1_FIFTH_PACKET_TIME = CLOCK_OFFSET + 4277970712221L;
- private static final long STREAM1_TENTH_PACKET_TIME = CLOCK_OFFSET + 4279440048309L;
- private static final long STREAM1_FIFTH_PACKET_FIRST_EVENT_TIME = 1332170683212426208L;
- private static final long STREAM1_TENTH_PACKET_LAST_EVENT_TIME = 1332170685256508077L;
-
- // Miscellaneous
- private static final int NB_EVENTS_SEVERAL_PACKETS = 138894;
-
- // Test parameters
- private String fName;
- private long fStartTime;
- private long fEndTime;
- private int fNbEvents;
- private long fFirstEventTime;
- private long fLastEventTime;
-
- /**
- * Gets a list of test case parameters.
- *
- * @return The list of test parameters
- */
- @Parameters(name = "{index}: {0}")
- public static Iterable<Object[]> getTestParams() {
- final List<Object[]> params = new LinkedList<>();
-
- addParams(params, "WHOLE_TRACE",
- 0,
- Long.MAX_VALUE,
- TOTAL_NB_EVENTS,
- STREAM1_FIRST_EVENT_TIME,
- LAST_EVENT_TIME);
-
- addParams(params, "NO_EVENTS_USING_INVERTED_TIME",
- Long.MAX_VALUE, Long.MIN_VALUE,
- 0,
- -1,
- -1);
-
- addParams(params, "NO_EVENTS_USING_FIRST_PACKET",
- STREAM0_FIRST_PACKET_TIME + 1,
- STREAM0_FIRST_PACKET_TIME + 1,
- 0,
- -1,
- -1);
-
- addParams(params, "STREAM0_FIRST_PACKET_TIME",
- STREAM0_FIRST_PACKET_TIME,
- STREAM0_FIRST_PACKET_TIME,
- STREAM0_FIRST_PACKET_NB_EVENTS,
- STREAM0_FIRST_EVENT_TIME,
- STREAM0_LAST_EVENT_TIME);
-
- addParams(params, "BOTH_STREAMS_FIRST_PACKET_ONLY",
- STREAM0_FIRST_PACKET_TIME,
- STREAM1_FIRST_PACKET_TIME,
- STREAM0_FIRST_PACKET_NB_EVENTS + STREAM1_FIRST_PACKET_NB_EVENTS,
- STREAM1_FIRST_EVENT_TIME,
- STREAM0_LAST_EVENT_TIME);
-
- addParams(params, "BOTH_STREAMS_SEVERAL_PACKETS",
- STREAM1_FIFTH_PACKET_TIME,
- STREAM1_TENTH_PACKET_TIME,
- NB_EVENTS_SEVERAL_PACKETS,
- STREAM1_FIFTH_PACKET_FIRST_EVENT_TIME,
- STREAM1_TENTH_PACKET_LAST_EVENT_TIME);
-
- return params;
- }
-
- private static void addParams(List<Object[]> params, String name, long startTime, long endTime, int nbEvents, long firstEventTime, long lastEventTime) {
- Object array[] = new Object[] { name, startTime, endTime, nbEvents, firstEventTime, lastEventTime };
- params.add(array);
- }
-
- @BeforeClass
- public static void beforeClass() {
- String property = System.getProperty("osgi.instance.area"); //$NON-NLS-1$
- File dir = null;
- if (property != null) {
- try {
- dir = URIUtil.toFile(URIUtil.fromString(property));
- dir = new File(dir.getAbsolutePath() + File.separator);
- if (!dir.exists()) {
- dir.mkdirs();
- }
- } catch (URISyntaxException e) {
- }
- }
- if (dir == null) {
- dir = new File(System.getProperty("java.io.tmpdir")); //$NON-NLS-1$)
- }
- String tempDir = dir.getAbsolutePath() + File.separator + "testcases" + File.separator;
- fTempDir = new File(tempDir);
- if (!fTempDir.exists()) {
- fTempDir.mkdirs();
- }
- }
-
- public CTFTraceWriterTest (String name, long startTime, long endTime, int nbEvents, long firstEventTime, long lastEventTime) {
- fName = name;
- fStartTime = startTime;
- fEndTime = endTime;
- fNbEvents = nbEvents;
- fFirstEventTime = firstEventTime;
- fLastEventTime = lastEventTime;
- }
-
- /**
- * Test various time ranges
- */
- @Test
- public void testKernelTrace() {
- assumeTrue(CtfTestTrace.KERNEL.exists());
- try {
- CTFTrace trace = CtfTestTrace.KERNEL.getTrace();
- CTFTraceWriter ctfWriter = new CTFTraceWriter(checkNotNull(trace));
- String traceName = createTraceName(fName);
- ctfWriter.copyPackets(fStartTime, fEndTime, traceName);
-
- File metadata = new File(traceName + Utils.SEPARATOR + "metadata");
- assertTrue("metadata", metadata.exists());
-
- CTFTrace outTrace = new CTFTrace(traceName);
- int count = 0;
- Long start = null;
- long end = 0;
- try (CTFTraceReader reader = new CTFTraceReader(outTrace)) {
- while(reader.hasMoreEvents()) {
- count++;
- EventDefinition def = reader.getCurrentEventDef();
- end = def.getTimestamp();
- if (start == null) {
- start = outTrace.getClock().getClockOffset() + reader.getStartTime();
- }
- reader.advance();
- }
- end = outTrace.getClock().getClockOffset() + end;
- }
-
- if (fFirstEventTime >= 0) {
- assertEquals("first event time", Long.valueOf(fFirstEventTime), start);
- }
- if (fLastEventTime >= 0) {
- assertEquals("last event time", fLastEventTime, end);
- }
- assertEquals(toString(), fNbEvents, count);
-
- if (fNbEvents == 0) {
- assertFalse("channel0", getChannelFile(traceName, 0).exists());
- assertFalse("channel1", getChannelFile(traceName, 1).exists());
- }
-
- } catch (CTFException e) {
- fail();
- }
- }
-
- private static File getChannelFile(String path, int id) {
- File channel = new File(path + Utils.SEPARATOR + "channel_" + String.valueOf(id));
- return channel;
- }
-
- private static String createTraceName(String testCase) {
- return fTempDir.getAbsolutePath() + File.separator + testCase.toString();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Delisle - Generate dummy trace
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.IOStructGen;
-import org.junit.Test;
-
-/**
- * Unit tests for {@link IOStructGen}
- *
- * @author Matthew Khouzam
- */
-public class IOstructgenTest {
-
- private static final String metadataDecs = "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n"
- + "typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n"
- + "typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n"
- + "typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n"
- + "typealias integer { size = 64; align = 8; signed = false; } := unsigned long;\n"
- + "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
- + "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
- + "typealias integer { size = 32; align = 1; signed = true; base = decimal; } := int32_t;\n"
- + "typealias integer { size = 31; align = 1; signed = true; base = dec; } := int31_t;\n"
- + "typealias integer { size = 30; align = 1; signed = true; base = d; } := int30_t;\n"
- + "typealias integer { size = 29; align = 1; signed = true; base = i; } := int29_t;\n"
- + "typealias integer { size = 28; align = 1; signed = true; base = u; } := int28_t;\n"
- + "typealias integer { size = 27; align = 1; signed = true; base = hexadecimal; } := int27_t;\n"
- + "typealias integer { size = 26; align = 1; signed = true; base = hex; } := int26_t;\n"
- + "typealias integer { size = 25; align = 1; signed = true; base = x; } := int25_t;\n"
- + "typealias integer { size = 24; align = 1; signed = true; base = X; } := int24_t;\n"
- + "typealias integer { size = 23; align = 1; signed = true; base = p; } := int23_t;\n"
- + "typealias integer { size = 22; align = 1; signed = true; base = 16; } := int22_t;\n"
- + "typealias integer { size = 21; align = 1; signed = true; base = oct; } := int21_t;\n"
- + "typealias integer { size = 20; align = 1; signed = true; base = b; } := int20_t;\n"
- + "typealias integer { size = 19; align = 1; signed = true; base = octal; } := int19_t;\n"
- + "typealias integer { size = 18; align = 1; signed = true; base = o; } := int18_t;\n"
- + "typealias integer { size = 17; align = 1; signed = true; base = binary; } := int17_t;\n"
- + "\n"
- + "trace {\n"
- + " major = 1;\n"
- + " minor = 8;\n"
- + " uuid = \"b04d391b-e736-44c1-8d89-4bb438857f8d\";\n"
- + " byte_order = le;\n"
- + " packet.header := struct {\n"
- + " uint32_t magic;\n"
- + " uint8_t uuid[16];\n"
- + " uint32_t stream_id;\n" + " };\n" + "};\n" + "\n";
- private static final String environmentMD = "env {\n"
- + " hostname = \"DemoSystem\";\n"
- + " vpid = 1337;\n"
- + " procname = \"demo\";\n"
- + " domain = \"autogenerated\";\n"
- + " tracer_name = \"tmf\";\n"
- + " tracer_major = 2;\n"
- + " tracer_minor = 0x01;\n"
- + " tracer_patchlevel = 0;\n"
- + "};\n" + "\n";
- private static final String clockMD = "clock {\n" + " name = monotonic;\n"
- + " uuid = \"cbf9f42e-9be7-4798-a96f-11db556e2ebb\";\n"
- + " description = \"Monotonic Clock\";\n"
- + " freq = 1000000000; /* Frequency, in Hz */\n"
- + " /* clock value offset from Epoch is: offset * (1/freq) */\n"
- + " offset = 1350310657466295832;\n" + "};\n"
- + "\n";
-
- private static final String ctfStart =
- "typealias integer {\n"
- + " size = 27; align = 1; signed = false;\n"
- + " map = clock.monotonic.value;\n"
- + "} := uint27_clock_monotonic_t;\n"
- + "\n"
- + "typealias integer {\n"
- + " size = 32; align = 8; signed = false;\n"
- + " map = clock.monotonic.value;\n"
- + "} := uint32_clock_monotonic_t;\n"
- + "\n"
- + "typealias integer {\n"
- + " size = 64; align = 8; signed = false;\n"
- + " map = clock.monotonic.value;\n"
- + "} := uint64_clock_monotonic_t;\n"
- + "\n";
-
- private static final String ctfHeaders =
- "struct packet_context {\n"
- + " uint64_clock_monotonic_t timestamp_begin;\n"
- + " uint64_clock_monotonic_t timestamp_end;\n"
- + " uint64_t content_size;\n"
- + " uint64_t packet_size;\n"
- + " unsigned long events_discarded;\n"
- + " uint32_t cpu_id;\n"
- + "};\n"
- + "\n"
- + "struct event_header_compact {\n"
- + " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
- + " variant <id> {\n"
- + " struct {\n"
- + " uint27_clock_monotonic_t timestamp;\n"
- + " } compact;\n"
- + " struct {\n"
- + " uint32_t id;\n"
- + " uint64_clock_monotonic_t timestamp;\n"
- + " } extended;\n"
- + " } v;\n"
- + "} align(8);\n"
- + "\n"
- + "struct event_header_large {\n"
- + " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
- + " variant <id> {\n" + " struct {\n"
- + " uint32_clock_monotonic_t timestamp;\n"
- + " } compact;\n" + " struct {\n"
- + " uint32_t id;\n"
- + " uint64_clock_monotonic_t timestamp;\n"
- + " } extended;\n" + " } v;\n" + "} align(8);\n" + "\n";
-
- private static final String ctfBody = "stream {\n"
- + " id = 0;\n"
- + " event.header := struct event_header_compact;\n"
- + " packet.context := struct packet_context;\n"
- + " event.context := struct {\n"
- + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 16; } _ip;\n"
- + " };\n"
- + "};\n"
- + "\n"
- + "event {\n"
- + " name = \"ust_tests_demo3:done\";\n"
- + " id = 0;\n"
- + " stream_id = 0;\n"
- + " loglevel = 4;\n"
- + " fields := struct {\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
- + " };\n"
- + "};\n"
- + "\n"
- + "event {\n"
- + " name = \"ust_tests_demo:starting\";\n"
- + " id = 1;\n"
- + " stream_id = 0;\n"
- + " loglevel = 2;\n"
- + " model.emf.uri = \"http://example.com/path_to_model?q=ust_tests_demo:starting\";\n"
- + " fields := struct {\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
- + " };\n"
- + "};\n"
- + "\n"
- + "event {\n"
- + " name = \"ust_tests_demo:done\";\n"
- + " id = 2;\n"
- + " stream_id = 0;\n"
- + " loglevel = 2;\n"
- + " model.emf.uri = \"http://example.com/path_to_model?q=ust_tests_demo:done\";\n"
- + " fields := struct {\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _value;\n"
- + " };\n"
- + "};\n"
- + "\n"
- + "event {\n"
- + " name = \"ust_tests_demo2:loop\";\n"
- + " id = 3;\n"
- + " stream_id = 0;\n"
- + " loglevel = 4;\n"
- + " fields := struct {\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _intfield;\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 16; } _intfield2;\n"
- + " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _longfield;\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; byte_order = be; } _netintfield;\n"
- + " integer { size = 32; align = 8; signed = 1; encoding = none; base = 16; byte_order = be; } _netintfieldhex;\n"
- + " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _arrfield1[3];\n"
- + " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _arrfield2[10];\n"
- + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 10; } __seqfield1_length;\n"
- + " integer { size = 8; align = 8; signed = 1; encoding = none; base = 10; } _seqfield1[ __seqfield1_length ];\n"
- + " integer { size = 64; align = 8; signed = 0; encoding = none; base = 10; } __seqfield2_length;\n"
- + " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _seqfield2[ __seqfield2_length ];\n"
- + " string _stringfield;\n"
- + " floating_point { exp_dig = 8; mant_dig = 24; align = 8; } _floatfield;\n"
- + " floating_point { exp_dig = 11; mant_dig = 53; align = 8; } _doublefield;\n"
- + " };\n"
- + "};\n"
- + "\n";
-
- private static final String enumMd =
- "typealias integer { size = 32; align = 8; signed = false; } := int;\n"
- + "typealias enum { ONE = 0, a,b,c=10, d} := useless_enum;\n"
- + "struct useless{ \n"
- + " enum : uint8_t { A=0, \"B\",} enum3;\n"
- + " useless_enum enum2;"
- + " enum { C, D, E } enum4;\n"
- + " uint16_t val;\n"
- + "} ;\n"
- + "\n"
- + "event {\n"
- + " name = \"enumEvent\";\n"
- + " id = 6;\n"
- + " stream_id = 0;\n"
- + " loglevel = 5;\n"
- + " fields := struct{\n"
- + " uint16_t _some_field;\n"
- // + " useless junk;\n"
- // + " bad_enum a;\n"
- + " enum {A, B, C = 3 , } _other_enum;\n"
- + " };\n"
- + "};\n"
- + "\n";
-
- private final static String contextMD =
- "event {\n" +
- " name = \"someOtherEvent\";\n" +
- " id = 5;\n" +
- " stream_id = 0;\n" +
- " loglevel = 5;\n" +
- " context := struct{\n" +
- " uint16_t _someContext;\n" +
- " };\n" +
- " fields := struct{\n" +
- " uint16_t _somefield;\n" +
- " };\n" +
- "};\n " +
- "\n";
-
- private static final String callsiteMD =
- "callsite {\n"
- + " name = \"ust_tests_demo2:loop\";\n"
- + " func = \"main\";\n" + " ip = 0x400a29;\n"
- + " file = \"demo.c\";\n" + " line = 59;\n" + "};\n" + "\n"
- + "callsite {\n" + " name = \"ust_tests_demo3:done\";\n"
- + " func = \"main\";\n" + " ip = 0x400a6c;\n"
- + " file = \"demo.c\";\n" + " line = 62;\n" + "};\n" + "\n"
- + "callsite {\n" + " name = \"ust_tests_demo:done\";\n"
- + " func = \"main\";\n" + " ip = 0x400aaf;\n"
- + " file = \"demo.c\";\n" + " line = 61;\n" + "};\n" + "\n"
- + "callsite {\n" + " name = \"ust_tests_demo:starting\";\n"
- + " func = \"main\";\n" + " ip = 0x400af2;\n"
- + " file = \"demo.c\";\n" + " line = 55;\n" + "};\n";
-
- private static final String simpleTSDL = metadataDecs + ctfStart + ctfHeaders
- + ctfBody;
- private static final String enumTSDL = metadataDecs + ctfStart + ctfHeaders
- + ctfBody + enumMd;
- private static final String clockTSDL = metadataDecs + clockMD + ctfStart
- + ctfHeaders + ctfBody;
- private static final String envTSDL = metadataDecs + environmentMD + ctfStart
- + ctfHeaders + ctfBody;
- private static final String contextTSDL = metadataDecs + environmentMD + ctfStart
- + ctfHeaders + ctfBody + contextMD;
- private static final String callsiteTSDL = metadataDecs + ctfStart + ctfHeaders
- + ctfBody + callsiteMD;
- private static final String allDressedTSDL = metadataDecs + environmentMD + clockMD
- + ctfStart + ctfHeaders + ctfBody + enumMd + callsiteMD;
-
- static final String tempTraceDir = CtfCoreTestPlugin.getTemporaryDirPath()
- + File.separator + "tempTrace";
-
- private static final int DATA_SIZE = 4096;
-
- private static final int HEADER_SIZE = 68;
-
- private static final int PACKET_SIZE = DATA_SIZE + HEADER_SIZE + 512;
-
- private CTFTrace trace;
-
- private static class Event {
- private static final int EVENT_SIZE = 16;
- private int eventId;
- private int eventTimestamp;
- private int eventContent;
-
- public Event(int id, int content) {
- eventId = id;
- eventTimestamp = 0;
- eventContent = content;
- }
-
- public void setEventTimestamp(int eventTimestamp) {
- this.eventTimestamp = eventTimestamp;
- }
-
- public void setEventContent(int eventContent) {
- this.eventContent = eventContent;
- }
-
- public void writeEvent(ByteBuffer data) {
- // Id and Timestamp
- int timeId = eventTimestamp << 5;
- timeId |= eventId & 0x1f;
- data.putInt(timeId);
-
- // Context
- long ip = 0x0000facedecafe00L + ((data.position() /
- getSize()) & 0x0F);
- data.putLong(ip);
-
- // Content
- data.putInt(eventContent);
-
- }
-
- public int getSize() {
- return EVENT_SIZE;
- }
-
- }
-
- private static void deltree(File f) {
- for (File elem : f.listFiles()) {
- if (elem.isDirectory()) {
- deltree(elem);
- }
- elem.delete();
- }
- f.delete();
- }
-
- private static void createDummyTrace(String metadata) {
- File dir = new File(tempTraceDir);
- if (dir.exists()) {
- deltree(dir);
- }
- dir.mkdirs();
-
- File metadataFile = new File(tempTraceDir + "/metadata");
- try (FileWriter fw = new FileWriter(metadataFile);) {
- fw.write(metadata);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- byte magicLE[] = { (byte) 0xC1, (byte) 0x1F, (byte) 0xFC,
- (byte) 0xC1 };
- byte uuid[] = { (byte) 0xb0, 0x4d, 0x39, 0x1b, (byte) 0xe7,
- 0x36, 0x44, (byte) 0xc1, (byte) 0x8d, (byte) 0x89, 0x4b,
- (byte) 0xb4, 0x38, (byte) 0x85, 0x7f, (byte) 0x8d };
-
- Event ev = new Event(2, 2);
-
- final int nbEvents = (DATA_SIZE / ev.getSize()) - 1;
- final int contentSize = (nbEvents * ev.getSize() +
- HEADER_SIZE) * 8;
-
- ByteBuffer data = ByteBuffer.allocate(PACKET_SIZE);
- data.order(ByteOrder.LITTLE_ENDIAN);
- data.clear();
-
- // packet header
- // magic number 4
- data.put(magicLE);
- // uuid 16
- data.put(uuid);
- // stream ID 4
- data.putInt(0);
-
- // packet context
- // timestamp_begin 8
- data.putLong(0xa500);
-
- // timestamp_end 8
- data.putLong(nbEvents * 0x10000 + 0xa5a6);
-
- // content_size 8
- data.putLong(contentSize);
-
- // packet_size 8
- data.putLong(PACKET_SIZE * 8);
-
- // events_discarded 8
- data.putLong(0);
-
- // cpu_id 4
- data.putInt(0);
-
- // fill me
- for (int i = 0; i < nbEvents; i++) {
- ev.setEventTimestamp(i * 0x10000 + 0xa5a5);
- ev.setEventContent(i);
- ev.writeEvent(data);
- }
-
- // The byteBuffer needs to be flipped in file writing mode
- data.flip();
-
- File dummyFile = new File(tempTraceDir + "/dummyChan");
- try (FileOutputStream fos = new FileOutputStream(dummyFile);) {
- fos.getChannel().write(data);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- * Simple test (only the minimum)
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLSimpleTest() throws CTFException {
- createDummyTrace(simpleTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test with environment variables
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLEnvironmentTest() throws CTFException {
- createDummyTrace(envTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test with Clocks
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLEnumTest() throws CTFException {
- createDummyTrace(enumTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test with Clocks
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLClockTest() throws CTFException {
- createDummyTrace(clockTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test with Contexts
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLContextTest() throws CTFException {
- createDummyTrace(contextTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test with Callsites
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLCallsiteTest() throws CTFException {
- createDummyTrace(callsiteTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
- }
-
- /**
- * Test everything
- *
- * @throws CTFException
- * something wrong happened
- */
- @Test
- public void TSDLAllTest() throws CTFException {
- createDummyTrace(allDressedTSDL);
- trace = new CTFTrace(tempTraceDir);
- assertNotNull(trace);
-
- final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
- final EventDeclaration eventDeclaration = (EventDeclaration) eventDeclarations.get(2);
- assertEquals("http://example.com/path_to_model?q=ust_tests_demo:done",
- eventDeclaration.getCustomAttribute("model.emf.uri"));
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.trace.Metadata;
-import org.junit.Test;
-
-/**
- * There are so many it makes sense to move them to their own file
- */
-public class MetadataPrevalidationTests {
-
- private static final String GOOD_TSDL = "/* CTF 1.8 */\ntrace {\n major = 1 ;\n minor = 8 ;\n byte_order = le ; \n};";
-
- /**
- * Test a null should return false
- *
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceNull() throws CTFException {
- assertFalse(Metadata.preValidate(null));
- }
-
- /**
- * Test a non-existing file should return false
- *
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceFileDoesNotExist() throws CTFException {
- assertFalse(Metadata.preValidate("abcdefghijklmnopqrstuvwxyz"));
- }
-
- /**
- * Test a trace file should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceFile() throws CTFException, IOException {
- File f = File.createTempFile("test", ".log");
- try (PrintWriter pw = new PrintWriter(f)) {
- pw.println("2 hello world");
- }
- assertFalse(Metadata.preValidate(f.getAbsolutePath()));
- }
-
- /**
- * Test an empty directory should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithNoFiles() throws IOException, CTFException {
- Path dir = Files.createTempDirectory("trace");
- assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a directory with no metadata file should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithNoMetadataButFiles() throws CTFException, IOException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- try (PrintWriter pw = new PrintWriter(f.toFile())) {
- pw.println("2 hello world");
- }
- assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with packetized little endian metadata should return
- * true
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithLittleEndianMetadata() throws CTFException, IOException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- Files.write(f, packetize(GOOD_TSDL, ByteOrder.BIG_ENDIAN));
- assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with packetized big endian metadata should return true
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithBigEndianMetadata() throws CTFException, IOException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- Files.write(f, packetize(GOOD_TSDL, ByteOrder.BIG_ENDIAN));
- assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with text metadata should return true
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithTextMetadata() throws IOException, CTFException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- try (PrintWriter pw = new PrintWriter(f.toFile())) {
- pw.println(GOOD_TSDL);
- }
- assertTrue(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with text invalid metadata should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithInvalidMetadata() throws IOException, CTFException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- try (PrintWriter pw = new PrintWriter(f.toFile())) {
- // no header
- pw.println("trace { major =1 ; minor = 8 ; byte_order = le;};");
- }
- assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with an empty metadata should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWithEmptyMetadata() throws IOException, CTFException {
- Path dir = Files.createTempDirectory("trace");
- Files.createFile(dir.resolve("metadata"));
- assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- /**
- * Test a valid trace with 1 byte long metadata should return false
- *
- * @throws IOException
- * A file error occurs, shouldn't happen
- * @throws CTFException
- * if an exception occurs, shouldn't happen
- */
- @Test
- public void testTraceDirectoryWith1ByteMetadata() throws IOException, CTFException {
- Path dir = Files.createTempDirectory("trace");
- Path f = Files.createFile(dir.resolve("metadata"));
- try (FileWriter pw = new FileWriter(f.toFile())) {
- pw.append('x');
- }
- assertFalse(Metadata.preValidate(dir.toAbsolutePath().toString()));
- }
-
- private static byte[] packetize(String body, ByteOrder bo) {
- byte[] retVal = new byte[40 + body.length()];
- ByteBuffer bb = ByteBuffer.wrap(retVal);
- bb.order(bo);
- generateMetadataPacketHeader(bb, body);
- return retVal;
- }
-
- private static void generateMetadataPacketHeader(ByteBuffer headerByteBuffer, String body) {
- /* Read from the ByteBuffer */
- headerByteBuffer.putInt(0x75D11D57);
- final UUID randomUUID = UUID.randomUUID();
- headerByteBuffer.putLong(randomUUID.getMostSignificantBits());
- headerByteBuffer.putLong(randomUUID.getLeastSignificantBits());
- headerByteBuffer.putInt(0); // checksum
- headerByteBuffer.putInt(body.length());
- headerByteBuffer.putInt(body.length());
- headerByteBuffer.put((byte) 0);
- headerByteBuffer.put((byte) 0);
- headerByteBuffer.putInt(0);
- headerByteBuffer.put((byte) 1);
- headerByteBuffer.put((byte) 8);
- headerByteBuffer.put(body.getBytes());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.Metadata;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>MetadataTest</code> contains tests for the class
- * <code>{@link Metadata}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class MetadataTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
- private static final String mdStart = "typealias integer { size = 8; align = 8; signed = false; } := uint8_t;\n" +
- " typealias integer { size = 16; align = 8; signed = false; } := uint16_t;\n" +
- " typealias integer { size = 32; align = 8; signed = false; } := uint32_t;\n" +
- " typealias integer { size = 64; align = 8; signed = false; } := uint64_t;\n" +
- " typealias integer { size = 64; align = 8; signed = false; } := unsigned long;\n" +
- " typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n" +
- " typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n" +
- "" +
- " trace {\n" +
- " major = 1;\n" +
- " minor = 8;\n" +
- " uuid = \"8b1258ba-effb-554b-b779-fbd676746000\";\n" +
- " byte_order = le;\n" +
- " packet.header := struct {\n" +
- " uint32_t magic;\n" +
- " uint8_t uuid[16];\n" +
- " uint32_t stream_id;\n" +
- " };\n" +
- " };\n" +
- "" +
- " env {\n" +
- " hostname = \"computer\";\n" +
- " domain = \"kernel\";\n" +
- " sysname = \"BeOS\";\n" +
- " kernel_release = \"95\";\n" +
- " kernel_version = \"BeWare 95\";\n" +
- " tracer_name = \"BeOS Tracer\";\n" +
- " tracer_major = 2;\n" +
- " tracer_minor = 3;\n" +
- " tracer_patchlevel = 0;\n" +
- " };\n" +
- " clock {\n" +
- " name = monotonic;\n" +
- " uuid = \"4d737a79-e3f1-4f4d-a649-42015266baf5\";\n" +
- " description = \"Monotonic Clock\";\n" +
- " freq = 1000000000; /* Frequency, in Hz */\n" +
- " /* clock value offset from Epoch is: offset * (1/freq) */\n" +
- " offset = 1383600210829415521;\n" +
- " };\n" +
-
- " typealias integer {\n" +
- "size = 27; align = 1; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- " } := uint27_clock_monotonic_t;\n" +
- " \n" +
- " typealias integer {\n" +
- " size = 32; align = 8; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- " } := uint32_clock_monotonic_t;\n" +
- " \n" +
- " typealias integer {\n" +
- " size = 64; align = 8; signed = false;\n" +
- " map = clock.monotonic.value;\n" +
- " } := uint64_clock_monotonic_t;\n" +
- " \n" +
- " struct packet_context {\n" +
- " uint64_clock_monotonic_t timestamp_begin;\n" +
- " uint64_clock_monotonic_t timestamp_end;\n" +
- " uint64_t content_size;\n" +
- " uint64_t packet_size;\n" +
- " unsigned long events_discarded;\n" +
- " uint32_t cpu_id;\n" +
- " };\n" +
- " \n" +
- " struct event_header_compact {\n" +
- " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n" +
- " variant <id> {\n" +
- " struct {\n" +
- " uint27_clock_monotonic_t timestamp;\n" +
- " } compact;\n" +
- " struct {\n" +
- " uint32_t id;\n" +
- " uint64_clock_monotonic_t timestamp;\n" +
- " } extended;\n" +
- " } v;\n" +
- " } align(8);\n" +
- " \n" +
- " struct event_header_large {\n" +
- " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n" +
- " variant <id> {\n" +
- " struct {\n" +
- " uint32_clock_monotonic_t timestamp;\n" +
- " } compact;\n" +
- " struct {\n" +
- " uint32_t id;\n" +
- " uint64_clock_monotonic_t timestamp;\n" +
- " } extended;\n" +
- " } v;\n" +
- " } align(8);\n" +
- " \n" +
- " stream {\n" +
- " id = 0;\n" +
- " event.header := struct event_header_compact;\n" +
- " packet.context := struct packet_context;\n" +
- " };\n" +
- " \n" +
- " event {\n" +
- " name = sched_switch;\n" +
- " id = 0;\n" +
- " stream_id = 0;\n" +
- " fields := struct {\n" +
- " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _prev_comm[16];\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_tid;\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _prev_prio;\n" +
- " integer { size = 64; align = 8; signed = 1; encoding = none; base = 10; } _prev_state;\n" +
- " integer { size = 8; align = 8; signed = 1; encoding = UTF8; base = 10; } _next_comm[16];\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_tid;\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } _next_prio;\n" +
- " };\n" +
- " };";
-
- private static final String mdSecond = " event {\n" +
- " name = bozo_the_clown;\n" +
- " id = 1;\n" +
- " stream_id = 0;\n" +
- " fields := struct {\n" +
- " integer { size = 32; align = 8; signed = 1; encoding = none; base = 10; } clown_nose;\n" +
- " };\n" +
- " };";
-
- private Metadata fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- assumeTrue(testTrace.exists());
- fixture = new Metadata(testTrace.getTrace());
- }
-
- /**
- * Run the Metadata(CTFTrace) constructor test.
- */
- @Test
- public void testMetadata() {
- assertNotNull(fixture);
- }
-
- @Test
- public void testTextMD() throws CTFException {
- testSingleFragment();
- }
-
- protected CTFTrace testSingleFragment() throws CTFException {
- fixture = new Metadata();
- CTFTrace trace = fixture.getTrace();
- for (CTFStream s : trace.getStreams()) {
- fail("This should be empty, has" + s.toString());
- }
- fixture.parseText(mdStart);
- int count = 0;
- for (CTFStream s : trace.getStreams()) {
- count++;
- assertNotNull(s);
- }
- assertEquals(1, count);
- assertEquals(1, trace.getEventDeclarations(0L).size());
- return trace;
- }
-
- @Test
- public void testStreamTextMD() throws CTFException {
- CTFTrace trace = testSingleFragment();
- fixture.parseTextFragment(mdSecond);
- final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
- assertEquals(2, eventDeclarations.size());
- assertEquals("bozo_the_clown", eventDeclarations.get(1).getName());
- }
-
- /**
- * Run the ByteOrder getDetectedByteOrder() method test.
- *
- * @throws CTFException
- */
- @Test
- public void testGetDetectedByteOrder() throws CTFException {
- setUp();
- ByteOrder result = fixture.getDetectedByteOrder();
- assertNull(result);
- }
-
- /**
- * Test toString
- *
- * @throws CTFException
- */
- @Test
- public void testToString() throws CTFException {
- setUp();
- String result = fixture.toString();
- assertNotNull(result);
- }
-
- /**
- * Run the void parse() method test.
- *
- * @throws CTFException
- */
- @Test
- public void testParse() throws CTFException {
- setUp();
- assertEquals(new UUID(0xd18e637435a1cd42L, 0x8e70a9cffa712793L), testTrace.getTrace().getUUID());
- assertEquals(1332166405241713920.0, testTrace.getTrace().getClock().getClockOffset(), 200.0);
- assertEquals(8, testTrace.getTrace().getEnvironment().size());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013-2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CTFTraceReaderTest.class,
- CTFTraceTest.class,
- CTFTraceGrowingTest.class,
- IOstructgenTest.class,
- MetadataTest.class,
- MetadataPrevalidationTests.class,
- CTFStreamInputPacketIndexEntryTest.class,
- CTFStreamInputPacketIndexTest.class,
- CTFStreamInputReaderTest.class,
- CTFStreamInputReaderTimestampComparatorTest.class,
- CTFStreamInputTest.class,
- CTFStreamTest.class,
- CTFTraceWriterTest.class,
- TraceReadAllTracesTest.class,
- UtilsTest.class
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * Read all the traces and verify some metrics. Nominally the event count and
- * the duration of the trace (not the time to parse it).
- *
- * @author Matthew Khouzam
- */
-@RunWith(Parameterized.class)
-public class TraceReadAllTracesTest {
-
- /** Time-out tests after 20 seconds. */
- @Rule
- public TestRule globalTimeout = new Timeout(20000);
-
- /**
- * Get the list of traces
- *
- * @return the list of traces
- */
- @Parameters(name = "{index}: {0}")
- public static Iterable<Object[]> getTracePaths() {
- CtfTestTrace[] values = CtfTestTrace.values();
- List<Object[]> list = new ArrayList<>();
- for (CtfTestTrace value : values) {
- list.add(new Object[] { value.name(), value });
- }
- return list;
- }
-
- private final CtfTestTrace fTraceEnum;
-
- /**
- * Constructor
- *
- * @param name
- * name of the enum
- *
- * @param traceEnum
- * the enum to test
- */
- public TraceReadAllTracesTest(String name, CtfTestTrace traceEnum) {
- fTraceEnum = traceEnum;
- }
-
- /**
- * Reads all the traces
- */
- @Test
- public void readTraces() {
- if (fTraceEnum.getNbEvents() != -1) {
- try (CTFTraceReader reader = new CTFTraceReader(new CTFTrace(fTraceEnum.getPath()))) {
- EventDefinition currentEventDef = reader.getCurrentEventDef();
- double start = currentEventDef.getTimestamp();
- long count = 0;
- double end = start;
- while (reader.hasMoreEvents()) {
- reader.advance();
- count++;
- currentEventDef = reader.getCurrentEventDef();
- if (currentEventDef != null) {
- end = currentEventDef.getTimestamp();
- if (currentEventDef.getDeclaration().getName().equals(CTFStrings.LOST_EVENT_NAME)) {
- count += ((IntegerDefinition) currentEventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD)).getValue() - 1;
- }
- }
- }
- assertEquals("Event count", fTraceEnum.getNbEvents(), count);
- assertEquals("Trace duration", fTraceEnum.getDuration(), (end - start) / 1000000000.0, 1.0);
- } catch (CTFException e) {
- fail(fTraceEnum.getPath() + " " + e.getMessage());
- }
- } else {
- assumeTrue("Trace did not specify events count", false);
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.UUID;
-
-import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
-import org.junit.Test;
-
-/**
- * The class <code>UtilsTest</code> contains tests for the class
- * {@link Utils}.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class UtilsTest {
-
- /**
- * Run the UUID makeUUID(byte[]) method test.
- */
- @Test
- public void testMakeUUID() {
- int byteSize = 32;
- byte[] bytes = new byte[byteSize];
- for (int i = 0; i < byteSize; i++) {
- bytes[i] = (byte) (i);
- }
-
- UUID result = Utils.makeUUID(bytes);
- assertNotNull(result);
- }
-
- /**
- * Run the UUID makeUUID(byte[]) method test.
- */
- @Test
- public void testMakeUUID_2() {
- byte[] bytes = new byte[] { (byte) 1, (byte) 1, (byte) 0, (byte) 0,
- (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 1,
- (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
-
- UUID result = Utils.makeUUID(bytes);
-
- assertNotNull(result);
- assertEquals(72339069014638592L, result.getLeastSignificantBits());
- assertEquals(72339069014638592L, result.getMostSignificantBits());
- assertEquals("01010000-0000-0000-0101-000000000000", result.toString());
- assertEquals(0, result.variant());
- assertEquals(0, result.version());
- }
-
- /**
- * Run the UUID makeUUID(byte[]) method test.
- */
- @Test
- public void testMakeUUID_3() {
- byte[] bytes = new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0,
- (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0,
- (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0 };
-
- UUID result = Utils.makeUUID(bytes);
-
- assertNotNull(result);
- assertEquals(0L, result.getLeastSignificantBits());
- assertEquals(0L, result.getMostSignificantBits());
- assertEquals("00000000-0000-0000-0000-000000000000", result.toString());
- assertEquals(0, result.variant());
- assertEquals(0, result.version());
- }
-
- /**
- * Run the int unsignedCompare(long,long) method test.
- */
- @Test
- public void testUnsignedCompare() {
- long a = 1L;
- long b = 1L;
- int result;
-
- result = Utils.unsignedCompare(a, b);
- assertEquals(0, result);
-
- result = Utils.unsignedCompare(0L, 1L);
- assertEquals(-1, result);
- result = Utils.unsignedCompare(0xFFFFFFFFL, 0x100000000L);
- assertEquals(-1, result);
- result = Utils.unsignedCompare(-4L, -1L);
- assertEquals(-1, result);
- result = Utils.unsignedCompare(-0x80000000L, -1L);
- assertEquals(-1, result);
- result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFEL, 0x7FFFFFFFFFFFFFFFL);
- assertEquals(-1, result);
-
- result = Utils.unsignedCompare(1L, 0L);
- assertEquals(1, result);
- result = Utils.unsignedCompare(0x100000000L, 0xFFFFFFFFL);
- assertEquals(1, result);
- result = Utils.unsignedCompare(-1L, -4L);
- assertEquals(1, result);
- result = Utils.unsignedCompare(-1L, -0x80000000L);
- assertEquals(1, result);
- result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFEL);
- assertEquals(1, result);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.io.Util;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>ArrayDeclaration2Test</code> contains tests for the class
- * <code>{@link ArrayDeclaration}</code>.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-public class ArrayDeclaration2Test {
-
- private ArrayDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8));
- }
-
- /**
- * Run the ArrayDeclaration(int,Declaration) constructor test.
- */
- @Test
- public void testArrayDeclaration() {
- int length = 1;
- IDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- ArrayDeclaration result = new ArrayDeclaration(length, elemType);
-
- assertNotNull(result);
- String left = "[declaration] array[";
- String right = result.toString().substring(0, left.length());
- assertEquals(left, right);
- assertEquals(1, result.getLength());
- }
-
- /**
- * Run the ArrayDefinition createDefinition(DefinitionScope,String) method
- * test.
- *
- * @throws CTFException
- * error in the bitbuffer
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- String fieldName = "";
- IDefinitionScope definitionScope = null;
- AbstractArrayDefinition result;
- byte[] array = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
- BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(array)));
- result = fixture.createDefinition(definitionScope, fieldName, bb);
-
- assertNotNull(result);
- }
-
- /**
- * Run the Declaration getElementType() method test.
- */
- @Test
- public void testGetElementType() {
- IDeclaration result = fixture.getElementType();
- assertNotNull(result);
- }
-
- /**
- * Run the int getLength() method test.
- */
- @Test
- public void testGetLength() {
- int result = fixture.getLength();
- assertEquals(1, result);
- }
-
- /**
- * Run the boolean isString() method test.
- */
- @Test
- public void testIsString_ownDefs() {
- // it's an array of strings, not a string
- assertFalse(fixture.isString());
- }
-
- /**
- * Run the boolean isString() method test.
- */
- @Test
- public void testIsString_complex() {
- final IntegerDeclaration id = IntegerDeclaration.createDeclaration(8, false, 16,
- ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 8);
- CompoundDeclaration ad = new ArrayDeclaration(0, id);
-
- boolean result = ad.isString();
-
- assertTrue(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- String left = "[declaration] array[";
- String right = result.substring(0, left.length());
-
- assertEquals(left, right);
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- assertEquals(2016, fixture.hashCode());
- assertEquals(new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8)).hashCode(), fixture.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- ArrayDeclaration a = new ArrayDeclaration(1, IntegerDeclaration.INT_32B_DECL);
- ArrayDeclaration b = new ArrayDeclaration(2, IntegerDeclaration.INT_32B_DECL);
- ArrayDeclaration c = new ArrayDeclaration(1, StringDeclaration.getStringDeclaration(Encoding.UTF8));
- ArrayDeclaration d = new ArrayDeclaration(1, IntegerDeclaration.INT_32B_DECL);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertEquals(a, d);
- assertEquals(a, a);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertEquals(d, a);
- assertEquals(a, a);
- assertFalse(a.isBinaryEquivalent(b));
- assertFalse(b.isBinaryEquivalent(a));
- assertFalse(a.isBinaryEquivalent(c));
- assertFalse(c.isBinaryEquivalent(a));
- assertTrue(a.isBinaryEquivalent(d));
- assertTrue(d.isBinaryEquivalent(a));
- assertTrue(a.isBinaryEquivalent(a));
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.*;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.io.Util;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>ArrayDefinition2Test</code> contains tests for the class
- * <code>{@link ArrayDefinition}</code>.
- *
- */
-public class ArrayDefinition2Test {
-
- private @NonNull CTFTrace trace = new CTFTrace();
- private ArrayDefinition charArrayFixture;
- private ArrayDefinition stringArrayFixture;
- private ArrayDefinition longArrayFixture;
-
- /**
- * Perform pre-test initialization.
- *
- * structDef shouldn't be null after parsing the CTFTraceReader object, so
- * we can ignore the warning.
- */
- @Before
- public void setUp() {
- charArrayFixture = createCharArray();
- stringArrayFixture = createStringArray();
- longArrayFixture = createLongArray();
- }
-
- private ArrayDefinition createLongArray() {
- IntegerDeclaration decl = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none", 8);
- List<Definition> defs = createIntDefs(10, 32);
- ArrayDefinition temp = setUpDeclaration(decl, defs);
- return temp;
- }
-
- private ArrayDefinition createCharArray() {
- IntegerDeclaration decl = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none", 8);
- List<Definition> defs = createIntDefs(4, 8);
- ArrayDefinition temp = setUpDeclaration(decl, defs);
- return temp;
- }
-
- private ArrayDefinition createStringArray() {
- StringDeclaration strDecl = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- List<Definition> defs = createDefs();
- ArrayDefinition temp = setUpDeclaration(strDecl, defs);
- return temp;
- }
-
- private ArrayDefinition setUpDeclaration(@NonNull IDeclaration decl,
- @NonNull List<Definition> defs) {
- CompoundDeclaration ad = new ArrayDeclaration(0, decl);
- ArrayDefinition temp = new ArrayDefinition(ad, this.trace, "Testx", defs);
- return temp;
- }
-
- @NonNull
- private static List<Definition> createIntDefs(int size, int bits) {
- List<Definition> defs = new ArrayList<>(size);
- for (int i = 0; i < size; i++) {
- String content = "test" + i;
- defs.add(new IntegerDefinition(IntegerDeclaration.createDeclaration(bits, false,
- 16, ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, content, 24), null, content, i));
- }
- return defs;
- }
-
- @NonNull
- private static List<Definition> createDefs() {
- int size = 4;
- List<Definition> defs = new ArrayList<>();
- for (int i = 0; i < size; i++) {
- String content = "test" + i;
- defs.add(new StringDefinition(
- StringDeclaration.getStringDeclaration(Encoding.UTF8), null, content, content));
- }
- return defs;
- }
-
- /**
- * Run the ArrayDefinition(ArrayDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testArrayDefinition_baseDeclaration() {
- CompoundDeclaration declaration = (CompoundDeclaration) charArrayFixture.getDeclaration();
- String fieldName = "";
-
- @SuppressWarnings("null")
- ArrayDefinition result = new ArrayDefinition(declaration, this.trace, fieldName, Arrays.asList(new Definition[0]));
- assertNotNull(result);
- }
-
- /**
- * Run the ArrayDefinition(ArrayDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testArrayDefinition_newDeclaration() {
- CompoundDeclaration declaration = new ArrayDeclaration(0,
- StringDeclaration.getStringDeclaration(Encoding.UTF8));
- IDefinitionScope definitionScope = getDefinitionScope();
-
- String fieldName = "";
- @SuppressWarnings("null")
- ArrayDefinition result = new ArrayDefinition(declaration, definitionScope, fieldName, Arrays.asList(new Definition[0]));
- assertNotNull(result);
- }
-
- /**
- * Run the ArrayDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- CompoundDeclaration result = (CompoundDeclaration) charArrayFixture.getDeclaration();
-
- assertNotNull(result);
- }
-
- /**
- * Run the Definition getDefinitions().get(int) method test.
- */
- @Test
- public void testgetElem_noDefs() {
- int i = 0;
- IDefinition result = charArrayFixture.getDefinitions().get(i);
-
- assertNotNull(result);
- }
-
- /**
- * Run the Definition getDefinitions().get(int) method test.
- */
- @Test
- public void testgetElem_withDefs() {
- List<Definition> defs = createDefs();
- IDefinitionScope definitionScope = getDefinitionScope();
- ArrayDefinition ad = new ArrayDefinition((CompoundDeclaration) charArrayFixture.getDeclaration(), definitionScope, "test", defs);
- int j = 1;
-
- IDefinition result = ad.getDefinitions().get(j);
-
- assertNotNull(result);
- }
-
- @NonNull
- private static IDefinitionScope getDefinitionScope() {
- return new IDefinitionScope() {
-
- @Override
- public Definition lookupDefinition(String lookupPath) {
- return null;
- }
-
- @Override
- public LexicalScope getScopePath() {
- return null;
- }
- };
- }
-
- /**
- * Run the void read(BitBuffer) method test.
- *
- * @throws CTFException
- * error
- */
- @Test
- public void testRead_noDefs() throws CTFException {
- BitBuffer input = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(128)));
- charArrayFixture.getDeclaration().createDefinition(null, "test", input);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString_char() {
- String result = charArrayFixture.toString();
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString_long() {
- String result = longArrayFixture.toString();
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString_string() {
- String result = stringArrayFixture.toString();
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString_withDefs() {
- String result = charArrayFixture.toString();
-
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToStringStringArray() {
- String result = stringArrayFixture.toString();
-
- assertNotNull(result);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.junit.Test;
-
-/**
- * The class <code>DefinitionTest</code> contains tests for the class
- * <code>{@link Definition}</code>.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-public class DefinitionTest {
-
- /**
- * Since Definition is abstract, we'll minimally extend it here to
- * instantiate it.
- */
- static class DefTest extends Definition {
-
- @NonNull
- private static final StringDeclaration STRINGDEC = StringDeclaration.getStringDeclaration(Encoding.UTF8);
-
- public DefTest(IDefinitionScope definitionScope, @NonNull String fieldName) {
- super(DefTest.STRINGDEC, definitionScope, fieldName);
- }
-
- @Override
- @NonNull
- public IDeclaration getDeclaration() {
- return DefTest.STRINGDEC;
- }
-
- }
-
- /**
- * Test a definition
- */
- @Test
- public void testToString() {
- IDefinition fixture = new DefTest(null, "Hello");
- String result = fixture.toString();
-
- assertNotNull(result);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.io.Util;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>EnumDeclarationTest</code> contains tests for the class
- * <code>{@link EnumDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class EnumDeclarationTest {
-
- private EnumDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new EnumDeclaration(IntegerDeclaration.createDeclaration(1, false, 1,
- ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8));
- }
-
- /**
- * Run the EnumDeclaration(IntegerDeclaration) constructor test.
- */
- @Test
- public void testEnumDeclaration() {
- IntegerDeclaration containerType = IntegerDeclaration.createDeclaration(1, false, 1,
- ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
-
- EnumDeclaration result = new EnumDeclaration(containerType);
-
- assertNotNull(result);
- String left = "[declaration] enum[";
- assertEquals(left, result.toString().substring(0, left.length()));
- }
-
- /**
- * Run the boolean add(long,long,String) method test.
- */
- @Test
- public void testAdd() {
- long low = 1L;
- long high = 1L;
- String label = "";
-
- boolean result = fixture.add(low, high, label);
-
- assertTrue(result);
- }
-
- /**
- * Run the EnumDefinition createDefinition(DefinitionScope,String) method
- * test.
- *
- * @throws CTFException
- * out of bounds error, won't happen
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- IDefinitionScope definitionScope = null;
- String fieldName = "";
- byte[] array = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
- BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(array)));
-
- EnumDefinition result = fixture.createDefinition(definitionScope,
- fieldName, bb);
-
- assertNotNull(result);
- }
-
- /**
- * Run the String query(long) method test.
- */
- @Test
- public void testQuery() {
- long value = 0;
- String result = fixture.query(value);
-
- assertNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
-
- String left = "[declaration] enum[";
- assertEquals(left, result.substring(0, left.length()));
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- EnumDeclaration b = new EnumDeclaration(IntegerDeclaration.createDeclaration(1, false, 1,
- ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8));
- assertEquals(b.hashCode(), fixture.hashCode());
- fixture.add(0, 1, "hello");
- fixture.add(2, 3, "kitty");
- b.add(0, 1, "hello");
- b.add(2, 3, "kitty");
- assertEquals(fixture.hashCode(), b.hashCode());
-
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- EnumDeclaration a = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
- EnumDeclaration b = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
- b.add(2, 19, "hi");
- EnumDeclaration c = new EnumDeclaration(IntegerDeclaration.INT_32B_DECL);
- EnumDeclaration d = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertNotEquals(b, c);
- assertEquals(a, d);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertNotEquals(c, b);
- assertEquals(d, a);
- a.add(2, 19, "hi");
- assertEquals(a, a);
- assertEquals(a, b);
- assertEquals(b, a);
- assertNotEquals(a, d);
- assertNotEquals(d, a);
- d.add(2, 22, "hi");
- assertNotEquals(a, d);
- assertNotEquals(d, a);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>EnumDefinitionTest</code> contains tests for the class
- * <code>{@link EnumDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class EnumDefinitionTest {
-
- private EnumDefinition fixtureA;
- private EnumDefinition fixtureB;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- IntegerDeclaration integerDeclaration = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
- Encoding.ASCII, "", 8);
- EnumDeclaration declaration = new EnumDeclaration(
- integerDeclaration);
- declaration.add(0, 10, "a");
- declaration.add(11, 20, "b");
- String fieldName = "";
-
- fixtureA = new EnumDefinition(declaration, null, fieldName, new IntegerDefinition(integerDeclaration, null, fieldName, 4));
- fixtureB = new EnumDefinition(declaration, null, fieldName, new IntegerDefinition(integerDeclaration, null, fieldName, 12));
- }
-
- /**
- * Run the EnumDefinition(EnumDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testEnumDefinition() {
- assertNotNull(fixtureA);
- assertNotNull(fixtureB);
- }
-
- /**
- * Run the String getValue() method test.
- */
- @Test
- public void testGetValue() {
- String result = fixtureA.getValue();
-
- assertNotNull(result);
- assertEquals("a", result);
- }
-
- /**
- * Run the long getIntegerValue() method test.
- */
- @Test
- public void testGetIntegerValue_one() {
- long result = fixtureA.getIntegerValue();
- assertEquals(4L, result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixtureB.toString();
-
- assertEquals("{ value = b, container = 12 }", result);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>EventDeclarationTest</code> contains tests for the class
- * <code>{@link EventDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class EventDeclarationTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private EventDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- assumeTrue(testTrace.exists());
- fixture = new EventDeclaration();
- fixture.setContext(new StructDeclaration(1L));
- fixture.setId(1L);
- fixture.setFields(new StructDeclaration(1L));
- fixture.setStream(new CTFStream(testTrace.getTrace()));
- fixture.setName("");
- }
-
- /**
- * Run the EventDeclaration() constructor test.
- */
- @Test
- public void testEventDeclaration() {
- EventDeclaration result = new EventDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the boolean contextIsSet() method test.
- */
- @Test
- public void testContextIsSet() {
- boolean result = fixture.contextIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean contextIsSet() method test.
- */
- @Test
- public void testContextIsSet_null() {
- fixture.setContext((StructDeclaration) null);
-
- boolean result = fixture.contextIsSet();
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- *
- * @throws CTFException
- */
- @Test
- public void testEquals() throws CTFException {
- EventDeclaration obj = new EventDeclaration();
- obj.setContext(new StructDeclaration(1L));
- obj.setId(1L);
- obj.setFields(new StructDeclaration(1L));
- obj.setStream(new CTFStream(testTrace.getTrace()));
- obj.setName("");
-
- assertTrue(fixture.equals(fixture));
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_null() {
- Object obj = null;
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_emptyObject() {
- Object obj = new Object();
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_other1() {
- EventDeclaration obj = new EventDeclaration();
- obj.setContext(fixture.getContext());
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_other2() {
- EventDeclaration obj = new EventDeclaration();
- obj.setContext(new StructDeclaration(1L));
- obj.setFields(new StructDeclaration(1L));
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_other3() {
- EventDeclaration obj = new EventDeclaration();
- obj.setContext(new StructDeclaration(1L));
- obj.setId(1L);
- obj.setFields(new StructDeclaration(1L));
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- */
- @Test
- public void testEquals_other4() {
- EventDeclaration obj = new EventDeclaration();
- obj.setContext(new StructDeclaration(1L));
- obj.setId(1L);
- obj.setFields(new StructDeclaration(1L));
- obj.setName("");
-
- boolean result = fixture.equals(obj);
- assertFalse(result);
- }
-
- /**
- * Run the boolean fieldsIsSet() method test.
- */
- @Test
- public void testFieldsIsSet() {
- boolean result = fixture.fieldsIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean fieldsIsSet() method test.
- */
- @Test
- public void testFieldsIsSet_null() {
- fixture.setFields((StructDeclaration) null);
-
- boolean result = fixture.fieldsIsSet();
- assertFalse(result);
- }
-
- /**
- * Run the StructDeclaration getFields() method test.
- */
- @Test
- public void testGetFields() {
- StructDeclaration result = fixture.getFields();
- assertNotNull(result);
- }
-
- /**
- * Run the Long getId() method test.
- */
- @Test
- public void testGetId() {
- assertEquals(1, fixture.id());
- }
-
- /**
- * Run the String getName() method test.
- */
- @Test
- public void testGetName() {
- String result = fixture.getName();
- assertNotNull(result);
- }
-
- /**
- * Run the Stream getStream() method test.
- */
- @Test
- public void testGetStream() {
- CTFStream result = fixture.getStream();
- assertNotNull(result);
- }
-
- /**
- * Run the int hashCode() method test.
- */
- @Test
- public void testHashCode() {
- int result = fixture.hashCode();
- assertTrue(0 != result);
- }
-
- /**
- * Run the int hashCode() method test.
- */
- @Test
- public void testHashCode_null() {
- fixture.setStream((CTFStream) null);
- fixture.setName((String) null);
-
- int result = fixture.hashCode();
- assertTrue(0 != result);
- }
-
- /**
- * Run the boolean idIsSet() method test.
- */
- @Test
- public void testIdIsSet() {
- boolean result = fixture.idIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean nameIsSet() method test.
- */
- @Test
- public void testNameIsSet() {
- boolean result = fixture.nameIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean nameIsSet() method test.
- */
- @Test
- public void testNameIsSet_null() {
- fixture.setName((String) null);
-
- boolean result = fixture.nameIsSet();
- assertFalse(result);
- }
-
- /**
- * Run the boolean streamIsSet() method test.
- */
- @Test
- public void testStreamIsSet() {
- boolean result = fixture.streamIsSet();
- assertTrue(result);
- }
-
- /**
- * Run the boolean streamIsSet() method test.
- */
- @Test
- public void testStreamIsSet_null() {
- fixture.setStream((CTFStream) null);
-
- boolean result = fixture.streamIsSet();
- assertEquals(false, result);
- }
-
- /**
- * Test for the EventDefinition class
- *
- * @throws CTFException
- */
- @Test
- public void testEventDefinition() throws CTFException {
- CTFTrace trace = testTrace.getTrace();
- EventDefinition ed = null;
- try (CTFTraceReader tr = new CTFTraceReader(trace);) {
- tr.advance();
- ed = tr.getCurrentEventDef();
- }
-
- assertNotNull(ed);
- assertNotNull(ed.getScopePath());
- assertNotNull(ed.getDeclaration());
- assertNotNull(ed.getFields());
- assertNull(ed.getContext());
- assertNotNull(ed.getPacketContext());
- assertNotNull(ed.getCPU());
- assertNotNull(ed.getStreamInputReader());
- assertNull(ed.lookupDefinition("context"));
- assertNotNull(ed.lookupDefinition("fields"));
- assertNull(ed.lookupDefinition("other"));
- assertNotNull(ed.toString());
- }
-
- IEventDeclaration e1;
- IEventDeclaration e2;
-
- @Test
- public void testEquals1() {
- e1 = new EventDeclaration();
- assertFalse(e1.equals(null));
- }
-
- @Test
- public void testEquals2() {
- e1 = LostEventDeclaration.INSTANCE;
- assertFalse(e1.equals(new Long(23L)));
- }
-
- @Test
- public void testEquals3() {
- e1 = LostEventDeclaration.INSTANCE;
- assertEquals(e1, e1);
- }
-
- @Test
- public void testEquals4() {
- e1 = LostEventDeclaration.INSTANCE;
- e2 = LostEventDeclaration.INSTANCE;
- assertEquals(e1, e2);
- }
-
- @Test
- public void testEquals5() {
- e1 = LostEventDeclaration.INSTANCE;
- e2 = new EventDeclaration();
- assertFalse(e1.equals(e2));
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderCompactDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderLargeDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Event header declaration tests
- *
- * @author Matthew Khouzam
- *
- */
-public class EventHeaderDeclarationTest {
-
- private static final int ID = 2222;
- private static final int TIMESTAMP = 1000;
- private static final int VALID_LARGE = 1;
- private static final int VALID_COMPACT = 0;
-
- private final List<StructDeclaration> declarations = new ArrayList<>();
-
- /**
- * Setup
- */
- @Before
- public void init() {
- declarations.clear();
-
- /**
- * do not reflow
- *
- * <pre>
- * struct event_header_compact {
- * enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
- * variant <id> {
- * struct {
- * uint27_clock_monotonic_t timestamp;
- * } compact;
- * struct {
- * uint32_t id;
- * uint64_clock_monotonic_t timestamp;
- * } extended;
- * } v;
- * } align(8);
- * </pre>
- */
-
- StructDeclaration base = new StructDeclaration(8);
- EnumDeclaration enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- enumDec.add(0, 30, "compact");
- enumDec.add(31, 31, "extended");
- base.addField("id", enumDec);
- VariantDeclaration variantV = new VariantDeclaration();
- StructDeclaration compact = new StructDeclaration(1);
- compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- variantV.addField("compact", compact);
- StructDeclaration large = new StructDeclaration(1);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- /**
- * Do not reflow
- *
- * <pre>
- * struct event_header_large {
- * enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
- * variant <id> {
- * struct {
- * uint32_clock_monotonic_t timestamp;
- * } compact;
- * struct {
- * uint32_t id;
- * uint64_clock_monotonic_t timestamp;
- * } extended;
- * } v;
- * } align(8);
- * </pre>
- */
-
- base = new StructDeclaration(8);
- enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(16, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- enumDec.add(0, 65534, "compact");
- enumDec.add(65535, 65535, "extended");
- base.addField("id", enumDec);
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_32B_DECL);
- variantV.addField("compact", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad - misnamed enum
- base = new StructDeclaration(8);
- enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- enumDec.add(0, 30, "compact");
- enumDec.add(31, 31, "large");
- base.addField("id", enumDec);
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(1);
- compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- variantV.addField("compact", compact);
- large = new StructDeclaration(1);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad - missing enum
- base = new StructDeclaration(8);
- enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- enumDec.add(0, 30, "compact");
- base.addField("id", enumDec);
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(1);
- compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- variantV.addField("compact", compact);
- large = new StructDeclaration(1);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad - int 5 alignment 8 bit
- base = new StructDeclaration(8);
- enumDec = new EnumDeclaration(IntegerDeclaration.createDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8));
- enumDec.add(0, 30, "compact");
- enumDec.add(31, 31, "extended");
- base.addField("id", enumDec);
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(1);
- compact.addField("timestamp", IntegerDeclaration.createDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1));
- variantV.addField("compact", compact);
- large = new StructDeclaration(1);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad - well, sounds nice though
- base = new StructDeclaration(8);
- base.addField("potato salad", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- base.addField("bbq ribs", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_16B_DECL));
- base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
- base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
- variantV.addField("compact1", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
- variantV.addField("compact", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp1", IntegerDeclaration.UINT_64B_DECL);
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
- variantV.addField("compact", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_5B_DECL));
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
- variantV.addField("compact", compact);
- variantV.addField("surprise!", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
-
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.UINT_16B_DECL));
- variantV = new VariantDeclaration();
- compact = new StructDeclaration(8);
- compact.addField("timestamp", IntegerDeclaration.UINT_27B_DECL);
- variantV.addField("compact", compact);
- variantV.addField("surprise!", compact);
- large = new StructDeclaration(8);
- large.addField("id", IntegerDeclaration.UINT_32B_DECL);
- large.addField("timestamp", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- variantV.addField("extended", large);
- base.addField("v", variantV);
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- base.addField("v", new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 8));
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", IntegerDeclaration.INT_32B_DECL);
- base.addField("timestamp", IntegerDeclaration.INT_32B_DECL);
- declarations.add(base);
- // bad
- base = new StructDeclaration(8);
- base.addField("id", new EnumDeclaration(IntegerDeclaration.INT_8_DECL));
- base.addField("timestamp", IntegerDeclaration.INT_32B_DECL);
- declarations.add(base);
- }
-
- /**
- * Validate a compact declaration
- */
- @Test
- public void validateCompact() {
- assertEquals(true, EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isCompactEventHeader(declarations.get(VALID_COMPACT)));
- }
-
- /**
- * Fail if it validates
- */
- @Test
- public void validateCompactFail() {
- for (int i = 0; i < declarations.size(); i++) {
- if (i == VALID_COMPACT) {
- continue;
- }
- assertEquals(false, EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isCompactEventHeader(declarations.get(i)));
- }
- }
-
- /**
- * Validate a large declaration
- */
- @Test
- public void validateLarge() {
- assertEquals(true, EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isLargeEventHeader(declarations.get(VALID_LARGE)));
- }
-
- /**
- * Fail if it validates
- */
- @Test
- public void validateLargeFail() {
- for (int i = 0; i < declarations.size(); i++) {
- if (i == VALID_LARGE) {
- continue;
- }
- assertEquals(false, EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN).isLargeEventHeader(declarations.get(i)));
- }
- }
-
- /**
- * Test an compact compact header
- *
- * @throws CTFException
- * if {@link BitBuffer} is null
- */
- @Test
- public void testCompactCompact() throws CTFException {
- ByteBuffer buffer = ByteBuffer.allocate(16);
- buffer.putInt(0x80000042);
- byte[] validCompact1 = buffer.array();
-
- EventHeaderCompactDeclaration decl = EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
- final ByteBuffer input = ByteBuffer.wrap(validCompact1);
- assertNotNull(input);
- EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
- assertNotNull(def);
- assertEquals(16, def.getId());
- assertEquals(0x42, def.getTimestamp());
- }
-
- /**
- * Test an extended compact header
- *
- * @throws CTFException
- * if {@link BitBuffer} is null
- */
- @Test
- public void testCompactExtended() throws CTFException {
- ByteBuffer buffer = ByteBuffer.allocate(16);
- buffer.put((byte) 0xFF);
- buffer.putInt(ID);
- buffer.putLong(TIMESTAMP);
- byte[] validCompact2 = buffer.array();
-
- EventHeaderCompactDeclaration decl = EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
- final ByteBuffer input = ByteBuffer.wrap(validCompact2);
- assertNotNull(input);
- EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
- assertNotNull(def);
- assertEquals(ID, def.getId());
- assertEquals(TIMESTAMP, def.getTimestamp());
- }
-
- /**
- * Test an compact large header
- *
- * @throws CTFException
- * if {@link BitBuffer} is null
- */
- @Test
- public void testLargeCompact() throws CTFException {
- ByteBuffer buffer = ByteBuffer.allocate(16);
- buffer.putShort((short) ID);
- buffer.putInt(TIMESTAMP);
- byte[] validLarge1 = buffer.array();
-
- EventHeaderLargeDeclaration decl = EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
- final ByteBuffer input = ByteBuffer.wrap(validLarge1);
- assertNotNull(input);
- EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
- assertNotNull(def);
- assertEquals(ID, def.getId());
- assertEquals(TIMESTAMP, def.getTimestamp());
- assertEquals(ID, ((IntegerDefinition) def.getDefinition("id")).getValue());
- assertEquals(TIMESTAMP, ((IntegerDefinition) def.getDefinition("timestamp")).getValue());
- }
-
- /**
- * Test an large large header
- *
- * @throws CTFException
- * if {@link BitBuffer} is null
- */
- @Test
- public void testLargeExtended() throws CTFException {
- ByteBuffer buffer = ByteBuffer.allocate(16);
- buffer.putShort((short) -1);
- buffer.putInt(ID);
- buffer.putLong(TIMESTAMP);
- byte[] validLarge2 = buffer.array();
-
- EventHeaderLargeDeclaration decl = EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN);
- final ByteBuffer input = ByteBuffer.wrap(validLarge2);
- assertNotNull(input);
- EventHeaderDefinition def = decl.createDefinition(null, "bla", new BitBuffer(input));
- assertNotNull(def);
- assertEquals(ID, def.getId());
- assertEquals(TIMESTAMP, def.getTimestamp());
- assertEquals(ID, ((IntegerDefinition) def.getDefinition("id")).getValue());
- assertEquals(TIMESTAMP, ((IntegerDefinition) def.getDefinition("timestamp")).getValue());
- }
-
- /**
- * Test maximum sizes, make sure they don't change unannounced
- */
- @Test
- public void testMaxSizes() {
- assertEquals(112, (EventHeaderLargeDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN)).getMaximumSize());
- assertEquals(104, (EventHeaderCompactDeclaration.getEventHeader(ByteOrder.BIG_ENDIAN)).getMaximumSize());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.junit.Test;
-
-@SuppressWarnings("javadoc")
-public class FloatDeclarationTest {
- private FloatDeclaration fixture;
-
- @Test
- public void ctorTest() {
- for (int i = 1; i < 20; i++) {
- fixture = new FloatDeclaration(i, 32 - i, ByteOrder.nativeOrder(), 0);
- assertNotNull(fixture);
- }
- }
-
- @Test
- public void getterTest() {
- fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 1);
- assertEquals(fixture.getAlignment(), 1);
- assertEquals(fixture.getByteOrder(), ByteOrder.nativeOrder());
- assertEquals(fixture.getExponent(), 8);
- assertEquals(fixture.getMantissa(), 24);
- }
-
- @Test
- public void toStringTest() {
- fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
- assertTrue(fixture.toString().contains("float"));
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- FloatDeclaration floatDeclaration = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
- FloatDeclaration a = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
- FloatDeclaration b = new FloatDeclaration(8, 24, ByteOrder.LITTLE_ENDIAN, 0);
- assertEquals(a.hashCode(), floatDeclaration.hashCode());
- assertNotEquals(b.hashCode(), floatDeclaration.hashCode());
- assertEquals(floatDeclaration.hashCode(), floatDeclaration.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- FloatDeclaration a = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
- FloatDeclaration b = new FloatDeclaration(8, 24, ByteOrder.LITTLE_ENDIAN, 0);
- FloatDeclaration c = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 8);
- FloatDeclaration d = new FloatDeclaration(8, 8, ByteOrder.BIG_ENDIAN, 0);
- FloatDeclaration e = new FloatDeclaration(24, 24, ByteOrder.BIG_ENDIAN, 0);
- FloatDeclaration f = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 0);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertNotEquals(a, d);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertNotEquals(d, a);
- assertNotEquals(e, a);
- assertNotEquals(a, e);
-
- assertEquals(a, f);
- assertEquals(f, a);
- assertEquals(a, a);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>IntegerDefinitionTest</code> contains tests for the class
- * <code>{@link IntegerDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class FloatDefinitionTest {
-
- private FloatDefinition fixture;
- private FloatDefinition singleFixture;
- private FloatDefinition doubleFixture; // all the way.
- private FloatDeclaration parent;
- @NonNull
- private static final String fieldName = "float";
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * error creating floats
- */
- @Before
- public void setUp() throws CTFException {
- testFloat248();
- testFloat5311();
- }
-
- @Test
- public void testFloat248() throws CTFException {
- parent = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
- BitBuffer bb = create32BitFloatByteBuffer();
- singleFixture = parent.createDefinition(null, fieldName, bb);
- assertNotNull(singleFixture);
- }
-
- @Test
- public void testFloat5311() throws CTFException {
- parent = new FloatDeclaration(11, 53, ByteOrder.nativeOrder(), 0);
- BitBuffer bb = create64BitFloatByteBuffer();
- doubleFixture = parent.createDefinition(null, fieldName, bb);
- assertNotNull(doubleFixture);
- }
-
- @Test
- public void testFloat32Bit() throws CTFException {
- for (int i = 1; i < 31; i++) {
- parent = new FloatDeclaration(i, 32 - i, ByteOrder.nativeOrder(), 0);
-
- fixture = parent.createDefinition(null, fieldName, create32BitFloatByteBuffer());
- assertNotNull(fixture);
- assertEquals("test" + i, "2.0", fixture.toString());
- }
- }
-
- @Test
- public void testFloat64Bit() throws CTFException {
- for (int i = 1; i < 63; i++) {
- parent = new FloatDeclaration(i, 64 - i, ByteOrder.nativeOrder(), 0);
- fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer());
- assertNotNull(fixture);
- if (i <= 32) {
- assertEquals("test" + i, "2.0", fixture.toString());
- } else if (i == 33) {
- assertEquals("test" + i, "1.0", fixture.toString());
- } else {
- assertNotNull(fixture.getValue());
- }
-
- }
- }
-
- @Test
- public void testFloat48Bit() throws CTFException {
- parent = new FloatDeclaration(12, 32, ByteOrder.nativeOrder(), 0);
- fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer());
- assertNotNull(fixture);
- assertEquals(Double.NaN, fixture.getValue(), 0.1);
- }
-
- /**
- * Run the IntegerDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- FloatDeclaration result = singleFixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the long getValue() method test.
- */
- @Test
- public void testGetValue() {
- double result = singleFixture.getValue();
- assertEquals(2.0, result, 0.1);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = singleFixture.toString();
- assertNotNull(result);
- assertEquals("2.0", result);
- }
-
- @NonNull
- private static BitBuffer create32BitFloatByteBuffer() {
- float[] data = new float[2];
- data[0] = 2.0f;
- data[1] = 3.14f;
- ByteBuffer byb = ByteBuffer.allocate(128);
- byb.order(ByteOrder.nativeOrder());
- byb.mark();
- byb.putFloat(data[0]);
- byb.putFloat(data[1]);
- byb.reset();
- BitBuffer bb = new BitBuffer(byb);
- return bb;
- }
-
- @NonNull
- private static BitBuffer create64BitFloatByteBuffer() {
- double[] data = new double[2];
- data[0] = 2.0f;
- data[1] = 3.14f;
- ByteBuffer byb = ByteBuffer.allocate(128);
- byb.order(ByteOrder.nativeOrder());
- byb.mark();
- byb.putDouble(data[0]);
- byb.putDouble(data[1]);
- byb.reset();
- BitBuffer bb = new BitBuffer(byb);
- return bb;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Marc-Andre Laperle - Add min/maximum for validation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.math.BigInteger;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>IntegerDeclarationTest</code> contains tests for the class
- * <code>{@link IntegerDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class IntegerDeclarationTest {
-
- private IntegerDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
- Encoding.ASCII, "", 32);
- }
-
- /**
- * Run the IntegerDeclaration(int,boolean,int,ByteOrder,Encoding)
- * constructor test.
- */
- @Test
- public void testIntegerDeclaration() {
- int len = 1;
- boolean signed = false;
- int base = 1;
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
- Encoding encoding = Encoding.ASCII;
-
- IntegerDeclaration result = IntegerDeclaration.createDeclaration(len, signed, base,
- byteOrder, encoding, "", 16);
-
- assertNotNull(result);
- assertEquals(1, result.getBase());
- assertEquals(false, result.isCharacter());
- String outputValue = "[declaration] integer[";
- assertEquals(outputValue,
- result.toString().substring(0, outputValue.length()));
- assertEquals(1, result.getLength());
- assertEquals(false, result.isSigned());
- }
-
- /**
- * Test the factory part more rigorously to make sure there are no
- * regressions
- */
- @Test
- public void testIntegerDeclarationBruteForce() {
- ByteOrder[] bos = { ByteOrder.LITTLE_ENDIAN, ByteOrder.BIG_ENDIAN };
- Encoding[] encodings = { Encoding.ASCII, Encoding.NONE, Encoding.UTF8 };
- boolean[] signeds = { true, false }; // not a real word
- String[] clocks = { "something", "" };
- int[] bases = { 2, 4, 6, 8, 10, 12, 16 };
- for (int len = 2; len < 65; len++) {
- for (ByteOrder bo : bos) {
- for (boolean signed : signeds) {
- for (int base : bases) {
- for (Encoding enc : encodings) {
- for (String clock : clocks) {
- assertNotNull(enc);
- assertNotNull(clock);
- IntegerDeclaration intDec = IntegerDeclaration.createDeclaration(len, signed, base, bo, enc, clock, 8);
- String title = Integer.toString(len) + " " + bo + " " + signed + " " + base + " " + enc;
- assertEquals(title, signed, intDec.isSigned());
- assertEquals(title, base, intDec.getBase());
- // at len 8 le and be are the same
- if (len != 8) {
- assertEquals(title, bo, intDec.getByteOrder());
- }
- assertEquals(title, len, intDec.getLength());
- assertEquals(title, len, intDec.getMaximumSize());
- assertEquals(title, clock, intDec.getClock());
- assertEquals(title, !signed && len == 8, intDec.isUnsignedByte());
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Run the int getBase() method test.
- */
- @Test
- public void testGetBase() {
- int result = fixture.getBase();
- assertEquals(1, result);
- }
-
- /**
- * Run the ByteOrder getByteOrder() method test.
- */
- @Test
- public void testGetByteOrder() {
- ByteOrder result = fixture.getByteOrder();
- assertNotNull(result);
- assertEquals("BIG_ENDIAN", result.toString());
- }
-
- /**
- * Run the Encoding getEncoding() method test.
- */
- @Test
- public void testGetEncoding() {
- Encoding result = fixture.getEncoding();
- assertNotNull(result);
- assertEquals("ASCII", result.name());
- assertEquals("ASCII", result.toString());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the int getLength() method test.
- */
- @Test
- public void testGetLength() {
- int result = fixture.getLength();
- assertEquals(1, result);
- }
-
- /**
- * Run the boolean isCharacter() method test.
- */
- @Test
- public void testIsCharacter() {
- boolean result = fixture.isCharacter();
- assertEquals(false, result);
- }
-
- /**
- * Run the boolean isCharacter() method test.
- */
- @Test
- public void testIsCharacter_8bytes() {
- IntegerDeclaration fixture8 = IntegerDeclaration.createDeclaration(8, true, 1,
- ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
-
- boolean result = fixture8.isCharacter();
- assertEquals(true, result);
- }
-
- /**
- * Run the boolean isSigned() method test.
- */
- @Test
- public void testIsSigned_signed() {
- IntegerDeclaration fixtureSigned = IntegerDeclaration.createDeclaration(2, true,
- 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
- boolean result = fixtureSigned.isSigned();
- assertEquals(true, result);
- }
-
- /**
- * Run the boolean isSigned() method test.
- */
- @Test
- public void testIsSigned_unsigned() {
- boolean result = fixture.isSigned();
- assertEquals(false, result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- String trunc = result.substring(0, 22);
- assertEquals("[declaration] integer[", trunc);
- }
-
- /**
- * Run the long getMaxValue() method test.
- */
- @Test
- public void testMaxValue() {
- assertEquals(BigInteger.ONE, fixture.getMaxValue());
-
- IntegerDeclaration signed8bit = IntegerDeclaration.createDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(127), signed8bit.getMaxValue());
-
- IntegerDeclaration unsigned8bit = IntegerDeclaration.createDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(255), unsigned8bit.getMaxValue());
-
- IntegerDeclaration signed32bit = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(2147483647), signed32bit.getMaxValue());
-
- IntegerDeclaration unsigned32bit = IntegerDeclaration.createDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(4294967295l), unsigned32bit.getMaxValue());
-
- IntegerDeclaration signed64bit = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(9223372036854775807L), signed64bit.getMaxValue());
-
- IntegerDeclaration unsigned64bit = IntegerDeclaration.createDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(2).pow(64).subtract(BigInteger.ONE), unsigned64bit.getMaxValue());
- }
-
- /**
- * Run the long getMinValue() method test.
- */
- @Test
- public void testMinValue() {
- assertEquals(BigInteger.ZERO, fixture.getMinValue());
-
- IntegerDeclaration signed8bit = IntegerDeclaration.createDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(-128), signed8bit.getMinValue());
-
- IntegerDeclaration unsigned8bit = IntegerDeclaration.createDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.ZERO, unsigned8bit.getMinValue());
-
- IntegerDeclaration signed32bit = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(-2147483648), signed32bit.getMinValue());
-
- IntegerDeclaration unsigned32bit = IntegerDeclaration.createDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.ZERO, unsigned32bit.getMinValue());
-
- IntegerDeclaration signed64bit = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.valueOf(-9223372036854775808L), signed64bit.getMinValue());
-
- IntegerDeclaration unsigned64bit = IntegerDeclaration.createDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 32);
- assertEquals(BigInteger.ZERO, unsigned64bit.getMinValue());
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- IntegerDeclaration a = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration i = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- assertEquals(a.hashCode(), i.hashCode());
- assertEquals(a.hashCode(), a.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- IntegerDeclaration a = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration b = IntegerDeclaration.createDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration c = IntegerDeclaration.createDeclaration(32, true, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration d = IntegerDeclaration.createDeclaration(32, false, 16, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration e = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 32);
- IntegerDeclaration f = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "", 32);
- IntegerDeclaration g = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "hi", 32);
- IntegerDeclaration h = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 16);
- IntegerDeclaration i = IntegerDeclaration.createDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 32);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertNotEquals(a, d);
- assertNotEquals(a, e);
- assertNotEquals(a, f);
- assertNotEquals(a, g);
- assertNotEquals(a, h);
- assertEquals(a, i);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertNotEquals(d, a);
- assertNotEquals(e, a);
- assertNotEquals(f, a);
- assertNotEquals(g, a);
- assertNotEquals(h, a);
- assertEquals(i, a);
- assertEquals(a, a);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>IntegerDefinitionTest</code> contains tests for the class
- * <code>{@link IntegerDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class IntegerDefinitionTest {
-
- private IntegerDefinition fixture;
- @NonNull private static final String NAME = "testInt";
- @NonNull private static final String clockName = "clock";
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * won't happen
- */
- @Before
- public void setUp() throws CTFException {
- IntegerDeclaration id = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
- ByteBuffer byb = ByteBuffer.allocate(128);
- byb.mark();
- byb.putInt(1);
- byb.reset();
- BitBuffer bb = new BitBuffer(byb);
- fixture = id.createDefinition(null, NAME, bb);
- }
-
- /**
- * Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testIntegerDefinition() {
- IntegerDeclaration declaration = IntegerDeclaration.createDeclaration(1, false, 1,
- ByteOrder.BIG_ENDIAN, Encoding.ASCII, "", 8);
- IDefinitionScope definitionScope = null;
- String fieldName = "";
-
- IntegerDefinition result = new IntegerDefinition(declaration,
- definitionScope, fieldName, 1);
- assertNotNull(result);
- }
-
- /**
- * Run the IntegerDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- IntegerDeclaration result = fixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the long getValue() method test.
- */
- @Test
- public void testGetValue() {
- long result = fixture.getValue();
- assertEquals(0L, result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- assertEquals("0", result);
- }
-
- /**
- * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
- * for unsigned values.
- */
- @Test
- public void testFormatNumber_unsignedLong() {
-
- long unsignedLongValue = -64;
- String result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
- // -64 + 2^64 = 18446744073709551552
- assertEquals("18446744073709551552", result);
-
- unsignedLongValue = -131940199973272L;
- result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
- // -131940199973272l + 2^64 = 18446612133509578344
- assertEquals("18446612133509578344", result);
-
- unsignedLongValue = 123456789L;
- result = IntegerDefinition.formatNumber(unsignedLongValue, 10, false);
- assertEquals("123456789", result);
- }
-
- /**
- * Run the IntegerDefinition formatNumber(Long, int, boolean) method test
- * for signed values.
- */
- @Test
- public void testFormatNumber_signedLong() {
- long signedValue = -64L;
- String result = IntegerDefinition.formatNumber(signedValue, 10, true);
- assertEquals("-64", result);
-
- signedValue = -131940199973272L;
- result = IntegerDefinition.formatNumber(signedValue, 10, true);
- assertEquals("-131940199973272", result);
-
- signedValue = 123456789L;
- result = IntegerDefinition.formatNumber(signedValue, 10, true);
- assertEquals("123456789", result);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 École Polytechnique de Montréal, Ericsson
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- * Alexandre Montplaisir - Split out in separate class
- * Matthew Khouzam - update api (exceptions)
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Endianness test for {@link IntegerDefinition}.
- *
- * @author Geneviève Bastien
- */
-public class IntegerEndiannessTest {
-
- private static final @NonNull String name = "testInt";
- private static final @NonNull String clockName = "clock";
-
- private ByteBuffer bb;
-
- private @NonNull BitBuffer input = new BitBuffer();
-
- /**
- * Set up the bit-buffer to be used
- */
- @Before
- public void setUp() {
- bb = java.nio.ByteBuffer.allocateDirect(8);
- final ByteBuffer byb = bb;
- if (byb == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- bb.put((byte) 0xab);
- bb.put((byte) 0xcd);
- bb.put((byte) 0xef);
- bb.put((byte) 0x12);
- bb.put((byte) 0x34);
- bb.put((byte) 0x56);
- bb.put((byte) 0x78);
- bb.put((byte) 0x9a);
-
- input = new BitBuffer(byb);
- }
-
- /**
- * Read 32-bits BE
- *
- * @throws CTFException
- * error
- */
- @Test
- public void test32BE() throws CTFException {
- IntegerDeclaration be = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
- IntegerDefinition fixture_be = be.createDefinition(null, name, input);
- assertEquals(0xabcdef12, fixture_be.getValue());
- }
-
- /**
- * Read 64-bits BE
- *
- * @throws CTFException
- * error
- */
- @Test
- public void test64BE() throws CTFException {
- IntegerDeclaration be = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
- IntegerDefinition fixture_be = be.createDefinition(null, name, input);
- assertEquals(0xabcdef123456789aL, fixture_be.getValue());
- }
-
- /**
- * Read 32-bits LE
- *
- * @throws CTFException
- * error
- */
- @Test
- public void test32LE() throws CTFException {
- IntegerDeclaration le = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8);
- IntegerDefinition fixture_le = le.createDefinition(null, name, input);
- assertEquals(0x12efcdab, fixture_le.getValue());
- }
-
- /**
- * Read 64-bits LE
- *
- * @throws CTFException
- * error
- */
- @Test
- public void test64LE() throws CTFException {
- IntegerDeclaration le = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8);
- IntegerDefinition fixture_le = le.createDefinition(null, name, input);
- assertEquals(0x9a78563412efcdabL, fixture_le.getValue());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>SequenceDeclarationTest</code> contains tests for the class
- * <code>{@link SequenceDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class SequenceDeclaration2Test {
-
- @NonNull
- private static final String FIELD_NAME = "LengthName";
-
- private SequenceDeclaration fixture;
- @NonNull
- private BitBuffer input = new BitBuffer();
-
- @Before
- public void setUp() {
- fixture = new SequenceDeclaration(FIELD_NAME, StringDeclaration.getStringDeclaration(Encoding.UTF8));
- byte array[] = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' };
- ByteBuffer byb = ByteBuffer.wrap(array);
- if (byb == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- input = new BitBuffer(byb);
- }
-
- /**
- * Run the SequenceDeclaration(String,Declaration) constructor test.
- */
- @Test
- public void testSequenceDeclaration() {
- String lengthName = "";
- IDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8);
-
- SequenceDeclaration result = new SequenceDeclaration(lengthName, elemType);
- assertNotNull(result);
- String string = "[declaration] sequence[";
- assertEquals(string, result.toString().substring(0, string.length()));
- }
-
- /**
- * Run the SequenceDefinition createDefinition(DefinitionScope,String)
- * method test.
- *
- * @throws CTFException
- * an error in the bitbuffer
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- long seqLen = 2;
- IntegerDeclaration id = IntegerDeclaration.createDeclaration(8, false, 8,
- ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 32);
- StructDeclaration structDec = new StructDeclaration(0);
- structDec.addField(FIELD_NAME, id);
- StructDefinition structDef = new StructDefinition(
- structDec,
- null,
- "x",
- new Definition[] {
- new IntegerDefinition(
- id,
- null,
- FIELD_NAME,
- seqLen)
- });
- AbstractArrayDefinition result = fixture.createDefinition(structDef, FIELD_NAME, input);
- assertNotNull(result);
- }
-
- /**
- * Run the Declaration getElementType() method test.
- */
- @Test
- public void testGetElementType() {
- IDeclaration result = fixture.getElementType();
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- String left = "[declaration] sequence[";
- assertEquals(left, result.substring(0, left.length()));
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- assertEquals(-1140774256, fixture.hashCode());
- SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
- SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL);
- SequenceDeclaration c = new SequenceDeclaration("Hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
- assertNotEquals(a.hashCode(), b.hashCode());
- assertNotEquals(a.hashCode(), c.hashCode());
- assertEquals(a.hashCode(), d.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- SequenceDeclaration a = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
- SequenceDeclaration b = new SequenceDeclaration("Hello", IntegerDeclaration.INT_32B_DECL);
- SequenceDeclaration c = new SequenceDeclaration("Hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- SequenceDeclaration d = new SequenceDeclaration("Hi", IntegerDeclaration.INT_32B_DECL);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertEquals(a, d);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertEquals(d, a);
- assertEquals(a, a);
- assertFalse(a.isBinaryEquivalent(b));
- assertFalse(a.isBinaryEquivalent(c));
- assertTrue(a.isBinaryEquivalent(d));
- assertFalse(b.isBinaryEquivalent(a));
- assertFalse(c.isBinaryEquivalent(a));
- assertTrue(d.isBinaryEquivalent(a));
- assertTrue(a.isBinaryEquivalent(a));
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ByteArrayDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>SequenceDefinition2Test</code> contains tests for the class
- * <code>{@link SequenceDefinition2}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@SuppressWarnings("javadoc")
-public class SequenceDefinition2Test {
-
- private ByteArrayDefinition fixture;
- private final static int seqLen = 15;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- */
- @Before
- public void setUp() throws CTFException {
- fixture = initString();
- }
-
- private static ByteArrayDefinition initString() throws CTFException {
- StructDeclaration structDec;
- StructDefinition structDef;
-
- int len = 8;
- IntegerDeclaration id = IntegerDeclaration.createDeclaration(len, false, len,
- ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 8);
- String lengthName = "LengthName";
- structDec = new StructDeclaration(0);
- structDec.addField(lengthName, id);
-
- structDef = new StructDefinition(structDec, null, "x", new Definition[] { new IntegerDefinition(id, null, lengthName, seqLen) });
-
- SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
- ByteBuffer allocateDirect = java.nio.ByteBuffer.allocateDirect(seqLen * len);
- if( allocateDirect == null){
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer input = new BitBuffer(allocateDirect);
- for (int i = 0; i < seqLen; i++) {
- input.putInt(i);
- }
-
- ByteArrayDefinition ret = (ByteArrayDefinition) sd.createDefinition(structDef, "TestX", input);
- assertNotNull(ret);
- return ret;
- }
-
- /**
- * Run the FixedStringDefinition(SequenceDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testFixedStringDefinition() {
- assertNotNull(fixture);
- }
-
- /**
- * Run the SequenceDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- SequenceDeclaration result = (SequenceDeclaration) fixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the Definition getElem(int) method test.
- */
- @Test
- public void testGetElem() {
- int i = 1;
- IDefinition result = fixture.getDefinitions().get(i);
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- assertNotNull(result);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StringDeclarationTest</code> contains tests for the class
- * <code>{@link StringDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class StringDeclarationTest {
-
- private StringDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = StringDeclaration.getStringDeclaration(Encoding.ASCII);
- }
-
- /**
- * Run the StringDeclaration() constructor test.
- */
- @Test
- public void testStringDeclaration() {
- StringDeclaration result = StringDeclaration.getStringDeclaration(Encoding.UTF8);
-
- assertNotNull(result);
- String string = "[declaration] string[";
- assertEquals(string, result.toString().substring(0, string.length()));
- }
-
- /**
- * Run the StringDeclaration(Encoding) constructor test.
- */
- @Test
- public void testStringDeclaration_2() {
- Encoding encoding = Encoding.ASCII;
- StringDeclaration result = StringDeclaration.getStringDeclaration(encoding);
-
- assertNotNull(result);
- String string = "[declaration] string[";
- assertEquals(string, result.toString().substring(0, string.length()));
- }
-
- /**
- * Run the StringDefinition createDefinition(DefinitionScope,String) method
- * test.
- *
- * @throws CTFException
- * out of buffer exception
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- IDefinitionScope definitionScope = null;
- String fieldName = "id";
- ByteBuffer allocate = ByteBuffer.allocate(100);
- if (allocate == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer bb = new BitBuffer(allocate);
- StringDefinition result = fixture.createDefinition(definitionScope,
- fieldName, bb);
-
- assertNotNull(result);
- }
-
- /**
- * Run the Encoding getEncoding() method test.
- */
- @Test
- public void testGetEncoding() {
- Encoding result = fixture.getEncoding();
-
- assertNotNull(result);
- assertEquals("ASCII", result.name());
- assertEquals("ASCII", result.toString());
- assertEquals(1, result.ordinal());
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- String left = "[declaration] string[";
- String right = result.substring(0, left.length());
-
- assertEquals(left, right);
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- assertEquals(32, fixture.hashCode());
- StringDeclaration a = StringDeclaration.getStringDeclaration(Encoding.ASCII);
- StringDeclaration b = StringDeclaration.getStringDeclaration();
- StringDeclaration c = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- StringDeclaration d = StringDeclaration.getStringDeclaration(Encoding.ASCII);
- assertEquals(b.hashCode(), c.hashCode());
- assertEquals(a.hashCode(), d.hashCode());
- assertEquals(a.hashCode(), a.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- StringDeclaration a = StringDeclaration.getStringDeclaration(Encoding.ASCII);
- StringDeclaration b = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- StringDeclaration c = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- StringDeclaration d = StringDeclaration.getStringDeclaration(Encoding.ASCII);
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertEquals(a, d);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertEquals(d, a);
- assertEquals(a, a);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StringDefinitionTest</code> contains tests for the class
- * <code>{@link StringDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class StringDefinitionTest {
-
- private StringDefinition fixture;
- private String testString;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * won't happen
- */
- @Before
- public void setUp() throws CTFException {
- String name = "testString";
- StringDeclaration stringDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- ByteBuffer byteBuffer = ByteBuffer.allocate(100);
- if (byteBuffer == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer bb = new BitBuffer(byteBuffer);
- byteBuffer.mark();
- testString = new String("testString");
- byteBuffer.put(testString.getBytes());
- byteBuffer.reset();
- fixture = stringDec.createDefinition(null, name, bb);
- }
-
- /**
- * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
- * constructor test.
- */
- @Test
- public void testStringDefinition() {
- StringDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- IDefinitionScope definitionScope = null;
- String fieldName = "";
-
- StringDefinition result = new StringDefinition(declaration,
- definitionScope, fieldName, "");
-
- assertNotNull(result);
- }
-
- /**
- * Run the StringDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- StringDeclaration result = fixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the String getValue() method test.
- */
- @Test
- public void testGetValue() {
- String result = fixture.getValue();
- assertNotNull(result);
- }
-
- /**
- * Run the String setValue() method test.
- */
- @Test
- public void testSetValue() {
-
- String result = fixture.getValue();
- assertNotNull(result);
- assertEquals("testString", result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- assertNotNull(result);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StructDeclarationTest</code> contains tests for the class
- * <code>{@link StructDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class StructDeclarationTest {
-
- private StructDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new StructDeclaration(1L);
- }
-
- /**
- * Run the StructDeclaration(long) constructor test.
- */
- @Test
- public void testStructDeclaration() {
- assertNotNull(fixture);
- assertEquals(1L, fixture.getMaxAlign());
-
- String regex = "^\\[declaration\\] struct\\[*.\\]$";
- assertTrue(fixture.toString().matches(regex));
- }
-
- /**
- * Run the void addField(String,Declaration) method test.
- */
- @Test
- public void testAddField() {
- String name = "";
- IDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- fixture.addField(name, declaration);
- }
-
- /**
- * Run the StructDefinition createDefinition(DefinitionScope,String) method
- * test.
- *
- * @throws CTFException
- * out of bounds
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- String fieldName = "";
- ByteBuffer allocate = ByteBuffer.allocate(100);
- if (allocate == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer bb = new BitBuffer(allocate);
- StructDefinition result = fixture.createDefinition(null, fieldName, bb);
- assertNotNull(result);
- }
-
- /**
- * Run the Declaration getField(String) method test.
- */
- @Test
- public void testGetField() {
- IDeclaration result = fixture.getField("test");
-
- assertNull(result);
- }
-
- /**
- * Run the List<String> getFieldsList() method test.
- */
- @Test
- public void testGetFieldsList() {
- Iterable<String> result = fixture.getFieldsList();
-
- assertNotNull(result);
- assertEquals(false, result.iterator().hasNext());
- }
-
- /**
- * Run the long getMinAlign() method test.
- */
- @Test
- public void testGetMinAlign() {
- long result = fixture.getMaxAlign();
- assertEquals(1L, result);
- }
-
- /**
- * Run the boolean hasField(String) method test.
- */
- @Test
- public void testHasField() {
- String name = "";
- boolean result = fixture.hasField(name);
-
- assertEquals(false, result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- String trunc = result.substring(0, 21);
-
- assertEquals("[declaration] struct[", trunc);
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- assertEquals(32, fixture.hashCode());
- StructDeclaration a = new StructDeclaration(8);
- fixture.addField("hello", a);
- a.addField("Time", IntegerDeclaration.INT_32B_DECL);
- StructDeclaration b = new StructDeclaration(8);
- StructDeclaration c = new StructDeclaration(8);
- b.addField("hello", c);
- c.addField("Time", IntegerDeclaration.INT_32B_DECL);
- assertEquals(b.hashCode(), fixture.hashCode());
- c.addField("Space", IntegerDeclaration.INT_32L_DECL);
- assertNotEquals(b.hashCode(), fixture.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- StructDeclaration a = new StructDeclaration(8);
- StructDeclaration b = new StructDeclaration(16);
- StructDeclaration c = new StructDeclaration(8);
- StructDeclaration d = new StructDeclaration(8);
- StructDeclaration e = new StructDeclaration(8);
- StructDeclaration f = new StructDeclaration(8);
- c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertEquals(a, d);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertEquals(d, a);
- assertEquals(a, a);
- a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- f.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- e.addField("hello", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- assertEquals(a, c);
- assertEquals(c, a);
- assertNotEquals(a, d);
- d.addField("hi", IntegerDeclaration.INT_32B_DECL);
- assertNotEquals(a, d);
- a.addField("hello", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- e.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- f.addField("hello", IntegerDeclaration.INT_32B_DECL);
- assertNotEquals(a, e);
- assertNotEquals(a, f);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.io.Util;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>StructDefinitionTest</code> contains tests for the class
- * <code>{@link StructDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class StructDefinitionTest {
-
- private static final @NonNull String TEST_STRUCT_ID = "testStruct";
- private static final @NonNull String ENUM_2 = "y";
- private static final @NonNull String ENUM_1 = "x";
- private static final @NonNull String TAG_ID = "Tag";
- private static final @NonNull String INT_ID = "_id";
- private static final @NonNull String STRING_ID = "_args";
- private static final @NonNull String ENUM_ID = "_enumArgs";
- private static final @NonNull String SEQUENCE_ID = "_seq";
- private static final @NonNull String LENGTH_SEQ = "_len";
- private static final @NonNull String VAR_FIELD_NAME = "SomeVariant";
-
- private StructDefinition fixture;
- private StructDefinition emptyStruct;
- private StructDefinition simpleStruct;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws CTFException
- * won't happen
- */
- @Before
- public void setUp() throws CTFException {
- StructDeclaration sDec = new StructDeclaration(12);
- IntegerDeclaration id = IntegerDeclaration.INT_32B_DECL;
- IntegerDeclaration lenDec = IntegerDeclaration.UINT_8_DECL;
- StringDeclaration sd = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- EnumDeclaration ed = new EnumDeclaration(id);
- SequenceDeclaration seqDec = new SequenceDeclaration(LENGTH_SEQ, id);
- VariantDeclaration varDec = new VariantDeclaration();
- EnumDeclaration tagDec = new EnumDeclaration(id);
- tagDec.add(0, 1, ENUM_1);
- tagDec.add(2, 3, ENUM_2);
- varDec.addField(ENUM_2, id);
- varDec.addField(ENUM_1, sd);
- varDec.setTag(TAG_ID);
- sDec.addField(INT_ID, id);
- sDec.addField(STRING_ID, sd);
- sDec.addField(ENUM_ID, ed);
- sDec.addField(TAG_ID, tagDec);
- sDec.addField(LENGTH_SEQ, lenDec);
- sDec.addField(SEQUENCE_ID, seqDec);
- sDec.addField(VAR_FIELD_NAME, varDec);
- byte bytes[] = new byte[100];
- bytes[4] = 1;
- bytes[8] = 2;
- bytes[13] = 3;
- BitBuffer bb = new BitBuffer(Util.testMemory(ByteBuffer.wrap(bytes)));
- fixture = sDec.createDefinition(null, TEST_STRUCT_ID, bb);
- EnumDefinition eDef = tagDec.createDefinition(fixture, TAG_ID, bb);
- assertNotNull(eDef);
- VariantDefinition vd = varDec.createDefinition(fixture, VAR_FIELD_NAME, bb);
- assertNotNull(vd);
- // Create an empty struct
- StructDeclaration esDec = new StructDeclaration(32);
- emptyStruct = esDec.createDefinition(null, TEST_STRUCT_ID, bb);
-
- // Create a simple struct with two items
- StructDeclaration ssDec = new StructDeclaration(32);
- ssDec.addField(INT_ID, id);
- ssDec.addField(STRING_ID, sd);
- simpleStruct = ssDec.createDefinition(null, TEST_STRUCT_ID, bb);
- }
-
- /**
- * Run the StructDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- StructDeclaration result = fixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the HashMap<String, Definition> getDefinitions() method test.
- */
- @Test
- public void testGetDefinitions_1() {
- IDefinition result = fixture.getDefinition("_id");
- assertNotNull(result);
- }
-
- /**
- * Run the ArrayDefinition lookupArray(String) method test.
- */
- @Test
- public void testLookupArray() {
- String name = INT_ID;
- AbstractArrayDefinition result = fixture.lookupArrayDefinition(name);
- assertNull(result);
- }
-
- /**
- * Run the Definition lookupDefinition(String) method test.
- */
- @Test
- public void testLookupDefinition() {
- String lookupPath = "args";
- IDefinition result = fixture.lookupDefinition(lookupPath);
-
- assertNotNull(result);
- }
-
- /**
- * Run the EnumDefinition lookupEnum(String) method test.
- */
- @Test
- public void testLookupEnum() {
- String name = ENUM_ID;
- EnumDefinition result = fixture.lookupEnum(name);
- assertNotNull(result);
- }
-
- /**
- * Run the IntegerDefinition lookupInteger(String) method test.
- */
- @Test
- public void testLookupInteger_1() {
- String name = "_id";
- IntegerDefinition result = fixture.lookupInteger(name);
- assertNotNull(result);
- }
-
- /**
- * Run the IntegerDefinition lookupInteger(String) method test.
- */
- @Test
- public void testLookupInteger_2() {
- String name = VAR_FIELD_NAME;
- IntegerDefinition result = fixture.lookupInteger(name);
- assertNull(result);
- }
-
- /**
- * Run the SequenceDefinition lookupSequence(String) method test.
- */
- @Test
- public void testLookupFixedStringDefinition() {
- String name = SEQUENCE_ID;
- AbstractArrayDefinition result = fixture.lookupArrayDefinition(name);
- assertNotNull(result);
- }
-
- /**
- * Run the StringDefinition lookupString(String) method test.
- */
- @Test
- public void testLookupString() {
- String name = VAR_FIELD_NAME;
- StringDefinition result = fixture.lookupString(name);
-
- assertNull(result);
- }
-
- /**
- * Run the StructDefinition lookupStruct(String) method test.
- */
- @Test
- public void testLookupStruct() {
- String name = VAR_FIELD_NAME;
- StructDefinition result = fixture.lookupStruct(name);
-
- assertNull(result);
- }
-
- /**
- * Run the VariantDefinition lookupVariant(String) method test.
- */
- @Test
- public void testLookupVariant() {
- String name = VAR_FIELD_NAME;
- VariantDefinition result = fixture.lookupVariant(name);
-
- assertNotNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- assertNotNull(result);
-
- result = emptyStruct.toString();
- assertEquals("{ }", result);
-
- result = simpleStruct.toString();
- assertEquals("{ _id = 0, _args = \"\" }", result);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ArrayDeclaration2Test.class,
- ArrayDefinition2Test.class,
- DefinitionTest.class,
- EnumDeclarationTest.class,
- EnumDefinitionTest.class,
- EventDeclarationTest.class,
- EventHeaderDeclarationTest.class,
- FloatDeclarationTest.class,
- FloatDefinitionTest.class,
- IntegerDeclarationTest.class,
- IntegerDefinitionTest.class,
- IntegerEndiannessTest.class,
- SequenceDeclaration2Test.class,
- SequenceDefinition2Test.class,
- StringDeclarationTest.class,
- StringDefinitionTest.class,
- StructDeclarationTest.class,
- StructDefinitionTest.class,
- VariantDeclarationTest.class,
- VariantDefinitionTest.class,
-})
-public class TestAll {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>VariantDeclarationTest</code> contains tests for the class
- * <code>{@link VariantDeclaration}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class VariantDeclarationTest {
-
- private static final CtfTestTrace testTrace = CtfTestTrace.KERNEL;
-
- private VariantDeclaration fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new VariantDeclaration();
- }
-
- private static IDefinitionScope createDefinitionScope() throws CTFException {
- assumeTrue(testTrace.exists());
- StructDeclaration declaration = new StructDeclaration(8);
- VariantDeclaration variantDeclaration = new VariantDeclaration();
- variantDeclaration.addField("a", IntegerDeclaration.INT_32B_DECL);
- variantDeclaration.addField("b", IntegerDeclaration.INT_32L_DECL);
- variantDeclaration.setTag("a");
-
- EnumDeclaration enumDeclaration = new EnumDeclaration(IntegerDeclaration.UINT_8_DECL);
- enumDeclaration.add(0, 1, "a");
- enumDeclaration.add(2, 2, "b");
- declaration.addField("tag", enumDeclaration);
- declaration.addField("variant", variantDeclaration);
- EnumDefinition tagDef = new EnumDefinition(
- enumDeclaration,
- null,
- "tag",
- new IntegerDefinition(
- IntegerDeclaration.UINT_8_DECL,
- null,
- "test",
- 0)
- );
- VariantDefinition variantDefinition = new VariantDefinition(
- variantDeclaration,
- testTrace.getTrace(),
- "tag",
- "tag",
- new StringDefinition(
- StringDeclaration.getStringDeclaration(Encoding.UTF8),
- null,
- "f",
- "tag"
- ));
-
- IDefinitionScope definitionScope = new StructDefinition(
- declaration,
- variantDefinition,
- "",
- new Definition[] { tagDef, variantDefinition }
- );
-
- return definitionScope;
- }
-
- /**
- * Run the VariantDeclaration() constructor test.
- */
- @Test
- public void testVariantDeclaration() {
- assertNotNull(fixture);
- assertEquals(false, fixture.isTagged());
- String left = "[declaration] variant[";
- assertEquals(left, fixture.toString().substring(0, left.length()));
- }
-
- /**
- * Run the void addField(String,Declaration) method test.
- */
- @Test
- public void testAddField() {
- fixture.setTag("");
- String tag = "";
- IDeclaration declaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- fixture.addField(tag, declaration);
- }
-
- /**
- * Run the VariantDefinition createDefinition(DefinitionScope,String) method
- * test.
- *
- * @throws CTFException
- * Should not happen
- */
- @Test
- public void testCreateDefinition() throws CTFException {
- fixture.setTag("tag");
- fixture.addField("a", IntegerDeclaration.UINT_64B_DECL);
- IDefinitionScope definitionScope = createDefinitionScope();
- String fieldName = "";
- ByteBuffer allocate = ByteBuffer.allocate(100);
- if (allocate == null) {
- throw new IllegalStateException("Failed to allocate memory");
- }
- BitBuffer bb = new BitBuffer(allocate);
- VariantDefinition result = fixture.createDefinition(definitionScope, fieldName, bb);
-
- assertNotNull(result);
- }
-
- /**
- * Run the boolean hasField(String) method test.
- */
- @Test
- public void testHasField() {
- fixture.setTag("");
- String tag = "";
- boolean result = fixture.hasField(tag);
-
- assertEquals(false, result);
- }
-
- /**
- * Run the boolean isTagged() method test.
- */
- @Test
- public void testIsTagged() {
- fixture.setTag("");
- boolean result = fixture.isTagged();
-
- assertEquals(true, result);
- }
-
- /**
- * Run the boolean isTagged() method test.
- */
- @Test
- public void testIsTagged_null() {
- fixture.setTag((String) null);
- boolean result = fixture.isTagged();
-
- assertEquals(false, result);
- }
-
- /**
- * Run the void setTag(String) method test.
- */
- @Test
- public void testSetTag() {
- fixture.setTag("");
- String tag = "";
- fixture.setTag(tag);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- fixture.setTag("");
- String result = fixture.toString();
- String left = "[declaration] variant[";
- String right = result.substring(0, left.length());
-
- assertEquals(left, right);
- }
-
- /**
- * Test the hashcode
- */
- @Test
- public void hashcodeTest() {
- VariantDeclaration a = new VariantDeclaration();
- assertEquals(fixture.hashCode(), a.hashCode());
-
- VariantDeclaration b = new VariantDeclaration();
- b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- VariantDeclaration c = new VariantDeclaration();
- c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- assertEquals(b.hashCode(), c.hashCode());
- }
-
- /**
- * Test the equals
- */
- @Test
- public void equalsTest() {
- VariantDeclaration a = new VariantDeclaration();
- VariantDeclaration b = new VariantDeclaration();
- b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- VariantDeclaration c = new VariantDeclaration();
- c.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- VariantDeclaration d = new VariantDeclaration();
- assertNotEquals(a, null);
- assertNotEquals(a, new Object());
- assertNotEquals(a, b);
- assertNotEquals(a, c);
- assertEquals(a, d);
- assertEquals(a, a);
- assertEquals(b, c);
- assertNotEquals(b, a);
- assertNotEquals(c, a);
- assertEquals(d, a);
- assertEquals(c, b);
- b.setTag("hi");
- assertNotEquals(b, c);
- c.setTag("Hello");
- assertNotEquals(b, c);
- c.setTag("hi");
- assertEquals(b, c);
- b.addField("hello", IntegerDeclaration.INT_32B_DECL);
- d.addField("hello", IntegerDeclaration.INT_32B_DECL);
- d.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- d.setTag("hi");
- assertEquals(b, d);
- assertEquals(d, b);
- }
-
- /**
- * Test the equals out of order
- */
- @Test
- public void equalsOutOfOrderTest() {
- VariantDeclaration a = new VariantDeclaration();
- VariantDeclaration b = new VariantDeclaration();
- b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- b.addField("hello", new VariantDeclaration());
- a.addField("hello", new VariantDeclaration());
- a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- assertEquals(b, a);
- }
-
- /**
- * Test the equals out of order
- */
- @Test
- public void equalsAddTwiceTest() {
- VariantDeclaration a = new VariantDeclaration();
- VariantDeclaration b = new VariantDeclaration();
- b.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- a.addField("hi", StringDeclaration.getStringDeclaration(Encoding.UTF8));
- assertEquals(b, a);
- b.addField("hi", new VariantDeclaration());
- assertNotEquals(b, a);
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.tests.types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
-import org.eclipse.tracecompass.ctf.core.tests.io.Util;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>VariantDefinitionTest</code> contains tests for the class
- * <code>{@link VariantDefinition}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class VariantDefinitionTest {
-
- private VariantDefinition fixture;
-
- StructDefinition fStructDefinition;
- private static final @NonNull String TEST_STRUCT_ID = "testStruct";
- private static final @NonNull String ENUM_7 = "g";
- private static final @NonNull String ENUM_6 = "f";
- private static final @NonNull String ENUM_5 = "e";
- private static final @NonNull String ENUM_4 = "d";
- private static final @NonNull String ENUM_3 = "c";
- private static final @NonNull String ENUM_2 = "b";
- private static final @NonNull String ENUM_1 = "a";
- private static final @NonNull String TAG_ID = "a";
- private static final @NonNull String LENGTH_SEQ = "_len";
- private static final @NonNull String VAR_FIELD_NAME = "var";
- private static final @NonNull String ENUM_8 = "bbq ribs";
-
- /**
- * Perform pre-test initialization.
- *
- * Not sure it needs to be that complicated, oh well...
- *
- * @throws CTFException
- * won't happen
- */
- @Before
- public void setUp() throws CTFException {
- StructDeclaration sDec = new StructDeclaration(12);
- StructDeclaration smallStruct = new StructDeclaration(8);
- IntegerDeclaration iDec = IntegerDeclaration.createDeclaration(32, false, 32, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8);
- IntegerDeclaration lenDec = IntegerDeclaration.createDeclaration(8, false, 8, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8);
- StringDeclaration strDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- EnumDeclaration enDec = new EnumDeclaration(iDec);
- VariantDeclaration varDec = new VariantDeclaration();
- EnumDeclaration tagDec = new EnumDeclaration(iDec);
- CompoundDeclaration arrDec = new ArrayDeclaration(2, iDec);
- FloatDeclaration fDec = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 8);
- tagDec.add(0, 1, ENUM_1);
- tagDec.add(2, 3, ENUM_2);
- tagDec.add(4, 5, ENUM_3);
- tagDec.add(8, 9, ENUM_5);
- tagDec.add(10, 11, ENUM_6);
- tagDec.add(12, 13, ENUM_7);
- varDec.addField(ENUM_4, lenDec);
- varDec.addField(ENUM_7, fDec);
- varDec.addField(ENUM_6, smallStruct);
- varDec.addField(ENUM_5, enDec);
- varDec.addField(ENUM_3, arrDec);
- varDec.addField(ENUM_2, iDec);
- varDec.addField(ENUM_1, strDec);
-
- sDec.addField(TAG_ID, tagDec);
- sDec.addField(LENGTH_SEQ, lenDec);
-
- sDec.addField(VAR_FIELD_NAME, varDec);
- varDec.setTag(TAG_ID);
-
- final ByteBuffer byteBuffer = Util.testMemory(ByteBuffer.allocate(100));
- BitBuffer bb = new BitBuffer(byteBuffer);
- byteBuffer.mark();
- byteBuffer.putInt(1);
- byteBuffer.putInt(2);
- byteBuffer.putInt(3);
- byteBuffer.reset();
- fStructDefinition = sDec.createDefinition(null, TEST_STRUCT_ID, bb);
- fixture = (VariantDefinition) fStructDefinition.getDefinition(VAR_FIELD_NAME);
- }
-
- /**
- * Run the VariantDefinition(VariantDeclaration,DefinitionScope,String)
- *
- * @throws CTFException
- * should not happen
- */
- @Test
- public void testVariantDefinition() throws CTFException {
- VariantDeclaration declaration = new VariantDeclaration();
- declaration.setTag("");
- VariantDeclaration variantDeclaration = new VariantDeclaration();
- variantDeclaration.addField("", new EnumDeclaration(IntegerDeclaration.INT_32B_DECL));
- variantDeclaration.addField("a", IntegerDeclaration.INT_64B_DECL);
- declaration.addField(ENUM_3, StringDeclaration.getStringDeclaration(Encoding.UTF8));
- variantDeclaration.setTag("a");
-
- byte[] bytes = new byte[128];
- ByteBuffer byb = ByteBuffer.wrap(bytes);
- byb.mark();
- byb.putInt(0);
- byb.putShort((short) 2);
- byb.put(new String("hello").getBytes());
- byb.reset();
- BitBuffer bb = new BitBuffer(byb);
- VariantDefinition variantDefinition = variantDeclaration.createDefinition(fStructDefinition, "field", bb);
- EnumDeclaration declaration2 = new EnumDeclaration(IntegerDeclaration.INT_8_DECL);
- declaration2.add(0, 2, ENUM_3);
- EnumDefinition enumDefinition = new EnumDefinition(
- declaration2,
- null,
- "a",
- new IntegerDefinition(
- IntegerDeclaration.INT_8_DECL,
- null,
- "A",
- 1
- ));
- final StructDeclaration declarationScope = new StructDeclaration(1L);
- declarationScope.addField("", enumDefinition.getDeclaration());
- declarationScope.addField("variant", variantDeclaration);
- IDefinitionScope definitionScope = new StructDefinition(
- declarationScope,
- variantDefinition,
- "",
- new Definition[] { enumDefinition, variantDefinition }
- );
- String fieldName = "";
- declaration.setTag("");
- VariantDefinition result = declaration.createDefinition(definitionScope, fieldName, bb);
- assertNotNull(result);
- }
-
- /**
- * Run the Definition getCurrentField() method test.
- */
- @Test
- public void testGetCurrentField() {
- IDefinition result = fixture.getCurrentField();
- assertNotNull(result);
- }
-
- /**
- * Run the String getCurrentFieldName() method test.
- */
- @Test
- public void testGetCurrentFieldName() {
- String result = fixture.getCurrentFieldName();
- assertNotNull(result);
- }
-
- /**
- * Run the VariantDeclaration getDeclaration() method test.
- */
- @Test
- public void testGetDeclaration() {
- VariantDeclaration result = fixture.getDeclaration();
- assertNotNull(result);
- }
-
- /**
- * Run the HashMap<String, Definition> getDefinitions() method test.
- */
- @Test
- public void testGetDefinitions() {
- IDefinition result = fixture.getCurrentField();
- assertNotNull(result);
- }
-
- /**
- * Run the String getPath() method test.
- */
- @Test
- public void testGetPath() {
- String result = fixture.getScopePath().getPath();
- assertNotNull(result);
- }
-
- /**
- * Run the ArrayDefinition lookupArray(String) method test.
- */
- @Test
- public void testLookupArray() {
- AbstractArrayDefinition result = fixture.lookupArrayDefinition(ENUM_3);
- assertNull(result);
- }
-
- /**
- * Run the Definition lookupDefinition(String) method test.
- */
- @Test
- public void testLookupDefinition() {
- IDefinition result = fixture.lookupDefinition(ENUM_1);
- assertNotNull(result);
- assertEquals("a", ((EnumDefinition) result).getStringValue());
- }
-
- /**
- * Run the EnumDefinition lookupEnum(String) method test.
- */
- @Test
- public void testLookupEnum() {
- EnumDefinition result = fixture.lookupEnum(ENUM_5);
- assertNull(result);
- }
-
- /**
- * Run the IntegerDefinition lookupInteger(String) method test.
- */
- @Test
- public void testLookupInteger() {
- IntegerDefinition result = fixture.lookupInteger(ENUM_2);
- assertNull(result);
- }
-
- /**
- * Run the StringDefinition lookupString(String) method test.
- */
- @Test
- public void testLookupString() {
- StringDefinition result = fixture.lookupString(ENUM_1);
- assertNull(result);
- }
-
- /**
- * Run the StructDefinition lookupStruct(String) method test.
- */
- @Test
- public void testLookupStruct() {
- StructDefinition result = fixture.lookupStruct(ENUM_6);
- assertNull(result);
- }
-
- /**
- * Run the VariantDefinition lookupVariant(String) method test.
- */
- @Test
- public void testLookupVariant() {
- VariantDefinition result = fixture.lookupVariant(ENUM_8);
- assertNull(result);
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- String result = fixture.toString();
- assertEquals("{ a = \"\" }", result);
- }
-}
+++ /dev/null
-*.bz2
-*.gz
-*.tar
-*.ht
-*.zip
-/ctf-testsuite
-/cyg-profile
-/funky_trace
-/hello-lost
-/kernel
-/kernel_vm
-/synctraces
-/synthetic-trace
-/trace2
-/exp
-/django-benchmark
-/bug446190
-/flipping-endianness
+++ /dev/null
-4c67592e010111285c6e5a89dda0e008
+++ /dev/null
-00000000006062cc b angle
-0000000000606248 d animate
-00000000006062e0 b asp
-0000000000606290 d blue.19445
-00000000006062b0 B __bss_start
-00000000006062b8 b completed.6718
- U cos@@GLIBC_2.2.5
-0000000000401aac t current_time
- U __cyg_profile_func_enter@@GLIBC_2.2.5
- U __cyg_profile_func_exit@@GLIBC_2.2.5
-0000000000606230 D __data_start
-0000000000606230 W data_start
-00000000004019f0 t deregister_tm_clones
-0000000000401a60 t __do_global_dtors_aux
-0000000000605de8 t __do_global_dtors_aux_fini_array_entry
-00000000004033a7 t draw
-0000000000403760 t draw_frame
-000000000040357a t draw_gears
-0000000000606238 D __dso_handle
-0000000000605df8 d _DYNAMIC
-00000000006062b0 D _edata
-00000000006062e8 B _end
-00000000004045c8 t event_loop
- U exit@@GLIBC_2.2.5
-000000000060624c d eyesep
- U fflush@@GLIBC_2.2.5
-0000000000404c54 T _fini
-0000000000606250 d fix_point
-0000000000401a80 t frame_dummy
-0000000000605de0 t __frame_dummy_init_array_entry
-0000000000405470 r __FRAME_END__
-00000000006062e4 b frames.19426
-00000000006062d0 b fullscreen
-0000000000401b23 t gear
-00000000006062c0 b gear1
-00000000006062c4 b gear2
-00000000006062c8 b gear3
- U getenv@@GLIBC_2.2.5
- U gettimeofday@@GLIBC_2.2.5
- U glBegin
- U glCallList
- U glClear
- U glDeleteLists
- U glDrawBuffer
- U glEnable
- U glEnd
- U glEndList
- U glFrustum
- U glGenLists
- U glGetString
- U glLightfv
- U glLoadIdentity
- U glMaterialfv
- U glMatrixMode
- U glNewList
- U glNormal3f
-0000000000606000 d _GLOBAL_OFFSET_TABLE_
- U glPopMatrix
- U glPushMatrix
- U glRotatef
- U glShadeModel
- U glTranslated
- U glTranslatef
- U glVertex3f
- U glViewport
- U glXChooseVisual
- U glXCreateContext
- U glXDestroyContext
- U glXGetProcAddressARB
- U glXMakeCurrent
- U glXQueryDrawable
- U glXQueryExtensionsString
- U glXSwapBuffers
- w __gmon_start__
-0000000000606280 d green.19444
-0000000000404412 t handle_event
-0000000000403b14 t init
-0000000000401560 T _init
-0000000000605de8 t __init_array_end
-0000000000605de0 t __init_array_start
-0000000000404c60 R _IO_stdin_used
-0000000000404244 t is_glx_extension_supported
- w _ITM_deregisterTMCloneTable
- w _ITM_registerTMCloneTable
-0000000000605df0 d __JCR_END__
-0000000000605df0 d __JCR_LIST__
- w _Jv_RegisterClasses
-00000000006062d8 b left
-0000000000404c50 T __libc_csu_fini
-0000000000404bc0 T __libc_csu_init
- U __libc_start_main@@GLIBC_2.2.5
-000000000040472b T main
-0000000000403d60 t make_window
-0000000000405034 r MWM_HINTS_DECORATIONS.19450
-0000000000403cb1 t no_border
-0000000000606260 d pos.19442
- U printf@@GLIBC_2.2.5
-0000000000405038 r PROP_MOTIF_WM_HINTS_ELEMENTS.19451
- U puts@@GLIBC_2.2.5
-0000000000404311 t query_vsync
-0000000000606270 d red.19443
-0000000000401a20 t register_tm_clones
-000000000040392b t reshape
-00000000006062dc b right
-00000000006062d4 b samples
- U sin@@GLIBC_2.2.5
- U sqrt@@GLIBC_2.2.5
- U __stack_chk_fail@@GLIBC_2.4
-00000000004019c0 T _start
-00000000006062b0 B stdout@@GLIBC_2.2.5
-00000000006062d1 b stereo
- U strcmp@@GLIBC_2.2.5
- U strlen@@GLIBC_2.2.5
- U strstr@@GLIBC_2.2.5
- U strtod@@GLIBC_2.2.5
-00000000006062b0 D __TMC_END__
-00000000006062a8 d tRate0.19428
-00000000006062a0 d tRot0.19427
-00000000004046bd t usage
-0000000000606240 d view_rotx
-0000000000606244 d view_roty
-00000000006062bc b view_rotz
- U XChangeProperty
- U XCloseDisplay
- U XCreateColormap
- U XCreateWindow
- U XDestroyWindow
- U XFree
- U XInternAtom
- U XLookupKeysym
- U XLookupString
- U XMapWindow
- U XNextEvent
- U XOpenDisplay
- U XParseGeometry
- U XPending
- U XSetNormalHints
- U XSetStandardProperties
+++ /dev/null
-088795f3d7b483d197ffad51137ab39e
+++ /dev/null
-afd538a1dc0c42e825292f0ce4123583
+++ /dev/null
-c6309471689cf999ce2d3123f1594713
-
+++ /dev/null
-9c68dba0f722d4c4a34791651c5b0e83
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- Copyright (C) 2013, Red Hat, 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
--->
-
-<project name="Extract Traces" default="main" >
-<target name="main">
- <antcall>
- <target name="checkAnyTraceExists"/>
- <target name="verifyChecksum"/>
- <target name="deleteFailedCheckSumTraces"/>
- </antcall>
- <antcall target="downloadTraceFiles"/>
- <exec executable = "git" failifexecutionfails="false" timeout="20000">
- <arg value = "clone"/>
- <arg value = "https://github.com/efficios/ctf-testsuite.git"/>
- </exec>
- <condition property="testSuiteExists">
- <and>
- <available file="ctf-testsuite" type="dir"/>
- </and>
- </condition>
- <antcall target="pullTestSuite"/>
- <condition property="tracesExist">
- <and>
- <available file="sample-ctf-trace-20120412.tar.bz2"/>
- <available file="trace2.tar.bz2"/>
- <available file="kernel_vm.tar.bz2" />
- <available file="synctraces.tar.gz" />
- <available file="django-benchmark.tar.gz" />
- <available file="hello-lost.tar.bz2" />
- <available file="cyg-profile.tar.bz2" />
- <available file="funky_trace.tar.bz2" />
- <available file="bug446190.tar.bz2" />
- <available file="flipping-endianness.tar.bz2" />
- </and>
- </condition>
- <antcall target="extractTraces"/>
-</target>
-
-<target name="checkAnyTraceExists">
- <pathconvert property="anyTraceExists" setonempty="false" pathsep=" ">
- <path>
- <fileset dir="." includes="*.tar.bz2" />
- <fileset dir="." includes="*.tar.gz" />
- <fileset dir="." includes="*.zip" />
- </path>
- </pathconvert>
-</target>
-
-<target name="verifyChecksum">
- <echo message="Verifying: ${anyTraceExists}"/>
- <condition property="failedCheckSum">
- <and>
- <isset property="anyTraceExists"/>
- <not>
- <and>
- <checksum>
- <fileset dir="." includes="*.tar.bz2" />
- <fileset dir="." includes="*.tar.gz" />
- <fileset dir="." includes="*.zip" />
- </checksum>
- </and>
- </not>
- </and>
- </condition>
-</target>
-
-
-<target name="deleteFailedCheckSumTraces" if="failedCheckSum">
- <echo message="Some traces have failed the checksum tests. Deleting traces."/>
- <delete verbose="true">
- <fileset dir="." includes="*.tar.bz2" />
- <fileset dir="." includes="*.tar.gz" />
- <fileset dir="." includes="*.zip" />
- </delete>
-</target>
-
-<target name="warnFailedCheckSum" if="failedCheckSum">
- <echo message="WARNING: Some downloaded traces failed the checkum."/>
-</target>
-
-<target name="downloadTraceFiles">
- <echo message="Attempting to download test traces"/>
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="sample-ctf-trace-20120412.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/sample-ctf-trace-20120412.tar.bz2"/>
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="trace2.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/trace2.tar.bz2"/>
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="kernel_vm.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/kernel_vm.tar.bz2" />
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="synctraces.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/synctraces.tar.gz" />
- <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="django-benchmark.tar.gz" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/django-benchmark.tar.gz" />
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="hello-lost.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/hello-lost.tar.bz2" />
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="cyg-profile.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/cyg-profile.tar.bz2" />
- <get ignoreerrors="true" maxtime="60" skipexisting="true" dest="funky_trace.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/funky_trace.tar.bz2" />
- <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="testtraceExp.zip" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/testtraceExp.zip" />
- <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="bug446190.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/bug446190.tar.bz2" />
- <get ignoreerrors="true" maxtime="200" skipexisting="true" dest="flipping-endianness.tar.bz2" src="http://archive.eclipse.org/tracecompass/test-traces/ctf/flipping-endianness.tar.bz2" />
-</target>
-
-<target name="pullTestSuite" if="testSuiteExists">
- <!-- Update the local 'master' branch -->
- <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
- <arg value = "checkout"/>
- <arg value = "master"/>
- </exec>
- <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
- <arg value = "pull"/>
- </exec>
-
- <!-- Checkout the commit requested by the current build -->
- <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite" timeout="20000">
- <arg value = "checkout"/>
- <arg value = "${ctf-test-suite-commit}"/>
- </exec>
-</target>
-
-<target name="extractTraces" if="tracesExist">
- <antcall>
- <target name="checkAnyTraceExists"/>
- <target name="verifyChecksum"/>
- <target name="warnFailedCheckSum"/>
- </antcall>
- <bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
- <bunzip2 src="trace2.tar.bz2"/>
- <bunzip2 src="kernel_vm.tar.bz2" />
- <gunzip src="synctraces.tar.gz" />
- <gunzip src="django-benchmark.tar.gz" />
- <bunzip2 src="hello-lost.tar.bz2" />
- <bunzip2 src="cyg-profile.tar.bz2" />
- <bunzip2 src="funky_trace.tar.bz2" />
- <bunzip2 src="bug446190.tar.bz2"/>
- <bunzip2 src="flipping-endianness.tar.bz2"/>
- <unzip src="testtraceExp.zip" dest="./exp" />
-
- <untar src="sample-ctf-trace-20120412.tar" dest="." />
- <untar src="trace2.tar" dest="." />
- <untar src="kernel_vm.tar" dest="." />
- <untar src="synctraces.tar" dest="." />
- <untar src="django-benchmark.tar" dest="." />
- <untar src="hello-lost.tar" dest="." />
- <untar src="cyg-profile.tar" dest="." />
- <untar src="funky_trace.tar" dest="." />
- <untar src="bug446190.tar" dest="." />
- <untar src="flipping-endianness.tar" dest="." />
-
- <echo message="Traces extracted successfully"/>
-</target>
-</project>
+++ /dev/null
-4ca17df0c3e3a0dc14940a988630d2d1
+++ /dev/null
-0aa7f55c4305e642e62c482474b937b3
+++ /dev/null
-6b54b6b4ff7313eb7cd1edb44b39b1d3
+++ /dev/null
-715e024f8b641d5cb3c5541d34ade5da
+++ /dev/null
-6c0bffcfaee984bc70eab5bcddce4708
+++ /dev/null
-6971bb6f2385abdb17d017f4faaefc16
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.ctf.core</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=error
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.ctf.core;singleton:=true
-Bundle-Activator: org.eclipse.tracecompass.internal.ctf.core.Activator
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.tracecompass.common.core,
- org.eclipse.tracecompass.ctf.parser
-Export-Package: org.eclipse.tracecompass.ctf.core,
- org.eclipse.tracecompass.ctf.core.event,
- org.eclipse.tracecompass.ctf.core.event.io,
- org.eclipse.tracecompass.ctf.core.event.scope,
- org.eclipse.tracecompass.ctf.core.event.types,
- org.eclipse.tracecompass.ctf.core.trace,
- org.eclipse.tracecompass.internal.ctf.core;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.event;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.event.metadata;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.event.types;x-friends:="org.eclipse.tracecompass.ctf.core.tests,org.eclipse.tracecompass.tmf.ctf.core,org.eclipse.tracecompass.tmf.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.event.types.composite;x-friends:="org.eclipse.tracecompass.ctf.core.tests",
- org.eclipse.tracecompass.internal.ctf.core.trace;x-friends:="org.eclipse.tracecompass.ctf.core.tests"
-Import-Package: com.google.common.base,
- com.google.common.collect,
- org.antlr.runtime;version="3.2.0",
- org.antlr.runtime.tree;version="3.2.0"
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-src.includes = about.html
-additional.bundles = org.eclipse.jdt.annotation
-jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
\ No newline at end of file
+++ /dev/null
-#!/bin/bash
-# LTTng Trace Control bash completion
-#
-
-_lttng_complete_sessions() {
- local sessions
- if ! _complete_as_root ; then
- sessions=$(for i in $(ls -d ~/.lttng/*/); do basename $i; done)
- COMPREPLY=( $(compgen -W "${sessions}" -- $cur) )
- #else
- # Permission denied, what should we do ?
- # sessions=$(for i in $(ls -d ~root/.lttng/*/); do basename $i; done)
- #COMPREPLY=( $(compgen -W "${sessions}" -- $cur) )
- fi
-}
-
-_lttng_create() {
- local create_opts
- create_opts="-h --help -o --output"
-
- case $prev in
- --output|-o)
- _filedir -d
- return
- ;;
- esac
-
- case $cur in
- -*)
- COMPREPLY=( $(compgen -W "${create_opts}" -- $cur) )
- return
- ;;
- esac
-}
-
-_lttng_start_stop() {
- local start_stop_opts
- start_stop_opts="-h --help"
-
- case $cur in
- -*)
- COMPREPLY=( $(compgen -W "${start_stop_opts}" -- $cur) )
- ;;
- *)
- _lttng_complete_sessions
- ;;
- esac
-}
-
-_lttng_opts() {
- local opts
- opts=$(lttng --dump-options)
-
- COMPREPLY=( $(compgen -W "${opts}" -- $cur) )
-}
-
-_lttng_commands() {
- COMPREPLY=( $(compgen -W "$commands" -- $cur) )
-}
-
-_lttng_before_command() {
- # Check if the previous word should alter the behavior
- case $prev in
- --group|-g)
- COMPREPLY=( $(compgen -g -- $cur) )
- return
- ;;
- esac
-
- case $cur in
- -*)
- # If the current word starts with a dash, complete with options
- _lttng_opts
- ;;
- *)
- # Otherwise complete with commands
- _lttng_commands
- ;;
- esac
-}
-
-_lttng_after_command() {
- case $command_found in
- "create")
- _lttng_create
- ;;
- "start"|"stop")
- _lttng_start_stop
- ;;
- esac
-}
-
-_lttng_is_command() {
- for command in $commands; do
- if [ "$1" == "$command" ]; then
- return 0
- fi
- done
-
- return 1
-}
-
-_lttng() {
- local cur prev commands command_found command_found_index
-
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
- commands=$(lttng --dump-commands)
-
- command_found=""
- command_found_index=-1
-
- for (( i = 1 ; i < ${#COMP_WORDS[@]} ; i++ )); do
- _lttng_is_command ${COMP_WORDS[$i]}
- if [ $? -eq 0 ]; then
- command_found=${COMP_WORDS[$i]}
- command_found_index=$i
- break
- fi
-
- done
-
- if [ -n "$command_found" ] && [ "$COMP_CWORD" -gt "$command_found_index" ]; then
- _lttng_after_command
- else
- _lttng_before_command
- fi
-}
-
-complete -F _lttng lttng
-
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-#Properties file for org.eclipse.tracecompass.ctf.core
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = Trace Compass CTF Core Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <name>Trace Compass CTF Core Plug-in</name>
- <groupId>org.eclipse.tracecompass</groupId>
- <artifactId>org.eclipse.tracecompass.ctf.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-source-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core;
-
-/**
- * General exception that is thrown when there is a problem somewhere with the
- * CTF trace reader.
- *
- * @author Alexandre Montplaisir
- * @since 1.0
- */
-public class CTFException extends Exception {
-
- private static final long serialVersionUID = 2065258365219777672L;
-
- /**
- * Default constructor with no message.
- */
- public CTFException() {
- super();
- }
-
- /**
- * Constructor with an attached message.
- *
- * @param message
- * The message attached to this exception
- */
- public CTFException(String message) {
- super(message);
- }
-
- /**
- * Re-throw an exception into this type.
- *
- * @param e
- * The previous Exception we caught
- */
- public CTFException(Exception e) {
- super(e);
- }
-
- /**
- * Constructor with an attached message and re-throw an exception into this type.
- *
- * @param message
- * The message attached to this exception
- * @param exception
- * The previous Exception caught
- */
- public CTFException(String message, Throwable exception) {
- super(message, exception);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- * Matthew Khouzam - Add packet header Strings
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-
-/**
- * Non-externalized strings for use with the CTF plugin (event names, field
- * names, etc.)
- *
- * @author Alexandre Montplaisir
- */
-@SuppressWarnings("nls")
-@NonNullByDefault
-public interface CTFStrings {
-
- /** Event name for lost events */
- String LOST_EVENT_NAME = "Lost event";
-
- /**
- * Name of the field in lost events indicating how many actual events were
- * lost
- */
- String LOST_EVENTS_FIELD = "Lost events";
-
- /**
- * Name of the field in lost events indicating the time range
- */
- String LOST_EVENTS_DURATION = "duration";
-
- // -------------------------------------------------------------------------
- // Packet header strings
- // -------------------------------------------------------------------------
-
- /**
- * Lost events so far in this stream (LTTng Specific)
- *
- * @since 1.0
- */
- String EVENTS_DISCARDED = "events_discarded";
-
- /**
- * The CPU ID of this packet (LTTng Specific)
- *
- * @since 1.0
- */
- String CPU_ID = "cpu_id";
-
- /**
- * The device of this packet
- *
- * @since 1.0
- */
- String DEVICE = "device";
-
- /**
- * The first time stamp of this packet
- *
- * @since 1.0
- */
- String TIMESTAMP_BEGIN = "timestamp_begin";
-
- /**
- * The last time stamp of this packet
- *
- * @since 1.0
- */
- String TIMESTAMP_END = "timestamp_end";
-
- /**
- * Size of this packet
- *
- * @since 1.0
- */
- String PACKET_SIZE = "packet_size";
-
- /**
- * Size of data in this packet (not necessarily the packet size)
- *
- * @since 1.0
- */
- String CONTENT_SIZE = "content_size";
-
- /**
- * Magic number
- *
- * @since 1.0
- */
- String MAGIC = "magic";
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
-
-/**
- * Callsite information to help with cdt integration
- *
- * @author Matthew Khouzam
- */
-public class CTFCallsite implements Comparable<CTFCallsite> {
-
- // Integer size
- private static final int INT_BITS = Integer.SIZE;
-
- // a bitmask for the size of an integer
- private static final long INT_MASK = (1L << INT_BITS) - 1;
-
- /**
- * The event name
- */
- private final String fEventName;
-
- /**
- * the file name of the callsite
- */
- private final String fFileName;
-
- /**
- * the instruction pointer
- */
- private final long fIp;
-
- /**
- * the function name
- */
- private final String fFunctionName;
-
- /**
- * the line number of the callsite
- */
- private final long fLineNumber;
-
- /**
- * The callsite constructor
- *
- * @param en
- * The event name
- * @param func
- * the function name
- * @param ip
- * the instruction pointer of the callsite
- * @param fn
- * the file name of the callsite
- * @param line
- * the line number of the callsite
- */
- public CTFCallsite(String en, String func, long ip, String fn, long line) {
- fEventName = en;
- fFileName = fn;
- fFunctionName = func;
- fIp = ip;
- fLineNumber = line;
- }
-
- /**
- * @return the eventName
- */
- public String getEventName() {
- return fEventName;
- }
-
- /**
- * @return the fileName
- */
- public String getFileName() {
- return fFileName;
- }
-
- /**
- * @return the ip
- */
- public long getIp() {
- return fIp;
- }
-
- /**
- * @return the functionName
- */
- public String getFunctionName() {
- return fFunctionName;
- }
-
- /**
- * @return the lineNumber
- */
- public long getLineNumber() {
- return fLineNumber;
- }
-
- /*
- * The callsites will be sorted by calling addresses. To do this we take IPs
- * (instruction pointers) and compare them. Java only supports signed
- * operation and since memory addresses are unsigned, we will convert the
- * longs into integers that contain the high and low bytes and compare them.
- */
- @Override
- public int compareTo(CTFCallsite o) {
- /*
- * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
- * will return the lower 32 bits
- */
-
- long other = o.fIp;
- /*
- * To get a high int: we downshift by 32 and bitwise and with the mask
- * to get rid of the sign
- *
- * To get the low int: we bitwise and with the mask.
- */
- long otherHigh = (other >> INT_BITS) & INT_MASK;
- long otherLow = other & INT_MASK;
- long ownHigh = (fIp >> INT_BITS) & INT_MASK;
- long ownLow = fIp & INT_MASK;
- /* are the high values different, if so ignore the lower values */
- if (ownHigh > otherHigh) {
- return 1;
- }
- if (ownHigh < otherHigh) {
- return -1;
- }
- /* the high values are the same, compare the lower values */
- if (ownLow > otherLow) {
- return 1;
- }
- if (ownLow < otherLow) {
- return -1;
- }
- /* the values are identical */
- return 0;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
- result = prime * result + ((fFileName == null) ? 0 : fFileName.hashCode());
- result = prime * result + ((fFunctionName == null) ? 0 : fFunctionName.hashCode());
- result = prime * result + (int) (fIp ^ (fIp >>> 32));
- result = prime * result + (int) (fLineNumber ^ (fLineNumber >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- CTFCallsite other = (CTFCallsite) obj;
- if (!equalsNullable(fEventName, other.fEventName)) {
- return false;
- }
- if (!equalsNullable(fFileName, other.fFileName)) {
- return false;
- }
- if (!equalsNullable(fFunctionName, other.fFunctionName)) {
- return false;
- }
- if (fIp != other.fIp) {
- return false;
- }
- if (fLineNumber != other.fLineNumber) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return fFileName + "/" + fFunctionName + ":" + fLineNumber; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Clock description used in CTF traces
- */
-public class CTFClock {
-
- private static final long ONE_BILLION_L = 1000000000L;
- private static final double ONE_BILLION_D = 1000000000.0;
-
- private static final String NAME = "name"; //$NON-NLS-1$
- private static final String FREQ = "freq"; //$NON-NLS-1$
- private static final String OFFSET = "offset"; //$NON-NLS-1$
-
- private long fClockOffset = 0;
- private double fClockScale = 1.0;
- private double fClockAntiScale = 1.0;
-
- /**
- * Field properties.
- */
- private final Map<String, Object> fProperties = new HashMap<>();
- /**
- * Field name.
- */
- private String fName;
- private boolean fIsScaled = false;
-
- /**
- * Default constructor
- */
- public CTFClock() {
- }
-
- /**
- * Method addAttribute.
- *
- * @param key
- * String
- * @param value
- * Object
- */
- public void addAttribute(String key, Object value) {
- fProperties.put(key, value);
- if (key.equals(NAME)) {
- fName = (String) value;
- }
- if (key.equals(FREQ)) {
- /*
- * Long is converted to a double. the double is then dividing
- * another double that double is saved. this is precise as long as
- * the long is under 53 bits long. this is ok as long as we don't
- * have a system with a frequency of > 1 600 000 000 GHz with
- * 200 ppm precision
- */
- fIsScaled = !((Long) getProperty(FREQ)).equals(ONE_BILLION_L);
- fClockScale = ONE_BILLION_D / ((Long) getProperty(FREQ)).doubleValue();
- fClockAntiScale = 1.0 / fClockScale;
-
- }
- if (key.equals(OFFSET)) {
- fClockOffset = (Long) getProperty(OFFSET);
- }
- }
-
- /**
- * Method getName.
- *
- * @return String
- */
- public String getName() {
- return fName;
- }
-
- /**
- * Method getProperty.
- *
- * @param key
- * String
- * @return Object
- */
- public Object getProperty(String key) {
- return fProperties.get(key);
- }
-
- /**
- * @return the clockOffset
- */
- public long getClockOffset() {
- return fClockOffset;
- }
-
- /**
- * @return the clockScale
- */
- public double getClockScale() {
- return fClockScale;
- }
-
- /**
- * @return the clockAntiScale
- */
- public double getClockAntiScale() {
- return fClockAntiScale;
- }
-
- /**
- * @return is the clock in ns or cycles?
- */
- public boolean isClockScaled() {
- return fIsScaled;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-
-/**
- * Representation of a particular instance of an event.
- */
-public final class EventDefinition implements IDefinitionScope {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * A null event, can be used for testing or poison pilling
- */
- @NonNull
- public static final EventDefinition NULL_EVENT = new EventDefinition(new EventDeclaration(), null, -1L, null, null, null, null);
-
- /**
- * The corresponding event declaration.
- */
- private final IEventDeclaration fDeclaration;
-
- /**
- * The timestamp of the current event.
- */
- private final long fTimestamp;
-
- /**
- * The event context structure definition.
- */
- private final ICompositeDefinition fEventContext;
-
- private final ICompositeDefinition fStreamContext;
-
- private final ICompositeDefinition fPacketContext;
-
- /**
- * The event fields structure definition.
- */
- private final ICompositeDefinition fFields;
-
- /**
- * The StreamInputReader that reads this event definition.
- */
- private final CTFStreamInputReader fStreamInputReader;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs an event definition.
- *
- * @param declaration
- * The corresponding event declaration
- * @param streamInputReader
- * The SIR from where this EventDef was read
- * @param timestamp
- * event timestamp
- * @param eventContext
- * The event context
- * @param packetContext
- * the packet context
- * @param streamContext
- * the stream context
- * @param fields
- * The event fields
- * @since 1.0
- */
- public EventDefinition(IEventDeclaration declaration,
- CTFStreamInputReader streamInputReader,
- long timestamp,
- ICompositeDefinition streamContext,
- ICompositeDefinition eventContext,
- ICompositeDefinition packetContext,
- ICompositeDefinition fields) {
- fDeclaration = declaration;
- fStreamInputReader = streamInputReader;
- fTimestamp = timestamp;
- fFields = fields;
- fEventContext = eventContext;
- fPacketContext = packetContext;
- fStreamContext = streamContext;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * @since 1.0
- */
- @Override
- public ILexicalScope getScopePath() {
- String eventName = fDeclaration.getName();
- if (eventName == null) {
- return null;
- }
- ILexicalScope myScope = ILexicalScope.EVENT.getChild(eventName);
- if (myScope == null) {
- myScope = new LexicalScope(ILexicalScope.EVENT, eventName);
- }
- return myScope;
- }
-
- /**
- * Gets the declaration (the form) of the data
- *
- * @return the event declaration
- */
- public IEventDeclaration getDeclaration() {
- return fDeclaration;
- }
-
- /**
- * Gets the fields of a definition
- *
- * @return the fields of a definition in struct form. Can be null.
- * @since 1.0
- */
- public ICompositeDefinition getFields() {
- return fFields;
- }
-
- /**
- * Gets the context of this event without the context of the stream
- *
- * @return the context in struct form
- * @since 1.0
- */
- public ICompositeDefinition getEventContext() {
- return fEventContext;
- }
-
- /**
- * Gets the context of this event within a stream
- *
- * @return the context in struct form
- * @since 1.0
- */
- public ICompositeDefinition getContext() {
-
- /* Most common case so far */
- if (fStreamContext == null) {
- return fEventContext;
- }
-
- /* streamContext is not null, but the context of the event is null */
- if (fEventContext == null) {
- return fStreamContext;
- }
-
- // TODO: cache if this is a performance issue
-
- /* The stream context and event context are assigned. */
- StructDeclaration mergedDeclaration = new StructDeclaration(1);
-
- List<Definition> fieldValues = new ArrayList<>();
-
- /* Add fields from the stream */
- List<String> fieldNames = fStreamContext.getFieldNames();
- for (String fieldName : fieldNames) {
- Definition definition = fStreamContext.getDefinition(fieldName);
- mergedDeclaration.addField(fieldName, definition.getDeclaration());
- fieldValues.add(definition);
- }
-
- /*
- * Add fields from the event context, overwrite the stream ones if
- * needed.
- */
- for (String fieldName : fEventContext.getFieldNames()) {
- Definition definition = fEventContext.getDefinition(fieldName);
- mergedDeclaration.addField(fieldName, definition.getDeclaration());
- if (fieldNames.contains(fieldName)) {
- fieldValues.set((fieldNames.indexOf(fieldName)), definition);
- } else {
- fieldValues.add(definition);
- }
- }
- return new StructDefinition(mergedDeclaration, this, "context", //$NON-NLS-1$
- fieldValues.toArray(new Definition[fieldValues.size()]));
- }
-
- /**
- * Gets the stream input reader that this event was made by
- *
- * @return the parent
- */
- public CTFStreamInputReader getStreamInputReader() {
- return fStreamInputReader;
- }
-
- /**
- * Gets the context of packet the event is in.
- *
- * @return the packet context
- * @since 1.0
- */
- public ICompositeDefinition getPacketContext() {
- return fPacketContext;
- }
-
- /**
- * gets the CPU the event was generated by. Slightly LTTng specific
- *
- * @return The CPU the event was generated by
- */
- public int getCPU() {
- return fStreamInputReader.getCPU();
- }
-
- /**
- * @return the timestamp
- */
- public long getTimestamp() {
- return fTimestamp;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * @since 1.0
- */
- @Override
- public IDefinition lookupDefinition(String lookupPath) {
- if (lookupPath.equals("context")) { //$NON-NLS-1$
- return fEventContext;
- } else if (lookupPath.equals("fields")) { //$NON-NLS-1$
- return fFields;
- } else {
- return null;
- }
- }
-
- @Override
- public String toString() {
- Iterable<String> list;
- StringBuilder retString = new StringBuilder();
- final String cr = System.getProperty("line.separator");//$NON-NLS-1$
-
- retString.append("Event type: ").append(fDeclaration.getName()).append(cr); //$NON-NLS-1$
- retString.append("Timestamp: ").append(Long.toString(fTimestamp)).append(cr); //$NON-NLS-1$
-
- if (fEventContext != null) {
- list = fEventContext.getFieldNames();
-
- for (String field : list) {
- retString.append(field).append(" : ").append(fEventContext.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
- }
- }
-
- if (fFields != null) {
- list = fFields.getFieldNames();
-
- for (String field : list) {
- retString.append(field).append(" : ").append(fFields.getDefinition(field).toString()).append(cr); //$NON-NLS-1$
- }
- }
-
- return retString.toString();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-
-/**
- * Representation of one type of event. A bit like "int" or "long" but for trace
- * events.
- *
- * @author Matthew Khouzam
- */
-public interface IEventDeclaration {
-
- /**
- * Id of events when not set
- *
- * @since 1.0
- */
- public static final long UNSET_EVENT_ID = -2L;
-
- /**
- * Creates an instance of EventDefinition corresponding to this declaration.
- *
- * @param streamInputReader
- * The StreamInputReader for which this definition is created.
- * @param input
- * the bitbuffer input source
- * @param timestamp
- * The timestamp when the event was taken
- * @return A new EventDefinition.
- * @throws CTFException
- * As a bitbuffer is used to read, it could have wrapped
- * IOExceptions.
- */
- EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException;
-
- /**
- * Gets the name of an event declaration
- *
- * @return the name
- */
- String getName();
-
- /**
- * Gets the fields of an event declaration
- *
- * @return fields the fields in {@link StructDeclaration} format
- */
- StructDeclaration getFields();
-
- /**
- * Gets the context of an event declaration
- *
- * @return context the fields in {@link StructDeclaration} format
- */
- StructDeclaration getContext();
-
- /**
- * Gets the id of an event declaration
- *
- * @return The EventDeclaration ID
- */
- Long getId();
-
- /**
- * Gets the {@link CTFStream} of an event declaration
- *
- * @return the stream
- */
- CTFStream getStream();
-
- /**
- * What is the log level of this event?
- *
- * @return the log level.
- */
- long getLogLevel();
-
- /**
- * Get the {@link Set} of names of the custom CTF attributes.
- *
- * @return The set of custom attributes
- */
- Set<String> getCustomAttributes();
-
- /**
- * Get the value of a given CTF attribute.
- *
- * @param key
- * The CTF attribute name
- * @return the CTF attribute
- */
- String getCustomAttribute(String key);
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event;
-
-import java.util.Collections;
-import java.util.Set;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-
-/**
- * A lost event definition
- *
- * @author Matthew Khouzam
- * @since 1.0
- */
-public class LostEventDeclaration implements IEventDeclaration {
-
- /**
- * Id of lost events
- *
- * @since 1.0
- */
- public static final long LOST_EVENT_ID = -1L;
-
- /**
- * Gets a "lost" event. This is a synthetic event that is there to show that
- * there should be something there.
- */
- public static final LostEventDeclaration INSTANCE = new LostEventDeclaration();
-
- private final StructDeclaration fFields = new StructDeclaration(0);
-
- private LostEventDeclaration() {
- getFields().addField(CTFStrings.LOST_EVENTS_FIELD, IntegerDeclaration.UINT_32B_DECL);
- getFields().addField(CTFStrings.LOST_EVENTS_DURATION, IntegerDeclaration.UINT_64B_DECL);
- }
-
- @Override
- public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, BitBuffer input, long timestamp) throws CTFException {
- return null;
- }
-
- @Override
- public String getName() {
- return CTFStrings.LOST_EVENT_NAME;
- }
-
- @Override
- public StructDeclaration getFields() {
- return fFields;
- }
-
- @Override
- public StructDeclaration getContext() {
- return null;
- }
-
- @Override
- public Long getId() {
- return LOST_EVENT_ID;
- }
-
- @Override
- public CTFStream getStream() {
- return null;
- }
-
- @Override
- public long getLogLevel() {
- return 0;
- }
-
- @Override
- public Set<String> getCustomAttributes() {
- return Collections.<String> emptySet();
- }
-
- @Override
- public String getCustomAttribute(String key) {
- return null;
- }
-
-}
+++ /dev/null
-/*******************************************************************************.
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial Design and implementation + overhaul
- * Francis Giraldeau - Initial API and implementation
- * Philippe Proulx - Some refinement and optimization
- * Etienne Bergeron <Etienne.Bergeron@gmail.com> - fix zero size read + cleanup
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.io;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-
-/**
- * <b><u>BitBuffer</u></b>
- * <p>
- * A bitwise buffer capable of accessing fields with bit offsets.
- */
-public final class BitBuffer {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /* default bit width */
- private static final int BIT_CHAR = Byte.SIZE; // yum
- private static final int BYTE_MASK = (1 << BIT_CHAR) - 1;
- private static final int BIT_SHORT = Short.SIZE;
- private static final int SHORT_MASK = (1 << BIT_SHORT) - 1;
- private static final int BIT_INT = Integer.SIZE;
- private static final long INT_MASK = (1L << BIT_INT) - 1;
- private static final int BIT_LONG = Long.SIZE;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final @NonNull ByteBuffer fBuffer;
- private final long fBitCapacity;
-
- /**
- * Bit-buffer's position, maximum value = Integer.MAX_VALUE * 8
- */
- private long fPosition;
- private ByteOrder fByteOrder;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
- /**
- * Default constructor, makes a big-endian buffer
- */
- public BitBuffer() {
- this(checkNotNull(ByteBuffer.allocateDirect(0)), ByteOrder.BIG_ENDIAN);
- }
-
- /**
- * Constructor, makes a big-endian buffer
- *
- * @param buf
- * the bytebuffer to read
- */
- public BitBuffer(@NonNull ByteBuffer buf) {
- this(buf, ByteOrder.BIG_ENDIAN);
- }
-
- /**
- * Constructor that is fully parameterizable
- *
- * @param buf
- * the buffer to read
- * @param order
- * the byte order (big-endian, little-endian, network?)
- */
- public BitBuffer(@NonNull ByteBuffer buf, ByteOrder order) {
- fBuffer = buf;
- setByteOrder(order);
- resetPosition();
- fBitCapacity = (long) fBuffer.capacity() * BIT_CHAR;
- }
-
- private void resetPosition() {
- fPosition = 0;
- }
-
- // ------------------------------------------------------------------------
- // 'Get' operations on buffer
- // ------------------------------------------------------------------------
-
- /**
- * Relative <i>get</i> method for reading 32-bit integer.
- *
- * Reads next four bytes from the current bit position according to current
- * byte order.
- *
- * @return The int value (signed) read from the buffer
- * @throws CTFException
- * An error occurred reading the long. This exception can be
- * raised if the buffer tries to read out of bounds
- */
- public int getInt() throws CTFException {
- return getInt(BIT_INT, true);
- }
-
- /**
- * Relative <i>get</i> method for reading 64-bit integer.
- *
- * Reads next eight bytes from the current bit position according to current
- * byte order.
- *
- * @return The long value (signed) read from the buffer
- * @throws CTFException
- * An error occurred reading the long. This exception can be
- * raised if the buffer tries to read out of bounds
- */
- public long getLong() throws CTFException {
- return get(BIT_LONG, true);
- }
-
- /**
- * Relative <i>get</i> method for reading long of <i>length</i> bits.
- *
- * Reads <i>length</i> bits starting at the current position. The result is
- * signed extended if <i>signed</i> is true. The current position is
- * increased of <i>length</i> bits.
- *
- * @param length
- * The length in bits of this integer
- * @param signed
- * The sign extended flag
- * @return The long value read from the buffer
- * @throws CTFException
- * An error occurred reading the data. If more than 64 bits at a
- * time are read, or the buffer is read beyond its end, this
- * exception will be raised.
- */
- public long get(int length, boolean signed) throws CTFException {
- if (length > BIT_LONG) {
- throw new CTFException("Cannot read a long longer than 64 bits. Rquested: " + length); //$NON-NLS-1$
- }
- if (length > BIT_INT) {
- final int highShift = length - BIT_INT;
- long a = getInt();
- long b = getInt(highShift, false);
- long retVal;
- /* Cast the signed-extended int into a unsigned int. */
- a &= INT_MASK;
- b &= (1L << highShift) - 1L;
-
- retVal = (fByteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a);
- /* sign extend */
- if (signed) {
- int signExtendBits = BIT_LONG - length;
- retVal = (retVal << signExtendBits) >> signExtendBits;
- }
- return retVal;
- }
- long retVal = getInt(length, signed);
- return (signed ? retVal : (retVal & INT_MASK));
- }
-
- /**
- * Relative bulk <i>get</i> method.
- *
- * <p>
- * This method transfers <strong>bytes</strong> from this buffer into the
- * given destination array. This method currently only supports reads
- * aligned to 8 bytes. It is up to the developer to shift the bits in
- * post-processing to do unaligned reads.
- *
- * @param dst
- * the bytes to write to
- * @throws BufferUnderflowException
- * - If there are fewer than length bytes remaining in this
- * buffer
- */
- public void get(@NonNull byte[] dst) {
- fBuffer.position((int) (fPosition / BIT_CHAR));
- fBuffer.get(dst);
- fPosition += dst.length * BIT_CHAR;
- }
-
- /**
- * Relative <i>get</i> method for reading integer of <i>length</i> bits.
- *
- * Reads <i>length</i> bits starting at the current position. The result is
- * signed extended if <i>signed</i> is true. The current position is
- * increased of <i>length</i> bits.
- *
- * @param length
- * The length in bits of this integer
- * @param signed
- * The sign extended flag
- * @return The int value read from the buffer
- * @throws CTFException
- * An error occurred reading the data. When the buffer is read
- * beyond its end, this exception will be raised.
- */
- private int getInt(int length, boolean signed) throws CTFException {
-
- /* Nothing to read. */
- if (length == 0) {
- return 0;
- }
-
- /* Validate that the buffer has enough bits. */
- if (!canRead(length)) {
- throw new CTFException("Cannot read the integer, " + //$NON-NLS-1$
- "the buffer does not have enough remaining space. " + //$NON-NLS-1$
- "Requested:" + length); //$NON-NLS-1$
- }
-
- /* Get the value from the byte buffer. */
- int val = 0;
- boolean gotIt = false;
-
- /*
- * Try a fast read when the position is byte-aligned by using
- * java.nio.ByteBuffer's native methods
- */
- /*
- * A faster alignment detection as the compiler cannot guaranty that pos
- * is always positive.
- */
- if ((fPosition & (BitBuffer.BIT_CHAR - 1)) == 0) {
- switch (length) {
- case BitBuffer.BIT_CHAR:
- // Byte
- val = fBuffer.get((int) (fPosition / BIT_CHAR));
- if (!signed) {
- val = val & BYTE_MASK;
- }
- gotIt = true;
- break;
-
- case BitBuffer.BIT_SHORT:
- // Word
- val = fBuffer.getShort((int) (fPosition / BIT_CHAR));
- if (!signed) {
- val = val & SHORT_MASK;
- }
- gotIt = true;
- break;
-
- case BitBuffer.BIT_INT:
- // Double word
- val = fBuffer.getInt((int) (fPosition / BIT_CHAR));
- gotIt = true;
- break;
-
- default:
- break;
- }
- }
-
- /* When not byte-aligned, fall-back to a general decoder. */
- if (!gotIt) {
- // Nothing read yet: use longer methods
- if (fByteOrder == ByteOrder.LITTLE_ENDIAN) {
- val = getIntLE(fPosition, length, signed);
- } else {
- val = getIntBE(fPosition, length, signed);
- }
- }
- fPosition += length;
-
- return val;
- }
-
- private int getIntBE(long index, int length, boolean signed) {
- if ((length <= 0) || (length > BIT_INT)) {
- throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
- }
- long end = index + length;
- int startByte = (int) (index / BIT_CHAR);
- int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
- int currByte, lshift, cshift, mask, cmask, cache;
- int value = 0;
-
- currByte = startByte;
- cache = fBuffer.get(currByte) & BYTE_MASK;
- boolean isNeg = (cache & (1 << (BIT_CHAR - (index % BIT_CHAR) - 1))) != 0;
- if (signed && isNeg) {
- value = ~0;
- }
- if (startByte == (endByte - 1)) {
- cmask = cache >>> ((BIT_CHAR - (end % BIT_CHAR)) % BIT_CHAR);
- if (((length) % BIT_CHAR) > 0) {
- mask = ~((~0) << length);
- cmask &= mask;
- }
- value <<= length;
- value |= cmask;
- return value;
- }
- cshift = (int) (index % BIT_CHAR);
- if (cshift > 0) {
- mask = ~((~0) << (BIT_CHAR - cshift));
- cmask = cache & mask;
- lshift = BIT_CHAR - cshift;
- value <<= lshift;
- value |= cmask;
- currByte++;
- }
- for (; currByte < (endByte - 1); currByte++) {
- value <<= BIT_CHAR;
- value |= fBuffer.get(currByte) & BYTE_MASK;
- }
- lshift = (int) (end % BIT_CHAR);
- if (lshift > 0) {
- mask = ~((~0) << lshift);
- cmask = fBuffer.get(currByte) & BYTE_MASK;
- cmask >>>= BIT_CHAR - lshift;
- cmask &= mask;
- value <<= lshift;
- value |= cmask;
- } else {
- value <<= BIT_CHAR;
- value |= fBuffer.get(currByte) & BYTE_MASK;
- }
- return value;
- }
-
- private int getIntLE(long index, int length, boolean signed) {
- if ((length <= 0) || (length > BIT_INT)) {
- throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
- }
- long end = index + length;
- int startByte = (int) (index / BIT_CHAR);
- int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
- int currByte, lshift, cshift, mask, cmask, cache, mod;
- int value = 0;
-
- currByte = endByte - 1;
- cache = fBuffer.get(currByte) & BYTE_MASK;
- mod = (int) (end % BIT_CHAR);
- lshift = (mod > 0) ? mod : BIT_CHAR;
- boolean isNeg = (cache & (1 << (lshift - 1))) != 0;
- if (signed && isNeg) {
- value = ~0;
- }
- if (startByte == (endByte - 1)) {
- cmask = cache >>> (index % BIT_CHAR);
- if (((length) % BIT_CHAR) > 0) {
- mask = ~((~0) << length);
- cmask &= mask;
- }
- value <<= length;
- value |= cmask;
- return value;
- }
- cshift = (int) (end % BIT_CHAR);
- if (cshift > 0) {
- mask = ~((~0) << cshift);
- cmask = cache & mask;
- value <<= cshift;
- value |= cmask;
- currByte--;
- }
- for (; currByte >= (startByte + 1); currByte--) {
- value <<= BIT_CHAR;
- value |= fBuffer.get(currByte) & BYTE_MASK;
- }
- lshift = (int) (index % BIT_CHAR);
- if (lshift > 0) {
- mask = ~((~0) << (BIT_CHAR - lshift));
- cmask = fBuffer.get(currByte) & BYTE_MASK;
- cmask >>>= lshift;
- cmask &= mask;
- value <<= (BIT_CHAR - lshift);
- value |= cmask;
- } else {
- value <<= BIT_CHAR;
- value |= fBuffer.get(currByte) & BYTE_MASK;
- }
- return value;
- }
-
- // ------------------------------------------------------------------------
- // 'Put' operations on buffer
- // ------------------------------------------------------------------------
-
- /**
- * Relative <i>put</i> method to write signed 32-bit integer.
- *
- * Write four bytes starting from current bit position in the buffer
- * according to the current byte order. The current position is increased of
- * <i>length</i> bits.
- *
- * @param value
- * The int value to write
- * @throws CTFException
- * An error occurred writing the data. If the buffer is written
- * beyond its end, this exception will be raised.
- */
- public void putInt(int value) throws CTFException {
- putInt(BIT_INT, value);
- }
-
- /**
- * Relative <i>put</i> method to write <i>length</i> bits integer.
- *
- * Writes <i>length</i> lower-order bits from the provided <i>value</i>,
- * starting from current bit position in the buffer. Sequential bytes are
- * written according to the current byte order. The sign bit is carried to
- * the MSB if signed is true. The sign bit is included in <i>length</i>. The
- * current position is increased of <i>length</i>.
- *
- * @param length
- * The number of bits to write
- * @param value
- * The value to write
- * @throws CTFException
- * An error occurred writing the data. If the buffer is written
- * beyond its end, this exception will be raised.
- */
- public void putInt(int length, int value) throws CTFException {
- final long curPos = fPosition;
-
- if (!canRead(length)) {
- throw new CTFException("Cannot write to bitbuffer, " //$NON-NLS-1$
- + "insufficient space. Requested: " + length); //$NON-NLS-1$
- }
- if (length == 0) {
- return;
- }
- if (fByteOrder == ByteOrder.LITTLE_ENDIAN) {
- putIntLE(curPos, length, value);
- } else {
- putIntBE(curPos, length, value);
- }
- fPosition += length;
- }
-
- private void putIntBE(long index, int length, int value) {
- if ((length <= 0) || (length > BIT_INT)) {
- throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
- }
- long end = index + length;
- int startByte = (int) (index / BIT_CHAR);
- int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
- int currByte, lshift, cshift, mask, cmask;
- int correctedValue = value;
-
- /*
- * mask v high bits. Works for unsigned and two complement signed
- * numbers which value do not overflow on length bits.
- */
-
- if (length < BIT_INT) {
- correctedValue &= ~(~0 << length);
- }
-
- /* sub byte */
- if (startByte == (endByte - 1)) {
- lshift = (int) ((BIT_CHAR - (end % BIT_CHAR)) % BIT_CHAR);
- mask = ~((~0) << lshift);
- if ((index % BIT_CHAR) > 0) {
- mask |= (~(0)) << (BIT_CHAR - (index % BIT_CHAR));
- }
- cmask = correctedValue << lshift;
- /*
- * low bits are cleared because of left-shift and high bits are
- * already cleared
- */
- cmask &= ~mask;
- int b = fBuffer.get(startByte) & BYTE_MASK;
- fBuffer.put(startByte, (byte) ((b & mask) | cmask));
- return;
- }
-
- /* head byte contains MSB */
- currByte = endByte - 1;
- cshift = (int) (end % BIT_CHAR);
- if (cshift > 0) {
- lshift = BIT_CHAR - cshift;
- mask = ~((~0) << lshift);
- cmask = correctedValue << lshift;
- cmask &= ~mask;
- int b = fBuffer.get(currByte) & BYTE_MASK;
- fBuffer.put(currByte, (byte) ((b & mask) | cmask));
- correctedValue >>>= cshift;
- currByte--;
- }
-
- /* middle byte(s) */
- for (; currByte >= (startByte + 1); currByte--) {
- fBuffer.put(currByte, (byte) correctedValue);
- correctedValue >>>= BIT_CHAR;
- }
- /* end byte contains LSB */
- if ((index % BIT_CHAR) > 0) {
- mask = (~0) << (BIT_CHAR - (index % BIT_CHAR));
- cmask = correctedValue & ~mask;
- int b = fBuffer.get(currByte) & BYTE_MASK;
- fBuffer.put(currByte, (byte) ((b & mask) | cmask));
- } else {
- fBuffer.put(currByte, (byte) correctedValue);
- }
- }
-
- private void putIntLE(long index, int length, int value) {
- if ((length <= 0) || (length > BIT_INT)) {
- throw new IllegalArgumentException("Length must be between 1-32 bits"); //$NON-NLS-1$
- }
- long end = index + length;
- int startByte = (int) (index / BIT_CHAR);
- int endByte = (int) ((end + (BIT_CHAR - 1)) / BIT_CHAR);
- int currByte, lshift, cshift, mask, cmask;
- int correctedValue = value;
-
- /*
- * mask v high bits. Works for unsigned and two complement signed
- * numbers which value do not overflow on length bits.
- */
-
- if (length < BIT_INT) {
- correctedValue &= ~(~0 << length);
- }
-
- /* sub byte */
- if (startByte == (endByte - 1)) {
- lshift = (int) (index % BIT_CHAR);
- mask = ~((~0) << lshift);
- if ((end % BIT_CHAR) > 0) {
- mask |= (~(0)) << (end % BIT_CHAR);
- }
- cmask = correctedValue << lshift;
- /*
- * low bits are cleared because of left-shift and high bits are
- * already cleared
- */
- cmask &= ~mask;
- int b = fBuffer.get(startByte) & BYTE_MASK;
- fBuffer.put(startByte, (byte) ((b & mask) | cmask));
- return;
- }
-
- /* head byte */
- currByte = startByte;
- cshift = (int) (index % BIT_CHAR);
- if (cshift > 0) {
- mask = ~((~0) << cshift);
- cmask = correctedValue << cshift;
- cmask &= ~mask;
- int b = fBuffer.get(currByte) & BYTE_MASK;
- fBuffer.put(currByte, (byte) ((b & mask) | cmask));
- correctedValue >>>= BIT_CHAR - cshift;
- currByte++;
- }
-
- /* middle byte(s) */
- for (; currByte < (endByte - 1); currByte++) {
- fBuffer.put(currByte, (byte) correctedValue);
- correctedValue >>>= BIT_CHAR;
- }
- /* end byte */
- if ((end % BIT_CHAR) > 0) {
- mask = (~0) << (end % BIT_CHAR);
- cmask = correctedValue & ~mask;
- int b = fBuffer.get(currByte) & BYTE_MASK;
- fBuffer.put(currByte, (byte) ((b & mask) | cmask));
- } else {
- fBuffer.put(currByte, (byte) correctedValue);
- }
- }
-
- // ------------------------------------------------------------------------
- // Buffer attributes handling
- // ------------------------------------------------------------------------
-
- /**
- * Can this buffer be read for thus amount of bits?
- *
- * @param length
- * the length in bits to read
- * @return does the buffer have enough room to read the next "length"
- */
- public boolean canRead(int length) {
- return ((fPosition + length) <= fBitCapacity);
- }
-
- /**
- * Sets the order of the buffer.
- *
- * @param order
- * The order of the buffer.
- */
- public void setByteOrder(ByteOrder order) {
- fByteOrder = order;
- fBuffer.order(order);
- }
-
- /**
- * Sets the order of the buffer.
- *
- * @return The order of the buffer.
- */
- public ByteOrder getByteOrder() {
- return fByteOrder;
- }
-
- /**
- * Sets the position in the buffer.
- *
- * @param newPosition
- * The new position of the buffer.
- * @throws CTFException
- * Thrown on out of bounds exceptions
- */
- public void position(long newPosition) throws CTFException {
-
- if (newPosition > fBitCapacity) {
- throw new CTFException("Out of bounds exception on a position move, attempting to access position: " + newPosition); //$NON-NLS-1$
- }
- fPosition = newPosition;
- }
-
- /**
- *
- * Sets the position in the buffer.
- *
- * @return order The position of the buffer.
- */
- public long position() {
- return fPosition;
- }
-
- /**
- * Gets the byte buffer
- *
- * @return The byte buffer
- */
- public ByteBuffer getByteBuffer() {
- return fBuffer;
- }
-
- /**
- * Resets the bitbuffer.
- */
- public void clear() {
- resetPosition();
- fBuffer.clear();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * A lttng specific speedup node (the packet header with ID and V) of a lexical
- * scope
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class EventHeaderScope extends LexicalScope {
-
-
- /**
- * The scope constructor
- *
- * @param parent
- * The parent node, can be null, but shouldn't
- * @param name
- * the name of the field
- */
- EventHeaderScope(ILexicalScope parent, String name) {
- super(parent, name);
- }
-
- @Override
- @Nullable
- public ILexicalScope getChild(String name) {
- if (name.equals(EVENT_HEADER_ID.getName())) {
- return EVENT_HEADER_ID;
- }
- if (name.equals(EVENT_HEADER_V.getName())) {
- return EVENT_HEADER_V;
- }
- return super.getChild(name);
- }
-
- @Override
- public String getPath() {
- return "event.header"; //$NON-NLS-1$
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * A lttng specific speedup node (v variant for event headers) of a lexical
- * scope they normally contain a timestamp
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class EventHeaderVScope extends LexicalScope {
-
- /**
- * The scope constructor
- *
- * @param parent
- * The parent node, can be null, but shouldn't
- * @param name
- * the name of the field
- */
- EventHeaderVScope(ILexicalScope parent, String name) {
- super(parent, name);
- }
-
- @Override
- @Nullable
- public ILexicalScope getChild(String name) {
- if (name.equals(EVENT_HEADER_V_TIMESTAMP.getName())) {
- return EVENT_HEADER_V_TIMESTAMP;
- }
- if (name.equals(EVENT_HEADER_V_ID.getName())) {
- return EVENT_HEADER_V_ID;
- }
- return super.getChild(name);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * A lttng specific speedup node field scope of a lexical scope
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class FieldsScope extends LexicalScope {
-
- /**
- * The scope constructor
- *
- * @param parent
- * The parent node, can be null, but shouldn't
- * @param name
- * the name of the field
- */
- FieldsScope(ILexicalScope parent, String name) {
- super(parent, name);
- }
-
- @Override
- @Nullable
- public ILexicalScope getChild(String name) {
- if (name.equals(FIELDS_RET.getName())) {
- return FIELDS_RET;
- }
- if (name.equals(FIELDS_TID.getName())) {
- return FIELDS_TID;
- }
- return super.getChild(name);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-
-/**
- * The scope of a CTF definition. Used for compound types.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public interface IDefinitionScope {
-
- /**
- * Gets the path in a C style for the scope.
- *
- * @return the path
- * @since 1.0
- */
- ILexicalScope getScopePath();
-
- /**
- * Looks up in this definition scope.
- *
- * @param lookupPath
- * The path to look up
- * @return The Definition that was read
- * @since 1.0
- */
- IDefinition lookupDefinition(String lookupPath);
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * @since 1.0
- */
-@NonNullByDefault
-public interface ILexicalScope {
- /**
- * Empty string
- */
- ILexicalScope ROOT = new RootScope();
-
- /**
- * Trace string
- */
- ILexicalScope TRACE = new LexicalScope(ROOT, "trace"); //$NON-NLS-1$
- /**
- * Env string
- */
- ILexicalScope ENV = new LexicalScope(ROOT, "env"); //$NON-NLS-1$
- /**
- * Stream string
- */
- LexicalScope STREAM = new LexicalScope(ROOT, "stream"); //$NON-NLS-1$
- /**
- * Event string
- */
- LexicalScope EVENT = new LexicalScope(ROOT, "event"); //$NON-NLS-1$
- /**
- * Variant string
- */
- ILexicalScope VARIANT = new LexicalScope(ROOT, "variant"); //$NON-NLS-1$
- /**
- * packet string
- */
- LexicalScope PACKET = new LexicalScope(ROOT, "packet"); //$NON-NLS-1$
- /**
- * Packet header string
- */
- LexicalScope PACKET_HEADER = new PacketHeaderScope();
-
- /**
- * Packet header v id string
- */
- ILexicalScope EVENT_HEADER_V_ID = new LexicalScope(PACKET_HEADER, "id"); //$NON-NLS-1$
- /**
- * Packet header v timestamp string
- */
- ILexicalScope EVENT_HEADER_V_TIMESTAMP = new LexicalScope(PACKET_HEADER, "timestamp"); //$NON-NLS-1$
-
- /**
- * Stream packet scope
- */
- LexicalScope STREAM_PACKET = new LexicalScope(STREAM, "packet"); //$NON-NLS-1$
- /**
- * Stream Packet header string
- */
- ILexicalScope STREAM_PACKET_CONTEXT = new LexicalScope(STREAM_PACKET, "context"); //$NON-NLS-1$
- /**
- * Trace packet scope
- */
- LexicalScope TRACE_PACKET = new LexicalScope(TRACE, "packet"); //$NON-NLS-1$
- /**
- * Stream event scope
- */
- LexicalScope STREAM_EVENT = new LexicalScope(STREAM, "event"); //$NON-NLS-1$
- /**
- * Trace packet header string
- */
- ILexicalScope TRACE_PACKET_HEADER = new LexicalScope(TRACE_PACKET, "header"); //$NON-NLS-1$
- /**
- * Stream event context
- */
- ILexicalScope STREAM_EVENT_CONTEXT = new LexicalScope(STREAM_EVENT, "context"); //$NON-NLS-1$
- /**
- * Stream event header
- */
- ILexicalScope STREAM_EVENT_HEADER = new LexicalScope(STREAM_EVENT, "header"); //$NON-NLS-1$
- /**
- * Context of an event
- */
- LexicalScope CONTEXT = new LexicalScope(ROOT, "context"); //$NON-NLS-1$
- /**
- * Event Header scope
- */
- ILexicalScope EVENT_HEADER = new EventHeaderScope(EVENT, "header"); //$NON-NLS-1$
-
- /**
- * Event header id string
- */
- ILexicalScope EVENT_HEADER_ID = new LexicalScope(EVENT_HEADER, "id"); //$NON-NLS-1$
-
- /**
- * Event header v as in variant string
- */
- ILexicalScope EVENT_HEADER_V = new EventHeaderVScope(EVENT_HEADER, "v"); //$NON-NLS-1$
-
- /**
- * Fields in an event
- */
- ILexicalScope FIELDS = new FieldsScope(ROOT, "fields"); //$NON-NLS-1$
-
- /**
- * ret field
- */
- ILexicalScope FIELDS_RET = new LexicalScope(FIELDS, "_ret"); //$NON-NLS-1$
-
- /**
- * tid field
- */
- ILexicalScope FIELDS_TID = new LexicalScope(FIELDS, "_tid"); //$NON-NLS-1$
-
- /**
- * Get the name
- *
- * @return the name
- */
- String getName();
-
- /**
- * Gets a child of a given name
- *
- * @param name
- * the child
- * @return the scope, can be null
- */
- @Nullable
- ILexicalScope getChild(String name);
-
- // -------------------------------------------------------------------------
- // helpers
- // -------------------------------------------------------------------------
-
- /**
- * Adds a child lexical scope
- *
- * @param name
- * the name of the child
- * @param child
- * the child
- */
- void addChild(String name, ILexicalScope child);
-
- /**
- * Get the path of the scope
- *
- * @return the path of the scope
- */
- String getPath();
-
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * A node of a lexical scope
- *
- * @author Matthew Khouzam
- */
-public class LexicalScope implements ILexicalScope {
- private int hash = 0;
- private final @NonNull String fName;
- private final @NonNull String fPath;
- private final Map<String, ILexicalScope> fChildren = new ConcurrentHashMap<>();
-
- /**
- * Hidden constructor for the root node only
- *
- * @since 1.0
- */
- protected LexicalScope() {
- fPath = ""; //$NON-NLS-1$
- fName = ""; //$NON-NLS-1$
- }
-
- /**
- * The scope constructor
- *
- * @param parent
- * The parent node, can be null, but shouldn't
- * @param name
- * the name of the field
- * @since 1.0
- */
- public LexicalScope(ILexicalScope parent, @NonNull String name) {
- fName = name;
- fPath = parent.getPath().isEmpty() ? fName : parent.getPath() + '.' + fName;
- parent.addChild(name, this);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void addChild(String name, ILexicalScope child) {
- fChildren.put(name, child);
- }
-
- @Override
- public @NonNull String getName() {
- return fName;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public @Nullable ILexicalScope getChild(String name) {
- return fChildren.get(name);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public @NonNull String getPath() {
- return fPath;
- }
-
- // for debugging purposes
- @Override
- public String toString() {
- return getPath();
- }
-
- @Override
- public synchronized int hashCode() {
- if (hash == 0) {
- final int prime = 31;
- hash = prime * (prime + fName.hashCode()) + fPath.hashCode();
- }
- return hash;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- LexicalScope other = (LexicalScope) obj;
- if (!fName.equals(other.fName)) {
- return false;
- }
- return fPath.equals(other.fPath);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-
-/**
- * A lttng specific speedup node (the packet header with magic, uuid and stream
- * id ) of a lexical scope the sole reason to have this is to accelerate tostring()
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public class PacketHeaderScope extends LexicalScope {
-
- /**
- * Constructor
- */
- public PacketHeaderScope() {
- super(PACKET, "header"); //$NON-NLS-1$
- }
-
- @Override
- public String getPath() {
- return "packet.header"; //$NON-NLS-1$
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.scope;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * A lttng specific speedup node a root with accelerated returns for some scopes
- * of a lexical scope
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class RootScope extends LexicalScope {
-
- /**
- * The scope constructor
- */
- public RootScope() {
- super();
- }
-
- @Override
- @Nullable
- public ILexicalScope getChild(String name) {
- /*
- * This happens ~40 % of the time
- */
- if (name.equals(EVENT_HEADER.getPath())) {
- return EVENT_HEADER;
- }
- /*
- * This happens ~30 % of the time
- */
- if (name.equals(FIELDS.getPath())) {
- return FIELDS;
- }
- /*
- * This happens ~30 % of the time
- */
- if (name.equals(CONTEXT.getPath())) {
- return CONTEXT;
- }
- /*
- * This happens ~1 % of the time
- */
- if (name.equals(PACKET_HEADER.getPath())) {
- return PACKET_HEADER;
- }
- return super.getChild(name);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * Array definition, used for compound definitions and fixed length strings
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public abstract class AbstractArrayDefinition extends Definition {
-
- /**
- * Constructor
- *
- * @param declaration
- * the event declaration
- *
- * @param definitionScope
- * the definition is in a scope, (normally a struct) what is it?
- * @param fieldName
- * the name of the definition. (it is a field in the parent
- * scope)
- */
- public AbstractArrayDefinition(IDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName) {
- super(declaration, definitionScope, fieldName);
- }
-
- /**
- * Get the defintions, an array is a collection of definitions
- *
- * @return the definitions
- */
- public abstract List<Definition> getDefinitions();
-
- /**
- * Get the the number of elements in the array
- *
- * @return how many elements in the array
- * @since 1.0
- */
- public abstract int getLength();
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-/**
- * Parent of sequences and arrays
- *
- * @author Matthew Khouzam
- */
-public abstract class CompoundDeclaration extends Declaration {
-
- private static final int BIT_MASK = 0x03;
- private static final int BITS_PER_BYTE = 8;
-
- /**
- * Get the element type
- *
- * @return the type of element in the array
- */
- public abstract IDeclaration getElementType();
-
- @Override
- public long getAlignment() {
- return getElementType().getAlignment();
- }
-
- /**
- * Sometimes, strings are encoded as an array of 1-byte integers (each one
- * being an UTF-8 byte).
- *
- * @return true if this array is in fact an UTF-8 string. false if it's a
- * "normal" array of generic Definition's.
- */
- public boolean isString() {
- IDeclaration elementType = getElementType();
- if (elementType instanceof IntegerDeclaration) {
- IntegerDeclaration elemInt = (IntegerDeclaration) elementType;
- return elemInt.isCharacter();
- }
- return false;
- }
-
- /**
- * If an array contains 8 bit aligned 8 bit ints, it can be bulk read.
- *
- * @return true if this array 1 byte aligned. false if it's a "normal" array
- * of generic Definition's.
- * @since 1.0
- */
- public boolean isAlignedBytes() {
- IDeclaration elementType = getElementType();
- if (elementType instanceof IntegerDeclaration) {
- IntegerDeclaration elemInt = (IntegerDeclaration) elementType;
- return (elemInt.getLength() == BITS_PER_BYTE) && ((getAlignment() & BIT_MASK) == 0);
- }
- return false;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-
-/**
- * Declaration base, it helps for basic functionality that is often called, so
- * performance is often a high priority in this class
- *
- * @author Matthew Khouzam
- */
-public abstract class Declaration implements IDeclaration {
-
- /**
- * @since 1.0
- */
- @Override
- public ILexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName) {
- if (definitionScope != null) {
- final ILexicalScope parentPath = definitionScope.getScopePath();
- if (parentPath != null) {
- ILexicalScope myScope = parentPath.getChild(fieldName);
- if (myScope == null) {
- myScope = new LexicalScope(parentPath, fieldName);
- }
- return myScope;
- }
- }
- ILexicalScope child = ILexicalScope.ROOT.getChild(fieldName);
- if (child != null) {
- return child;
- }
- return new LexicalScope(ILexicalScope.ROOT, fieldName);
- }
-
- /**
- * Offset the buffer position wrt the current alignment.
- *
- * @param input
- * The bitbuffer that is being read
- * @throws CTFException
- * Happens when there is an out of bounds exception
- */
- protected final void alignRead(BitBuffer input) throws CTFException {
- long mask = getAlignment() - 1;
- /*
- * The alignment is a power of 2
- */
- long pos = input.position();
- if ((pos & mask) == 0) {
- return;
- }
- pos = (pos + mask) & ~mask;
- input.position(pos);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-/**
- * A CTF definition
- *
- * A definition is like an object of a declaration class. It fills the
- * declaration with values. <br>
- * An example: <br>
- * int i = 0; <br>
- * <b>int</b> is the declaration.<br>
- * <b>i</b> is the definition.<br>
- * <b>0</b> is the value assigned to the definition, not the declaration.<br>
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public abstract class Definition implements IDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final String fFieldName;
-
- /** The complete path of this field */
- private final @NonNull ILexicalScope fPath;
-
- private final IDefinitionScope fDefinitionScope;
-
- @NonNull
- private final IDeclaration fDeclaration;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the event declaration
- * @param definitionScope
- * the definition is in a scope, (normally a struct) what is it?
- * @param fieldName
- * the name of the definition. (it is a field in the parent
- * scope)
- */
- public Definition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope, @NonNull String fieldName) {
- this(declaration, definitionScope, fieldName, declaration.getPath(definitionScope, fieldName));
- }
-
- /**
- * Constructor This one takes the scope and thus speeds up definition
- * creation
- *
- *
- * @param declaration
- * the event declaration
- *
- * @param definitionScope
- * the definition is in a scope, (normally a struct) what is it?
- *
- * @param fieldName
- * the name of the defintions. it is a field in the parent scope.
- *
- * @param scope
- * the scope
- * @since 1.0
- */
- public Definition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull ILexicalScope scope) {
- fDeclaration = declaration;
- fDefinitionScope = definitionScope;
- fFieldName = fieldName;
- fPath = scope;
- }
-
- // ------------------------------------------------------------------------
- // Getters
- // ------------------------------------------------------------------------
-
- /**
- * Get the field name in its container.
- *
- * @return The field name
- */
- protected String getFieldName() {
- return fFieldName;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public ILexicalScope getScopePath() {
- return fPath;
- }
-
- /**
- * Get the definition scope in which this definition is found.
- *
- * The complete path of a definition is thus the path of the definition
- * scope DOT the name of the definition (name of the field in its container)
- *
- * @return The definition scope
- */
- protected IDefinitionScope getDefinitionScope() {
- return fDefinitionScope;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public IDeclaration getDeclaration() {
- return fDeclaration;
- }
-
- @Override
- public String toString() {
- return fPath.getPath() + '[' + Integer.toHexString(hashCode()) + ']';
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011-2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-
-/**
- * CTF encoding types
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@NonNullByDefault
-public enum Encoding {
- /** UTF-8 encoding */
- UTF8,
- /** Ascii encoding */
- ASCII,
- /** No encoding, maybe not even text */
- NONE
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF enum declaration.
- *
- * The definition of a enum point basic data type. It will take the data from a
- * trace and store it (and make it fit) as an integer and a string.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class EnumDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final EnumTable fTable = new EnumTable();
- private final IntegerDeclaration fContainerType;
- private final Set<String> fLabels = new HashSet<>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * constructor
- *
- * @param containerType
- * the enum is an int, this is the type that the data is
- * contained in. If you have 1000 possible values, you need at
- * least a 10 bit enum. If you store 2 values in a 128 bit int,
- * you are wasting space.
- */
- public EnumDeclaration(IntegerDeclaration containerType) {
- fContainerType = containerType;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- *
- * @return The container type
- */
- public IntegerDeclaration getContainerType() {
- return fContainerType;
- }
-
- @Override
- public long getAlignment() {
- return this.getContainerType().getAlignment();
- }
-
- @Override
- public int getMaximumSize() {
- return fContainerType.getMaximumSize();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public EnumDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- IntegerDefinition value = getContainerType().createDefinition(definitionScope, fieldName, input);
- return new EnumDefinition(this, definitionScope, fieldName, value);
- }
-
- /**
- * Add a value. Do not overlap, this is <em><strong>not</strong></em> an
- * interval tree.
- *
- * @param low
- * lowest value that this int can be to have label as a return
- * string
- * @param high
- * highest value that this int can be to have label as a return
- * string
- * @param label
- * the name of the value.
- * @return was the value be added? true == success
- */
- public boolean add(long low, long high, @Nullable String label) {
- fLabels.add(label);
- return fTable.add(low, high, label);
- }
-
- /**
- * Check if the label for a value (enum a{day=0,night=1} would return "day"
- * for query(0)
- *
- * @param value
- * the value to lookup
- * @return the label of that value, can be null
- */
- public @Nullable String query(long value) {
- return fTable.query(value);
- }
-
- /**
- * Gets a set of labels of the enum
- *
- * @return A set of labels of the enum, can be empty but not null
- */
- public Set<String> getLabels() {
- return Collections.unmodifiableSet(fLabels);
- }
-
- /*
- * Maps integer range -> string. A simple list for now, but feel free to
- * optimize it. Babeltrace suggests an interval tree.
- */
- private class EnumTable {
-
- private final List<LabelAndRange> ranges = new LinkedList<>();
-
- public EnumTable() {
- }
-
- public synchronized boolean add(long low, long high, @Nullable String label) {
- LabelAndRange newRange = new LabelAndRange(low, high, label);
-
- for (LabelAndRange r : ranges) {
- if (r.intersects(newRange)) {
- return false;
- }
- }
-
- ranges.add(newRange);
-
- return true;
- }
-
- /**
- * Return the first label that matches a value
- *
- * @param value
- * the value to query
- * @return the label corresponding to that value
- */
- public synchronized @Nullable String query(long value) {
- for (LabelAndRange r : ranges) {
- if (r.intersects(value)) {
- return r.getLabel();
- }
- }
- return null;
- }
-
- @Override
- public synchronized int hashCode() {
- final int prime = 31;
- int result = 1;
- for (LabelAndRange range : ranges) {
- result = prime * result + range.hashCode();
- }
- return result;
- }
-
- @Override
- public synchronized boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EnumTable other = (EnumTable) obj;
- if (ranges.size() != other.ranges.size()) {
- return false;
- }
- for (int i = 0; i < ranges.size(); i++) {
- if (!ranges.get(i).equals(other.ranges.get(i))) {
- return false;
- }
- }
- return true;
- }
-
- }
-
- private static class LabelAndRange {
-
- private final long low, high;
- private final @Nullable String fLabel;
-
- /**
- * Get the label
- *
- * @return the label
- */
- public @Nullable String getLabel() {
- return fLabel;
- }
-
- public LabelAndRange(long low, long high, @Nullable String str) {
- this.low = low;
- this.high = high;
- this.fLabel = str;
- }
-
- public boolean intersects(long i) {
- return (i >= this.low) && (i <= this.high);
- }
-
- public boolean intersects(LabelAndRange other) {
- return this.intersects(other.low)
- || this.intersects(other.high);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- final String label = fLabel;
- result = prime * result + ((label == null) ? 0 : label.hashCode());
- result = prime * result + (int) (high ^ (high >>> 32));
- result = prime * result + (int) (low ^ (low >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- LabelAndRange other = (LabelAndRange) obj;
- final String label = fLabel;
- if (label == null) {
- if (other.fLabel != null) {
- return false;
- }
- } else if (!label.equals(other.fLabel)) {
- return false;
- }
- if (high != other.high) {
- return false;
- }
- if (low != other.low) {
- return false;
- }
- return true;
- }
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- StringBuilder sb = new StringBuilder();
- sb.append("[declaration] enum["); //$NON-NLS-1$
- for (String label : fLabels) {
- sb.append("label:").append(label).append(' '); //$NON-NLS-1$
- }
- sb.append("type:").append(fContainerType.toString()); //$NON-NLS-1$
- sb.append(']');
- String string = sb.toString();
- if (string == null) {
- throw new IllegalStateException();
- }
- return string;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = prime + fContainerType.hashCode();
- for (String label : fLabels) {
- result = prime * result + label.hashCode();
- }
- result = prime * result + fTable.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EnumDeclaration other = (EnumDeclaration) obj;
- if (!fContainerType.equals(other.fContainerType)) {
- return false;
- }
- if (fLabels.size() != other.fLabels.size()) {
- return false;
- }
- if (!fLabels.containsAll(other.fLabels)) {
- return false;
- }
- if (!fTable.equals(other.fTable)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EnumDeclaration other = (EnumDeclaration) obj;
- if (!fContainerType.isBinaryEquivalent(other.fContainerType)) {
- return false;
- }
- if (fLabels.size() != other.fLabels.size()) {
- return false;
- }
- if (!fLabels.containsAll(other.fLabels)) {
- return false;
- }
- if (!fTable.equals(other.fTable)) {
- return false;
- }
- return true;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF enum definition.
- *
- * The definition of a enum point basic data type. It will take the data from a
- * trace and store it (and make it fit) as an integer and a string.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class EnumDefinition extends SimpleDatatypeDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final long fIntegerValue;
-
- private final String fValue;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param intValue
- * the value of the enum
- */
- public EnumDefinition(@NonNull EnumDeclaration declaration,
- IDefinitionScope definitionScope, @NonNull String fieldName, IntegerDefinition intValue) {
- super(declaration, definitionScope, fieldName);
-
- fIntegerValue = intValue.getValue();
- fValue = declaration.query(fIntegerValue);
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the value of the enum in string format so
- * "Enum a{DAY="0", NIGHT="1"}; will return "DAY"
- *
- * @return the value of the enum.
- */
- public String getValue() {
- return fValue;
- }
-
- @Override
- public String getStringValue() {
- return getValue();
- }
-
- /**
- * Gets the value of the enum in string format so
- * "Enum a{DAY="0", NIGHT="1"}; will return 0
- *
- * @return the value of the enum.
- */
- @Override
- public Long getIntegerValue() {
- return fIntegerValue;
- }
-
- @Override
- public EnumDeclaration getDeclaration() {
- return (EnumDeclaration) super.getDeclaration();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public String toString() {
- return "{ value = " + getValue() + //$NON-NLS-1$
- ", container = " + fIntegerValue + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF float declaration.
- *
- * The declaration of a floating point basic data type.
- *
- * @version 1.0
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class FloatDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final int fMantissa;
- private final int fExponent;
- private final ByteOrder fByteOrder;
- private final long fAlignement;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param exponent
- * The exponent size in bits
- * @param mantissa
- * The mantissa size in bits (+1 for sign) (see CTF spec)
- * @param byteOrder
- * The byte order
- * @param alignment
- * The alignment. Should be ≥ 1
- */
- public FloatDeclaration(int exponent, int mantissa, @Nullable ByteOrder byteOrder,
- long alignment) {
- fMantissa = mantissa;
- fExponent = exponent;
- ByteOrder byteOrder2 = (byteOrder == null) ? ByteOrder.nativeOrder() : byteOrder;
- if (byteOrder2 == null) {
- throw new IllegalStateException("ByteOrder cannot be null"); //$NON-NLS-1$
- }
- fByteOrder = byteOrder2;
- fAlignement = Math.max(alignment, 1);
-
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * @return the mant
- */
- public int getMantissa() {
- return fMantissa;
- }
-
- /**
- * @return the exp
- */
- public int getExponent() {
- return fExponent;
- }
-
- /**
- * @return the byteOrder
- */
- public ByteOrder getByteOrder() {
- return fByteOrder;
- }
-
- @Override
- public long getAlignment() {
- return fAlignement;
- }
-
- @Override
- public int getMaximumSize() {
- return fMantissa + fExponent + 1;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public FloatDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
- String fieldName, BitBuffer input) throws CTFException {
- ByteOrder byteOrder = input.getByteOrder();
- input.setByteOrder(fByteOrder);
- double value = read(input);
- input.setByteOrder(byteOrder);
- return new FloatDefinition(this, definitionScope, fieldName, value);
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
- }
-
- private double read(BitBuffer input) throws CTFException {
- /* Offset the buffer position wrt the current alignment */
- alignRead(input);
- final int exp = getExponent();
- final int mant = getMantissa();
- double value = Double.NaN;
- if ((exp + mant) == 32) {
- value = readRawFloat32(input, mant, exp);
- } else if ((exp + mant) == 64) {
- value = readRawFloat64(input, mant, exp);
- }
- return value;
- }
-
- private static double readRawFloat32(BitBuffer input, final int manBits,
- final int expBits) throws CTFException {
- long temp = input.get(32, false);
- return createFloat(temp, manBits - 1, expBits);
- }
-
- private static double readRawFloat64(BitBuffer input, final int manBits,
- final int expBits) throws CTFException {
- long temp = input.get(64, false);
- return createFloat(temp, manBits - 1, expBits);
- }
-
- /**
- * Create a float from the raw value, Mathematicians beware.
- *
- * @param rawValue
- * The raw value( up to 64 bits)
- * @param manBits
- * number of bits in the mantissa
- * @param expBits
- * number of bits in the exponent
- */
- private static double createFloat(long rawValue, final int manBits,
- final int expBits) {
- long manShift = 1L << (manBits);
- long manMask = manShift - 1;
- long expMask = (1L << expBits) - 1;
-
- int exp = (int) ((rawValue >> (manBits)) & expMask) + 1;
- long man = (rawValue & manMask);
- final int offsetExponent = exp - (1 << (expBits - 1));
- double expPow = Math.pow(2.0, offsetExponent);
- double ret = man * 1.0f;
- ret /= manShift;
- ret += 1.0;
- ret *= expPow;
- return ret;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (fAlignement ^ (fAlignement >>> 32));
- result = prime * result + fByteOrder.toString().hashCode(); // don't evaluate object but string
- result = prime * result + fExponent;
- result = prime * result + fMantissa;
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- FloatDeclaration other = (FloatDeclaration) obj;
- if (fAlignement != other.fAlignement) {
- return false;
- }
- if (!fByteOrder.equals(other.fByteOrder)) {
- return false;
- }
- if (fExponent != other.fExponent) {
- return false;
- }
- if (fMantissa != other.fMantissa) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
- return equals(obj);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF float definition.
- *
- * The definition of a floating point basic data type. It will take the data
- * from a trace and store it (and make it fit) as a double.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class FloatDefinition extends Definition {
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final double fValue;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param value
- * field value
- */
- public FloatDefinition(@NonNull FloatDeclaration declaration,
- IDefinitionScope definitionScope, @NonNull String fieldName, double value) {
- super(declaration, definitionScope, fieldName);
- fValue = value;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * The value of a float stored, fit into a double. This should be extended
- * for exotic floats if this is necessary.
- *
- * @return the value of the float field fit into a double.
- */
- public double getValue() {
- return fValue;
- }
-
- @Override
- public FloatDeclaration getDeclaration() {
- return (FloatDeclaration) super.getDeclaration();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public String toString() {
- return String.valueOf(fValue);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.List;
-
-/**
- * Interface for data definitions containing heterogenous definitions
- * (subfields)
- *
- * @author Matthew Khouzam
- */
-public interface ICompositeDefinition extends IDefinition {
-
- /**
- * Gets the definition of the field
- *
- * @param fieldName
- * the fieldname
- * @return The definitions of all the fields
- */
- Definition getDefinition(String fieldName);
-
- /**
- * Gets an array of the field names
- *
- * @return the field names array
- */
- List<String> getFieldNames();
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-/**
- * A CTF data type declaration.
- *
- * An example: <br>
- * int i = 0; <br>
- * <b>int</b> is the declaration.<br>
- * <b>i</b> is the definition.<br>
- * <b>0</b> is the value assigned to the definition, not the declaration.<br>
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public interface IDeclaration {
-
- /**
- * Create a definition from this declaration
- *
- * @param definitionScope
- * the definition scope, the parent where the definition will be
- * placed
- * @param fieldName
- * the name of the definition
- * @param input
- * a bitbuffer to read from
- * @return a reference to the definition
- * @throws CTFException
- * error in reading
- */
- Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException;
-
- /**
- * Get the path of a definition
- *
- * @param definitionScope
- * the scope of the definition
- * @param fieldName
- * the name of the definition
- * @return the path of the definition
- * @since 1.0
- */
- @NonNull ILexicalScope getPath(IDefinitionScope definitionScope, @NonNull String fieldName);
-
- /**
- * The minimum alignment. if the field is 32 bits, the definition will pad
- * all the data up to (position%32==0)
- *
- * @return the alignment in bits
- */
- long getAlignment();
-
- /**
- * The MAXIMUM size of this declaration (in bits).
- *
- * @return the maximum size
- */
- int getMaximumSize();
-
- @Override
- int hashCode();
-
- @Override
- boolean equals(Object other);
-
- /**
- * Are the two declarations equivalent on a binary level. eg: an 8 bit
- * little endian and big endian int.
- *
- * @param other
- * the other {@link IDeclaration}
- * @return true if the binary CTF stream will generate the same value with
- * the two streams
- */
- boolean isBinaryEquivalent(IDeclaration other);
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-/**
- * Interface for data definitions. A definition is when a value is given to a
- * declaration
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public interface IDefinition {
-
- /**
- * Get the complete path of this field.
- *
- * @return The path
- * @since 1.0
- */
- ILexicalScope getScopePath();
-
- /**
- * Get the declaration of this definition
- *
- * @return the declaration of a datatype
- */
- IDeclaration getDeclaration();
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-
-/**
- * Event header declaration abstract class
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public interface IEventHeaderDeclaration extends IDeclaration {
- /**
- * The id of an event
- */
- String ID = "id"; //$NON-NLS-1$
- /**
- * The name of a timestamp field
- */
- String TIMESTAMP = "timestamp"; //$NON-NLS-1$
- /**
- * Extended header
- */
- String EXTENDED = "extended"; //$NON-NLS-1$
- /**
- * Compact header (not to be confused with compact vs large)
- */
- String COMPACT = "compact"; //$NON-NLS-1$
- /**
- * Name of the variant according to the spec
- */
- String VARIANT_NAME = "v"; //$NON-NLS-1$
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-/**
- * Common interface for simple CTF data types (which do not contain sub-fields).
- *
- * @author Matthew Khouzam
- */
-public interface ISimpleDatatypeDeclaration {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Marc-Andre Laperle - Add min/maximum for validation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.math.BigInteger;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF integer declaration.
- *
- * The declaration of a integer basic data type.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@NonNullByDefault
-public final class IntegerDeclaration extends Declaration implements ISimpleDatatypeDeclaration {
-
- // ------------------------------------------------------------------------
- // Helpers
- // ------------------------------------------------------------------------
-
- private static final int SIZE_64 = 64;
- private static final int SIZE_32 = 32;
- private static final int SIZE_27 = 27;
- private static final int SIZE_16 = 16;
- private static final int SIZE_8 = 8;
- private static final int SIZE_5 = 5;
- private static final int BYTE_ALIGN = 8;
- private static final int BASE_10 = 10;
- /**
- * unsigned int 32 bits big endian
- */
- public static final IntegerDeclaration UINT_32B_DECL = new IntegerDeclaration(32, false, ByteOrder.BIG_ENDIAN);
- /**
- * unsigned int 32 bits little endian
- */
- public static final IntegerDeclaration UINT_32L_DECL = new IntegerDeclaration(32, false, ByteOrder.LITTLE_ENDIAN);
- /**
- * signed int 32 bits big endian
- */
- public static final IntegerDeclaration INT_32B_DECL = new IntegerDeclaration(32, true, ByteOrder.BIG_ENDIAN);
- /**
- * signed int 32 bits little endian
- */
- public static final IntegerDeclaration INT_32L_DECL = new IntegerDeclaration(32, true, ByteOrder.LITTLE_ENDIAN);
- /**
- * unsigned int 32 bits big endian
- */
- public static final IntegerDeclaration UINT_64B_DECL = new IntegerDeclaration(64, false, ByteOrder.BIG_ENDIAN);
- /**
- * unsigned int 64 bits little endian
- */
- public static final IntegerDeclaration UINT_64L_DECL = new IntegerDeclaration(64, false, ByteOrder.LITTLE_ENDIAN);
- /**
- * signed int 64 bits big endian
- */
- public static final IntegerDeclaration INT_64B_DECL = new IntegerDeclaration(64, true, ByteOrder.BIG_ENDIAN);
- /**
- * signed int 64 bits little endian
- */
- public static final IntegerDeclaration INT_64L_DECL = new IntegerDeclaration(64, true, ByteOrder.LITTLE_ENDIAN);
- /**
- * unsigned 8 bit int endianness doesn't matter since it's 8 bits (byte)
- */
- public static final IntegerDeclaration UINT_8_DECL = new IntegerDeclaration(8, false, ByteOrder.BIG_ENDIAN);
- /**
- * signed 8 bit int endianness doesn't matter since it's 8 bits (char)
- */
- public static final IntegerDeclaration INT_8_DECL = new IntegerDeclaration(8, true, ByteOrder.BIG_ENDIAN);
- /**
- * Unsigned 5 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_5B_DECL = new IntegerDeclaration(5, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
- /**
- * Unsigned 5 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_5L_DECL = new IntegerDeclaration(5, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
- /**
- * Unsigned 5 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_27B_DECL = new IntegerDeclaration(27, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
- /**
- * Unsigned 5 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_27L_DECL = new IntegerDeclaration(27, false, 10, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, "", 1); //$NON-NLS-1$
- /**
- * Unsigned 16 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_16B_DECL = new IntegerDeclaration(16, false, ByteOrder.BIG_ENDIAN);
- /**
- * Unsigned 16 bit int, used for event headers
- */
- public static final IntegerDeclaration UINT_16L_DECL = new IntegerDeclaration(16, false, ByteOrder.LITTLE_ENDIAN);
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final int fLength;
- private final boolean fSigned;
- private final int fBase;
- private final ByteOrder fByteOrder;
- private final Encoding fEncoding;
- private final long fAlignment;
- private final String fClock;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Factory, some common types cached
- *
- * @param len
- * The length in bits
- * @param signed
- * Is the integer signed? false == unsigned
- * @param base
- * The base (10-16 are most common)
- * @param byteOrder
- * Big-endian little-endian or other
- * @param encoding
- * ascii, utf8 or none.
- * @param clock
- * The clock path, can be null
- * @param alignment
- * The minimum alignment. Should be >= 1
- * @return the integer declaration
- */
- public static IntegerDeclaration createDeclaration(int len, boolean signed, int base,
- @Nullable ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
- if (encoding.equals(Encoding.NONE) && (clock.equals("")) && base == BASE_10) { //$NON-NLS-1$
- if (alignment == BYTE_ALIGN) {
- switch (len) {
- case SIZE_8:
- return signed ? INT_8_DECL : UINT_8_DECL;
- case SIZE_16:
- if (!signed) {
- if (isBigEndian(byteOrder)) {
- return UINT_16B_DECL;
- }
- return UINT_16L_DECL;
- }
- break;
- case SIZE_32:
- if (signed) {
- if (isBigEndian(byteOrder)) {
- return INT_32B_DECL;
- }
- return INT_32L_DECL;
- }
- if (isBigEndian(byteOrder)) {
- return UINT_32B_DECL;
- }
- return UINT_32L_DECL;
- case SIZE_64:
- if (signed) {
- if (isBigEndian(byteOrder)) {
- return INT_64B_DECL;
- }
- return INT_64L_DECL;
- }
- if (isBigEndian(byteOrder)) {
- return UINT_64B_DECL;
- }
- return UINT_64L_DECL;
-
- default:
-
- }
-
- } else if (alignment == 1) {
- switch (len) {
- case SIZE_5:
- if (!signed) {
- if (isBigEndian(byteOrder)) {
- return UINT_5B_DECL;
- }
- return UINT_5L_DECL;
- }
- break;
- case SIZE_27:
- if (!signed) {
- if (isBigEndian(byteOrder)) {
- return UINT_27B_DECL;
- }
- return UINT_27L_DECL;
- }
- break;
- default:
- break;
- }
- }
- }
- return new IntegerDeclaration(len, signed, base, byteOrder, encoding, clock, alignment);
- }
-
- private static boolean isBigEndian(@Nullable ByteOrder byteOrder) {
- return (byteOrder != null) && byteOrder.equals(ByteOrder.BIG_ENDIAN);
- }
-
- /**
- * Constructor
- *
- * @param len
- * The length in bits
- * @param signed
- * Is the integer signed? false == unsigned
- * @param base
- * The base (10-16 are most common)
- * @param byteOrder
- * Big-endian little-endian or other
- * @param encoding
- * ascii, utf8 or none.
- * @param clock
- * The clock path, can be null
- * @param alignment
- * The minimum alignment. Should be ≥ 1
- */
- private IntegerDeclaration(int len, boolean signed, int base,
- @Nullable ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
- fLength = len;
- fSigned = signed;
- fBase = base;
-
- fByteOrder = (byteOrder == null ? checkNotNull(ByteOrder.nativeOrder()) : byteOrder);
-
- fEncoding = encoding;
- fClock = clock;
- fAlignment = Math.max(alignment, 1);
- }
-
- private IntegerDeclaration(int len, boolean signed, @Nullable ByteOrder byteOrder) {
- this(len, signed, BASE_10, byteOrder, Encoding.NONE, "", BYTE_ALIGN); //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Is the integer signed?
- *
- * @return the is the integer signed
- */
- public boolean isSigned() {
- return fSigned;
- }
-
- /**
- * Get the integer base commonly decimal or hex
- *
- * @return the integer base
- */
- public int getBase() {
- return fBase;
- }
-
- /**
- * Get the byte order
- *
- * @return the byte order
- */
- public ByteOrder getByteOrder() {
- return fByteOrder;
- }
-
- /**
- * Get encoding, chars are 8 bit ints
- *
- * @return the encoding
- */
- public Encoding getEncoding() {
- return fEncoding;
- }
-
- /**
- * Is the integer a character (8 bits and encoded?)
- *
- * @return is the integer a char
- */
- public boolean isCharacter() {
- return (fLength == SIZE_8) && (fEncoding != Encoding.NONE);
- }
-
- /**
- * Is the integer an unsigned byte (8 bits and no sign)?
- *
- * @return is the integer an unsigned byte
- */
- public boolean isUnsignedByte() {
- return (fLength == SIZE_8) && (!fSigned);
- }
-
- /**
- * Get the length in bits for this integer
- *
- * @return the length of the integer
- */
- public int getLength() {
- return fLength;
- }
-
- @Override
- public long getAlignment() {
- return fAlignment;
- }
-
- /**
- * The integer's clock, since timestamps are stored in ints
- *
- * @return the integer's clock, can be null. (most often it is)
- */
- public String getClock() {
- return fClock;
- }
-
- @Override
- public int getMaximumSize() {
- return fLength;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public IntegerDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
- String fieldName, BitBuffer input) throws CTFException {
- ByteOrder byteOrder = input.getByteOrder();
- input.setByteOrder(fByteOrder);
- long value = read(input);
- input.setByteOrder(byteOrder);
- return new IntegerDefinition(this, definitionScope, fieldName, value);
- }
-
- @Override
- public String toString() {
- return "[declaration] integer[length:" + fLength + (fSigned ? " " : " un") + "signed" + " base:" + fBase + " byteOrder:" + fByteOrder + " encoding:" + fEncoding + " alignment:" + fAlignment + " clock:" + fClock + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
- }
-
- /**
- * Get the maximum value for this integer declaration.
- *
- * @return The maximum value for this integer declaration
- */
- public BigInteger getMaxValue() {
- /*
- * Compute the number of bits able to represent an unsigned number,
- * ignoring sign bit.
- */
- int significantBits = fLength - (fSigned ? 1 : 0);
- /*
- * For a given N significant bits, compute the maximal value which is (1
- * << N) - 1.
- */
- return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).subtract(BigInteger.ONE));
- }
-
- /**
- * Get the minimum value for this integer declaration.
- *
- * @return The minimum value for this integer declaration
- */
- public BigInteger getMinValue() {
- if (!fSigned) {
- return checkNotNull(BigInteger.ZERO);
- }
-
- /*
- * Compute the number of bits able to represent an unsigned number,
- * without the sign bit.
- */
- int significantBits = fLength - 1;
- /*
- * For a given N significant bits, compute the minimal value which is -
- * (1 << N).
- */
- return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).negate());
- }
-
- private long read(BitBuffer input) throws CTFException {
- /* Offset the buffer position wrt the current alignment */
- alignRead(input);
-
- boolean signed = isSigned();
- int length = getLength();
- long bits = 0;
-
- /*
- * Is the endianness of this field the same as the endianness of the
- * input buffer? If not, then temporarily set the buffer's endianness to
- * this field's just to read the data
- */
- ByteOrder previousByteOrder = input.getByteOrder();
- if ((getByteOrder() != input.getByteOrder())) {
- input.setByteOrder(getByteOrder());
- }
-
- if (length > SIZE_64) {
- throw new CTFException("Cannot read an integer with over 64 bits. Length given: " + length); //$NON-NLS-1$
- }
-
- bits = input.get(length, signed);
-
- /*
- * Put the input buffer's endianness back to original if it was changed
- */
- if (previousByteOrder != input.getByteOrder()) {
- input.setByteOrder(previousByteOrder);
- }
-
- return bits;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (fAlignment ^ (fAlignment >>> 32));
- result = prime * result + fBase;
- result = prime * result + fByteOrder.toString().hashCode();
- result = prime * result + fClock.hashCode();
- result = prime * result + fEncoding.hashCode();
- result = prime * result + fLength;
- result = prime * result + (fSigned ? 1231 : 1237);
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- IntegerDeclaration other = (IntegerDeclaration) obj;
- if (!isBinaryEquivalent(other)) {
- return false;
- }
- if (!fByteOrder.equals(other.fByteOrder)) {
- return false;
- }
- if (!fClock.equals(other.fClock)) {
- return false;
- }
- if (fEncoding != other.fEncoding) {
- return false;
- }
- if (fBase != other.fBase) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- IntegerDeclaration other = (IntegerDeclaration) obj;
- return isBinaryEquivalent(other);
- }
-
- private boolean isBinaryEquivalent(IntegerDeclaration other) {
- if (fAlignment != other.fAlignment) {
- return false;
- }
- if (fLength != other.fLength) {
- return false;
- }
- if (fSigned != other.fSigned) {
- return false;
- }
- // no need for base
- // no need for encoding
- // no need for clock
- // byte inversion is ok on byte order if the element is one byte long
- if ((fLength != BYTE_ALIGN) && !fByteOrder.equals(other.fByteOrder)) {
- return false;
- }
- return true;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.math.BigInteger;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF integer definition.
- *
- * The definition of a integer basic data type. It will take the data from a
- * trace and store it (and make it fit) as a long.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class IntegerDefinition extends SimpleDatatypeDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final int INT_BASE_10 = 10;
- private static final int INT_BASE_16 = 16;
- private static final int INT_BASE_8 = 8;
- private static final int INT_BASE_2 = 2;
- private final long fValue;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param value
- * integer value
- */
- public IntegerDefinition(@NonNull IntegerDeclaration declaration,
- IDefinitionScope definitionScope, @NonNull String fieldName, long value) {
- super(declaration, definitionScope, fieldName);
- fValue = value;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the value of the integer
- *
- * @return the value of the integer (in long)
- */
- public long getValue() {
- return fValue;
- }
-
- @Override
- public IntegerDeclaration getDeclaration() {
- return (IntegerDeclaration) super.getDeclaration();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public Long getIntegerValue() {
- return getValue();
- }
-
- @Override
- public String getStringValue() {
- return this.toString();
- }
-
- @Override
- public String toString() {
- if (getDeclaration().isCharacter()) {
- char c = (char) fValue;
- return Character.toString(c);
- }
- return formatNumber(fValue, getDeclaration().getBase(), getDeclaration().isSigned());
- }
-
- /**
- * Print a numeric value as a string in a given base
- *
- * @param value
- * The value to print as string
- * @param base
- * The base for this value
- * @param signed
- * Is the value signed or not
- * @return formatted number string
- */
- public static String formatNumber(long value, int base, boolean signed) {
- String s;
- /* Format the number correctly according to the integer's base */
- switch (base) {
- case INT_BASE_2:
- s = "0b" + Long.toBinaryString(value); //$NON-NLS-1$
- break;
- case INT_BASE_8:
- s = "0" + Long.toOctalString(value); //$NON-NLS-1$
- break;
- case INT_BASE_16:
- s = "0x" + Long.toHexString(value); //$NON-NLS-1$
- break;
- case INT_BASE_10:
- default:
- /* For non-standard base, we'll just print it as a decimal number */
- if (!signed && value < 0) {
- /*
- * Since there are no 'unsigned long', handle this case with
- * BigInteger
- */
- BigInteger bigInteger = BigInteger.valueOf(value);
- /*
- * we add 2^64 to the negative number to get the real unsigned
- * value
- */
- bigInteger = bigInteger.add(BigInteger.valueOf(1).shiftLeft(64));
- s = bigInteger.toString();
- } else {
- s = Long.toString(value);
- }
- break;
- }
- return s;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-/**
- * Scoped defintion. a defintion where you can lookup various datatypes
- *
- * TODO: replace by default methods and an interface when java 8 is upon us
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public abstract class ScopedDefinition extends Definition implements IDefinitionScope {
-
- /**
- * Constructor
- *
- * @param declaration
- * the event declaration
- * @param definitionScope
- * the definition is in a scope, (normally a struct) what is it?
- * @param fieldName
- * the name of the definition. (it is a field in the parent
- * scope)
- */
- public ScopedDefinition(IDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName) {
- super(declaration, definitionScope, fieldName);
- }
-
- /**
- * Constructor This one takes the scope and thus speeds up definition
- * creation
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param scope
- * the lexical scope
- * @since 1.0
- */
- public ScopedDefinition(StructDeclaration declaration, @Nullable IDefinitionScope definitionScope, String fieldName, ILexicalScope scope) {
- super(declaration, definitionScope, fieldName, scope);
- }
-
- /**
- * Lookup an array in a struct. If the name returns a non-array (like an
- * int) then the method returns null
- *
- * @param name
- * the name of the array
- * @return the array or null.
- */
- public @Nullable AbstractArrayDefinition lookupArrayDefinition(String name) {
- IDefinition def = lookupDefinition(name);
- return (AbstractArrayDefinition) ((def instanceof AbstractArrayDefinition) ? def : null);
- }
-
-
- /**
- * Lookup an enum in a struct. If the name returns a non-enum (like an int)
- * then the method returns null
- *
- * @param name
- * the name of the enum
- * @return the enum or null if a definition is not found or it does not
- * match the desired datatype.
- */
- @Nullable
- public EnumDefinition lookupEnum(String name) {
- IDefinition def = lookupDefinition(name);
- return (EnumDefinition) ((def instanceof EnumDefinition) ? def : null);
- }
-
- /**
- * Lookup an integer in a struct. If the name returns a non-integer (like an
- * float) then the method returns null
- *
- * @param name
- * the name of the integer
- * @return the integer or null if a definition is not found or it does not
- * match the desired datatype.
- */
- @Nullable
- public IntegerDefinition lookupInteger(String name) {
- IDefinition def = lookupDefinition(name);
- return (IntegerDefinition) ((def instanceof IntegerDefinition) ? def : null);
- }
-
- /**
- * Lookup a string in a struct. If the name returns a non-string (like an
- * int) then the method returns null
- *
- * @param name
- * the name of the string
- * @return the string or null if a definition is not found or it does not
- * match the desired datatype.
- */
- @Nullable
- public StringDefinition lookupString(String name) {
- IDefinition def = lookupDefinition(name);
- return (StringDefinition) ((def instanceof StringDefinition) ? def : null);
- }
-
- /**
- * Lookup a struct in a struct. If the name returns a non-struct (like an
- * int) then the method returns null
- *
- * @param name
- * the name of the struct
- * @return the struct or null if a definition is not found or it does not
- * match the desired datatype.
- */
- @Nullable
- public StructDefinition lookupStruct(String name) {
- IDefinition def = lookupDefinition(name);
- return (StructDefinition) ((def instanceof StructDefinition) ? def : null);
- }
-
- /**
- * Lookup a variant in a struct. If the name returns a non-variant (like an
- * int) then the method returns null
- *
- * @param name
- * the name of the variant
- * @return the variant or null if a definition is not found or it does not
- * match the desired datatype.
- */
- @Nullable
- public VariantDefinition lookupVariant(String name) {
- IDefinition def = lookupDefinition(name);
- return (VariantDefinition) ((def instanceof VariantDefinition) ? def : null);
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * Simple Datatype definition is a datatype that allows the addition of
- * getIntegerValue and getStringValue to a class.
- *
- * @author Matthew Khouzam
- */
-public abstract class SimpleDatatypeDefinition extends Definition {
-
- /**
- * Create a new SimpleDatatypeDefinition
- *
- * @param declaration
- * definition's declaration
- * @param definitionScope
- * The scope of this definition
- * @param fieldName
- * The name of the field matching this definition in the parent
- * scope
- */
- public SimpleDatatypeDefinition(@NonNull IDeclaration declaration, IDefinitionScope definitionScope,
- @NonNull String fieldName) {
- super(declaration, definitionScope, fieldName);
- }
-
- /**
- * Gets the value in integer form
- *
- * @return the integer in a Long, can be null
- */
- public Long getIntegerValue() {
- return null;
- }
-
- /**
- * Gets the value in string form
- *
- * @return the integer in a String, can be null
- */
- public String getStringValue() {
- return null;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF string declaration.
- *
- * Strings are an array of bytes of variable size and are terminated by a '\0'
- * "NULL" character. Their encoding is described in the TSDL meta-data. In
- * absence of encoding attribute information, the default encoding is UTF-8.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-@NonNullByDefault
-public class StringDeclaration extends Declaration {
-
- private static final StringDeclaration STRING_DEC_UTF8 = new StringDeclaration(Encoding.UTF8);
- private static final StringDeclaration STRING_DEC_ASCII = new StringDeclaration(Encoding.ASCII);
- private static final StringDeclaration STRING_DEC_NO_ENC = new StringDeclaration(Encoding.NONE);
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final int BITS_PER_BYTE = Byte.SIZE;
- private final Encoding fEncoding;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Generate an encoded string declaration
- *
- * @param encoding
- * the encoding, utf8 or ascii
- */
- private StringDeclaration(Encoding encoding) {
- fEncoding = encoding;
- }
-
- /**
- * Create a StringDeclaration with the default UTF-8 encoding
- *
- * @return a {@link StringDeclaration} with UTF-8 encoding
- */
- public static StringDeclaration getStringDeclaration() {
- return STRING_DEC_UTF8;
- }
-
- /**
- * Create a StringDeclaration
- *
- * @param encoding
- * the {@link Encoding} can be Encoding.UTF8, Encoding.ASCII or
- * other
- * @return a {@link StringDeclaration}
- * @throws IllegalArgumentException
- * if the encoding is not recognized.
- */
- public static StringDeclaration getStringDeclaration(Encoding encoding) {
- switch (encoding) {
- case ASCII:
- return STRING_DEC_ASCII;
- case NONE:
- return STRING_DEC_NO_ENC;
- case UTF8:
- return STRING_DEC_UTF8;
- default:
- throw new IllegalArgumentException("Unrecognized encoding: " + encoding); //$NON-NLS-1$
- }
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- *
- * @return the character encoding.
- */
- public Encoding getEncoding() {
- return fEncoding;
- }
-
- @Override
- public long getAlignment() {
- // See ctf 4.2.5: Strings are always aligned on byte size.
- return BITS_PER_BYTE;
- }
-
- @Override
- public int getMaximumSize() {
- /*
- * Every definition can have a different size, so we do not scope this.
- * Minimum size is one byte (8 bits) though.
- */
- return 8;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public StringDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
- String fieldName, BitBuffer input) throws CTFException {
- String value = read(input);
- return new StringDefinition(this, definitionScope, fieldName, value);
- }
-
- private String read(BitBuffer input) throws CTFException {
- /* Offset the buffer position wrt the current alignment */
- alignRead(input);
-
- StringBuilder sb = new StringBuilder();
- char c = (char) input.get(BITS_PER_BYTE, false);
- while (c != 0) {
- sb.append(c);
- c = (char) input.get(BITS_PER_BYTE, false);
- }
- return NonNullUtils.checkNotNull(sb.toString());
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- return "[declaration] string[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = prime;
- switch (fEncoding) {
- case ASCII:
- result += 1;
- break;
- case NONE:
- result += 2;
- break;
- case UTF8:
- result += 3;
- break;
- default:
- break;
- }
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- StringDeclaration other = (StringDeclaration) obj;
- if (fEncoding != other.fEncoding) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
- return equals(other);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF string definition (similar to a C null-terminated byte array).
- *
- * Strings are an array of bytes of variable size and are terminated by a '\0'
- * "NULL" character. Their encoding is described in the TSDL meta-data. In
- * absence of encoding attribute information, the default encoding is UTF-8.
- *
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class StringDefinition extends Definition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final String fString;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param value
- * The String value
- */
- public StringDefinition(@NonNull StringDeclaration declaration,
- IDefinitionScope definitionScope, @NonNull String fieldName, String value) {
- super(declaration, definitionScope, fieldName);
- fString = value;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public StringDeclaration getDeclaration() {
- return (StringDeclaration) super.getDeclaration();
- }
-
- /**
- * Gets the string (value)
- *
- * @return the string
- */
- public String getValue() {
- return fString;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public String toString() {
- return '\"' + getValue() + '\"';
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-/**
- * A CTF structure declaration.
- *
- * A structure is similar to a C structure, it is a compound data type that
- * contains other datatypes in fields. they are stored in an hashmap and indexed
- * by names which are strings.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public class StructDeclaration extends Declaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /** linked list of field names. So fieldName->fieldValue */
- private final @NonNull Map<String, IDeclaration> fFieldMap = new LinkedHashMap<>();
-
- /** maximum bit alignment */
- private long fMaxAlign;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The struct declaration, add fields later
- *
- * @param align
- * the minimum alignment of the struct. (if a struct is 8bit
- * aligned and has a 32 bit aligned field, the struct becomes 32
- * bit aligned.
- */
- public StructDeclaration(long align) {
- fMaxAlign = Math.max(align, 1);
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Get current alignment
- *
- * @return the alignment of the struct and all its fields
- */
- public long getMaxAlign() {
- return fMaxAlign;
- }
-
- /**
- * Query if the struct has a given field
- *
- * @param name
- * the name of the field, scopeless please
- * @return does the field exist?
- */
- public boolean hasField(String name) {
- return fFieldMap.containsKey(name);
- }
-
- /**
- * Get the fields of the struct as a map.
- *
- * @return a Map of the fields (key is the name)
- */
- public Map<String, IDeclaration> getFields() {
- return fFieldMap;
- }
-
- /**
- * Get the field declaration corresponding to a field name.
- *
- * @param fieldName
- * The field name
- * @return The declaration of the field, or null if there is no such field.
- */
- @Nullable
- public IDeclaration getField(String fieldName) {
- return fFieldMap.get(fieldName);
- }
-
- /**
- * Gets the field list. Very important since the map of fields does not
- * retain the order of the fields.
- *
- * @return the field list.
- */
- public Iterable<String> getFieldsList() {
- return fFieldMap.keySet();
- }
-
- @Override
- public long getAlignment() {
- return this.fMaxAlign;
- }
-
- @Override
- public int getMaximumSize() {
- int maxSize = 0;
- for (IDeclaration field : fFieldMap.values()) {
- maxSize += field.getMaximumSize();
- }
- return Math.min(maxSize, Integer.MAX_VALUE);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public StructDefinition createDefinition(IDefinitionScope definitionScope,
- String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- final Definition[] myFields = new Definition[fFieldMap.size()];
- StructDefinition structDefinition = new StructDefinition(this, definitionScope, fieldName, myFields);
- fillStruct(input, myFields, structDefinition);
- return structDefinition;
- }
-
- /**
- * Create a definition from this declaration. This is a faster constructor
- * as it has a lexical scope and this does not need to look it up.
- *
- * @param definitionScope
- * the definition scope, the parent where the definition will be
- * placed
- * @param fieldScope
- * the scope of the definition
- * @param input
- * a bitbuffer to read from
- * @return a reference to the definition
- * @throws CTFException
- * error in reading
- * @since 1.0
- */
- public StructDefinition createDefinition(IDefinitionScope definitionScope,
- ILexicalScope fieldScope, @NonNull BitBuffer input) throws CTFException {
- alignRead(input);
- final Definition[] myFields = new Definition[fFieldMap.size()];
-
- StructDefinition structDefinition = new StructDefinition(this,definitionScope,
- fieldScope, fieldScope.getName(), checkNotNull(fFieldMap.keySet()), myFields);
- fillStruct(input, myFields, structDefinition);
- return structDefinition;
- }
-
- /**
- * Add a field to the struct
- *
- * @param name
- * the name of the field, scopeless
- * @param declaration
- * the declaration of the field
- */
- public void addField(String name, IDeclaration declaration) {
- fFieldMap.put(name, declaration);
- fMaxAlign = Math.max(fMaxAlign, declaration.getAlignment());
- }
-
- private void fillStruct(@NonNull BitBuffer input, final Definition[] myFields, StructDefinition structDefinition) throws CTFException {
- Iterator<Map.Entry<String, IDeclaration>> iter = fFieldMap.entrySet().iterator();
- for (int i = 0; i < fFieldMap.size(); i++) {
- Map.Entry<String, IDeclaration> entry = iter.next();
- /* We should not have inserted null keys... */
- String key = checkNotNull(entry.getKey());
- myFields[i] = entry.getValue().createDefinition(structDefinition, key, input);
- }
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- StringBuilder sb = new StringBuilder();
- sb.append("[declaration] struct["); //$NON-NLS-1$
- for (Entry<String, IDeclaration> field : fFieldMap.entrySet()) {
- sb.append(field.getKey()).append(':').append(field.getValue());
- }
- sb.append(']');
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- for (Entry<String, IDeclaration> field : fFieldMap.entrySet()) {
- result = prime * result + field.getKey().hashCode();
- result = prime * result + field.getValue().hashCode();
- }
- result = (prime * result) + (int) (fMaxAlign ^ (fMaxAlign >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof StructDeclaration)) {
- return false;
- }
- StructDeclaration other = (StructDeclaration) obj;
- if (fFieldMap.size() != other.fFieldMap.size()) {
- return false;
- }
-
- List<String> localFieldNames = new ArrayList<>();
- localFieldNames.addAll(fFieldMap.keySet());
-
- List<IDeclaration> localDecs = new ArrayList<>();
- localDecs.addAll(fFieldMap.values());
-
- List<String> otherFieldNames = new ArrayList<>();
- otherFieldNames.addAll(other.fFieldMap.keySet());
-
- List<IDeclaration> otherDecs = new ArrayList<>();
- otherDecs.addAll(other.fFieldMap.values());
-
- //check fields in order
- for (int i = 0; i < fFieldMap.size(); i++) {
- if ((!localFieldNames.get(i).equals(otherFieldNames.get(i))) ||
- (!otherDecs.get(i).equals(localDecs.get(i)))) {
- return false;
- }
- }
-
- if (fMaxAlign != other.fMaxAlign) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof StructDeclaration)) {
- return false;
- }
- StructDeclaration other = (StructDeclaration) obj;
- if (fFieldMap.size() != other.fFieldMap.size()) {
- return false;
- }
- List<IDeclaration> localDecs = new ArrayList<>();
- localDecs.addAll(fFieldMap.values());
- List<IDeclaration> otherDecs = new ArrayList<>();
- otherDecs.addAll(other.fFieldMap.values());
- for (int i = 0; i < fFieldMap.size(); i++) {
- if (!otherDecs.get(i).isBinaryEquivalent(localDecs.get(i))) {
- return false;
- }
- }
-
- if (fMaxAlign != other.fMaxAlign) {
- return false;
- }
- return true;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-
-/**
- * A CTF structure definition (similar to a C structure).
- *
- * A structure is similar to a C structure, it is a compound data type that
- * contains other datatypes in fields. they are stored in an hashmap and indexed
- * by names which are strings.
- *
- * TODO: move me to internal
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class StructDefinition extends ScopedDefinition implements ICompositeDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final ImmutableList<String> fFieldNames;
- private final Definition[] fDefinitions;
- private Map<String, Definition> fDefinitionsMap = null;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param structFieldName
- * the field name
- * @param definitions
- * the definitions
- * @since 1.0
- */
- public StructDefinition(@NonNull StructDeclaration declaration,
- IDefinitionScope definitionScope,
- @NonNull String structFieldName,
- Definition[] definitions) {
- super(declaration, definitionScope, structFieldName);
- fFieldNames = ImmutableList.copyOf(declaration.getFieldsList());
- fDefinitions = definitions;
- if (fFieldNames.isEmpty()) {
- fDefinitionsMap = Collections.EMPTY_MAP;
- }
- }
-
- /**
- * Constructor This one takes the scope and thus speeds up definition
- * creation
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param scope
- * the scope of this variable
- * @param structFieldName
- * the field name
- * @param fieldNames
- * the list of fields
- * @param definitions
- * the definitions
- * @since 1.0
- */
- public StructDefinition(@NonNull StructDeclaration declaration,
- IDefinitionScope definitionScope, @NonNull ILexicalScope scope,
- @NonNull String structFieldName, @NonNull Iterable<String> fieldNames, Definition[] definitions) {
- super(declaration, definitionScope, structFieldName, scope);
- fFieldNames = ImmutableList.copyOf(fieldNames);
- fDefinitions = definitions;
- if (fFieldNames.isEmpty()) {
- fDefinitionsMap = Collections.EMPTY_MAP;
- }
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public Definition getDefinition(String fieldName) {
- if (fDefinitionsMap == null) {
- /* Build the definitions map */
- Builder<String, Definition> mapBuilder = new ImmutableMap.Builder<>();
- for (int i = 0; i < fFieldNames.size(); i++) {
- if (fDefinitions[i] != null) {
- mapBuilder.put(fFieldNames.get(i), fDefinitions[i]);
- }
- }
- fDefinitionsMap = mapBuilder.build();
- }
- return fDefinitionsMap.get(fieldName);
- }
-
- @Override
- public List<String> getFieldNames() {
- return fFieldNames;
- }
-
- @Override
- public StructDeclaration getDeclaration() {
- return (StructDeclaration) super.getDeclaration();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public Definition lookupDefinition(String lookupPath) {
- /*
- * The fields are created in order of appearance, so if a variant or
- * sequence refers to a field that is after it, the field's definition
- * will not be there yet in the hashmap.
- */
- int val = fFieldNames.indexOf(lookupPath);
- if (val != -1) {
- return fDefinitions[val];
- }
- String lookupUnderscored = "_" + lookupPath; //$NON-NLS-1$
- val = fFieldNames.indexOf(lookupUnderscored);
- if (val != -1) {
- return fDefinitions[val];
- }
- return null;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
-
- builder.append("{ "); //$NON-NLS-1$
-
- if (fFieldNames != null) {
- List<String> fields = new LinkedList<>();
- for (String field : fFieldNames) {
- String appendee = field + " = " + lookupDefinition(field).toString(); //$NON-NLS-1$
- fields.add(appendee);
- }
- Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
- builder.append(joiner.join(fields));
- }
-
- builder.append(" }"); //$NON-NLS-1$
-
- return builder.toString();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF C variant declaration.
- *
- * A variant is similar to a C union, only taking the minimum size of the types,
- * it is a compound data type that contains other datatypes in fields. they are
- * stored in an hashmap and indexed by names which are strings.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public class VariantDeclaration extends Declaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private String fTag = null;
- private static final long ALIGNMENT = 1;
- private final Map<String, IDeclaration> fFields = Collections.synchronizedMap(new HashMap<String, IDeclaration>());
- private IDeclaration fDeclarationToPopulate;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- */
- public VariantDeclaration() {
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * @return Does the variant have a tag
- */
- public boolean isTagged() {
- return fTag != null;
- }
-
- /**
- * Lookup if a field exists in the variant
- *
- * @param fieldTag
- * the field tag name
- * @return true = field tag exists
- */
- public boolean hasField(String fieldTag) {
- return fFields.containsKey(fieldTag);
- }
-
- /**
- * Sets the tag in a variant
- *
- * @param tag
- * the tag
- */
- public void setTag(String tag) {
- fTag = tag;
- }
-
- /**
- * Gets current variant tag
- *
- * @return the variant tag.
- */
- public String getTag() {
- return fTag;
- }
-
- /**
- * Gets the fields of the variant
- *
- * @return the fields of the variant
- */
- public Map<String, IDeclaration> getFields() {
- return this.fFields;
- }
-
- @Override
- public long getAlignment() {
- return ALIGNMENT;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public VariantDefinition createDefinition(IDefinitionScope definitionScope,
- String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- IDefinition def = definitionScope.lookupDefinition(fTag);
- EnumDefinition tagDef = (EnumDefinition) ((def instanceof EnumDefinition) ? def : null);
- if (tagDef == null) {
- throw new CTFException("Tag is not defined " + fTag); //$NON-NLS-1$
- }
- String varFieldName = tagDef.getStringValue();
- fDeclarationToPopulate = fFields.get(varFieldName);
- if (fDeclarationToPopulate == null) {
- throw new CTFException("Unknown enum selector for variant " + //$NON-NLS-1$
- definitionScope.getScopePath().getPath());
- }
- Definition fieldValue = fDeclarationToPopulate.createDefinition(definitionScope, fieldName, input);
- return new VariantDefinition(this, definitionScope, varFieldName, fieldName, fieldValue);
- }
-
- /**
- * Add a field to this CTF Variant
- *
- * @param fieldTag
- * The tag of the new field
- * @param declaration
- * The Declaration of this new field
- */
- public void addField(String fieldTag, IDeclaration declaration) {
- fFields.put(fieldTag, declaration);
- }
-
- @Override
- public int getMaximumSize() {
- Collection<IDeclaration> values = fFields.values();
- int maxSize = 0;
- for (IDeclaration field : values) {
- maxSize = Math.max(maxSize, field.getMaximumSize());
- }
- return maxSize;
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- StringBuilder sb = new StringBuilder();
- sb.append("[declaration] variant["); //$NON-NLS-1$
- for (Entry<String, IDeclaration> field : fFields.entrySet()) {
- sb.append(field.getKey()).append(':').append(field.getValue());
- }
- sb.append(']');
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fDeclarationToPopulate == null) ? 0 : fDeclarationToPopulate.hashCode());
- if (fFields == null) {
- result = prime * result;
- } else {
- for (Entry<String, IDeclaration> field : fFields.entrySet()) {
- result = prime * result + field.getValue().hashCode();
- }
- }
- result = prime * result + ((fTag == null) ? 0 : fTag.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- VariantDeclaration other = (VariantDeclaration) obj;
-
- if (!equalsNullable(fDeclarationToPopulate, other.fDeclarationToPopulate)) {
- return false;
- }
- // do not check the order of the fields
- if (!equalsNullable(fFields, other.fFields)) {
- return false;
- }
- if (!equalsNullable(fTag, other.fTag)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- VariantDeclaration other = (VariantDeclaration) obj;
- if (fFields == null) {
- if (other.fFields != null) {
- return false;
- }
- } else {
- if (fFields.size() != other.fFields.size()) {
- return false;
- }
- for (Entry<String, IDeclaration> field : fFields.entrySet()) {
- if (!other.fFields.containsKey(field.getKey())) {
- return false;
- }
- IDeclaration field2 = other.fFields.get(field.getKey());
- if (!field2.isBinaryEquivalent(field.getValue())) {
- return false;
- }
- }
- }
- return true;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-
-/**
- * A CTF variant definition (similar to a C union).
- *
- * A variant is similar to a C union, only taking the minimum size of the types,
- * it is a compound data type that contains other datatypes in fields. they are
- * stored in an hashmap and indexed by names which are strings.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class VariantDefinition extends ScopedDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final Definition fDefinition;
- private final String fCurrentField;
- private final String fFieldName;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param selectedField
- * the selected field
- * @param fieldName
- * the field name
- * @param fieldValue
- * the field value
- */
- public VariantDefinition(@NonNull VariantDeclaration declaration,
- IDefinitionScope definitionScope, String selectedField, @NonNull String fieldName, Definition fieldValue) {
- super(declaration, definitionScope, fieldName);
-
- fFieldName = fieldName;
- fCurrentField = selectedField;
- fDefinition = fieldValue;
-
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public VariantDeclaration getDeclaration() {
- return (VariantDeclaration) super.getDeclaration();
- }
-
- /**
- * Get the current field name
- *
- * @return the current field name
- */
- public String getCurrentFieldName() {
- return fCurrentField;
- }
-
- /**
- * Get the current field
- *
- * @return the current field
- */
- public Definition getCurrentField() {
- return fDefinition;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * @since 1.0
- */
- @Override
- public IDefinition lookupDefinition(String lookupPath) {
- if (lookupPath == null) {
- return null;
- }
- if (lookupPath.equals(fFieldName)) {
- return fDefinition;
- }
- return getDefinitionScope().lookupDefinition(lookupPath);
- }
-
- @Override
- public String toString() {
- return "{ " + getCurrentFieldName() + //$NON-NLS-1$
- " = " + getCurrentField() + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-
-/**
- * An exception just for trace readers and writers
- *
- * @since 1.0
- */
-public class CTFIOException extends CTFException {
-
- /**
- * Unique ID
- */
- private static final long serialVersionUID = -2216400542574921838L;
-
- /**
- * Constructor with an attached message.
- *
- * @param message
- * The message attached to this exception
- */
- public CTFIOException(String message) {
- super(message);
- }
-
- /**
- * Constructor with an attached message.
- *
- * @param e
- * The exception attached to this exception
- */
- public CTFIOException(Exception e) {
- super(e);
- }
-
- /**
- * Constructor with an attached message and exception.
- *
- * @param message
- * The message attached to this exception
- * @param e
- * The encapsulated exception
- * @since 1.0
- */
- public CTFIOException(String message, Exception e) {
- super(message, e);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.trace;
-
-/**
- * A response to a request
- *
- * @author Matthew Khouzam
- */
-public enum CTFResponse {
- /**
- * The operation was successful
- */
- OK,
- /**
- * The operation cannot be yet completed
- */
- WAIT,
- /**
- * The operation was finished
- */
- FINISH,
- /**
- * The operation failed
- */
- ERROR
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-
-/**
- * <b><u>Stream</u></b>
- * <p>
- * Represents a stream in a trace.
- */
-public class CTFStream {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The numerical ID of the stream
- */
- private long fId = 0;
-
- /**
- * Declarations of the stream-specific structures
- */
- private StructDeclaration fPacketContextDecl = null;
- private IDeclaration fEventHeaderDecl = null;
- private StructDeclaration fEventContextDecl = null;
-
- /**
- * The trace to which the stream belongs
- */
- private CTFTrace fTrace = null;
-
- /**
- * Maps event ids to events
- */
- private final ArrayList<IEventDeclaration> fEvents = new ArrayList<>();
-
- private boolean fEventUnsetId = false;
- private boolean fStreamIdSet = false;
-
- /**
- * The inputs associated to this stream
- */
- private final Set<CTFStreamInput> fInputs = new HashSet<>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a Stream that belongs to a Trace
- *
- * @param trace
- * The trace to which belongs this stream.
- */
- public CTFStream(CTFTrace trace) {
- fTrace = trace;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Sets the id of a stream
- *
- * @param id
- * the id of a stream
- */
- public void setId(long id) {
- fId = id;
- fStreamIdSet = true;
- }
-
- /**
- * Gets the id of a stream
- *
- * @return id the id of a stream
- * @since 1.0
- */
- public long getId() {
- return fId;
- }
-
- /**
- * Is the id of a stream set
- *
- * @return If the ID is set or not
- */
- public boolean isIdSet() {
- return fStreamIdSet;
- }
-
- /**
- *
- * @return is the event header set (timestamp and stuff) (see Ctf Spec)
- */
- public boolean isEventHeaderSet() {
- return fEventHeaderDecl != null;
- }
-
- /**
- *
- * @return is the event context set (pid and stuff) (see Ctf Spec)
- */
- public boolean isEventContextSet() {
- return fEventContextDecl != null;
- }
-
- /**
- *
- * @return Is the packet context set (see Ctf Spec)
- */
- public boolean isPacketContextSet() {
- return fPacketContextDecl != null;
- }
-
- /**
- * Sets the event header
- *
- * @param eventHeader
- * the current event header for all events in this stream
- */
- public void setEventHeader(StructDeclaration eventHeader) {
- fEventHeaderDecl = eventHeader;
- }
-
- /**
- * Sets the event header, this typically has the id and the timestamp
- *
- * @param eventHeader
- * the current event header for all events in this stream
- */
- public void setEventHeader(IEventHeaderDeclaration eventHeader) {
- fEventHeaderDecl = eventHeader;
- }
-
- /**
- *
- * @param eventContext
- * the context for all events in this stream
- */
- public void setEventContext(StructDeclaration eventContext) {
- fEventContextDecl = eventContext;
- }
-
- /**
- *
- * @param packetContext
- * the packet context for all packets in this stream
- */
- public void setPacketContext(StructDeclaration packetContext) {
- fPacketContextDecl = packetContext;
- }
-
- /**
- * Gets the event header declaration
- *
- * @return the event header declaration in declaration form
- */
- public IDeclaration getEventHeaderDeclaration() {
- return fEventHeaderDecl;
- }
-
- /**
- *
- * @return the event context declaration in structdeclaration form
- */
- public StructDeclaration getEventContextDecl() {
- return fEventContextDecl;
- }
-
- /**
- *
- * @return the packet context declaration in structdeclaration form
- */
- public StructDeclaration getPacketContextDecl() {
- return fPacketContextDecl;
- }
-
- /**
- *
- * @return the set of all stream inputs for this stream
- */
- public Set<CTFStreamInput> getStreamInputs() {
- return fInputs;
- }
-
- /**
- *
- * @return the parent trace
- */
- public CTFTrace getTrace() {
- return fTrace;
- }
-
- /**
- * Get all the event declarations in this stream.
- *
- * @return The event declarations for this stream
- */
- public @NonNull Collection<IEventDeclaration> getEventDeclarations() {
- List<IEventDeclaration> retVal = new ArrayList<>(fEvents);
- retVal.removeAll(Collections.<IEventDeclaration> singletonList(null));
- return retVal;
- }
-
- /**
- * Get the event declaration for a given ID.
- *
- * @param eventId
- * The ID, can be {@link EventDeclaration#UNSET_EVENT_ID}, or any
- * positive value
- * @return The event declaration with the given ID for this stream, or
- * 'null' if there are no declaration with this ID
- * @throws IllegalArgumentException
- * If the passed ID is invalid
- */
- public @Nullable IEventDeclaration getEventDeclaration(int eventId) {
- int eventIndex = (eventId == IEventDeclaration.UNSET_EVENT_ID) ? 0 : eventId;
- if (eventIndex < 0) {
- /* Any negative value other than UNSET_EVENT_ID is invalid */
- throw new IllegalArgumentException("Event ID cannot be negative."); //$NON-NLS-1$
- }
- if (eventIndex >= fEvents.size()) {
- /* This ID could be valid, but there are no declarations with it */
- return null;
- }
- return fEvents.get(eventIndex);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Adds an event to the event list.
- *
- * An event in a stream can omit its id if it is the only event in this
- * stream. An event for which no id has been specified has a null id. It is
- * thus not possible to add an event with the null key if the map is not
- * empty. It is also not possible to add an event to the map if the null key
- * is present in the map.
- *
- * @param event
- * The event to add
- * @throws ParseException
- * If there was a problem reading the event or adding it to the
- * stream
- */
- public void addEvent(IEventDeclaration event) throws ParseException {
- if (fEventUnsetId) {
- throw new ParseException("Event without id with multiple events in a stream"); //$NON-NLS-1$
- }
- int id = ((EventDeclaration) event).id();
-
- /*
- * If there is an event without id (the null key), it must be the only
- * one
- */
- if (id == IEventDeclaration.UNSET_EVENT_ID) {
- if (!fEvents.isEmpty()) {
- throw new ParseException("Event without id with multiple events in a stream"); //$NON-NLS-1$
- }
- fEventUnsetId = true;
- fEvents.add(event);
- } else {
- /* Check if an event with the same ID already exists */
- if (fEvents.size() > id && fEvents.get(id) != null) {
- throw new ParseException("Event id already exists"); //$NON-NLS-1$
- }
- ensureSize(fEvents, id);
- /* Put the event in the list */
- fEvents.set(id, event);
- }
- }
-
- /**
- * Add a list of event declarations to this stream. There must be no overlap
- * between the two lists of event declarations. This will merge the two
- * lists and preserve the indexes of both lists.
- *
- * @param events
- * list of the events to add
- * @throws CTFException
- * if the list already contains data
- */
- public void addEvents(Collection<IEventDeclaration> events) throws CTFException {
- if (fEventUnsetId) {
- throw new CTFException("Cannot add to a stream with an unidentified event"); //$NON-NLS-1$
- }
- if (fEvents.isEmpty()) {
- fEvents.addAll(events);
- return;
- }
- for (IEventDeclaration event : events) {
- if (event != null) {
- int index = event.getId().intValue();
- ensureSize(fEvents, index);
- if (fEvents.get(index) != null) {
- throw new CTFException("Both lists have an event defined at position " + index); //$NON-NLS-1$
- }
- fEvents.set(index, event);
- }
- }
- }
-
- private static void ensureSize(ArrayList<? extends Object> list, int index) {
- list.ensureCapacity(index);
- while (list.size() <= index) {
- list.add(null);
- }
- }
-
- /**
- * Add an input to this Stream
- *
- * @param input
- * The StreamInput to add.
- */
- public void addInput(CTFStreamInput input) {
- fInputs.add(input);
- }
-
- @Override
- public String toString() {
- return "Stream [id=" + fId + ", packetContextDecl=" + fPacketContextDecl //$NON-NLS-1$ //$NON-NLS-2$
- + ", eventHeaderDecl=" + fEventHeaderDecl //$NON-NLS-1$
- + ", eventContextDecl=" + fEventContextDecl + ", trace=" + fTrace //$NON-NLS-1$ //$NON-NLS-2$
- + ", events=" + fEvents + ", inputs=" + fInputs + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileChannel.MapMode;
-import java.nio.file.StandardOpenOption;
-import java.util.UUID;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry;
-import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
-
-/**
- * <b><u>StreamInput</u></b>
- * <p>
- * Represents a trace file that belongs to a certain stream.
- */
-@NonNullByDefault
-public class CTFStreamInput implements IDefinitionScope {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final int MAP_SIZE = 4096;
-
- /**
- * The associated Stream
- */
- private final CTFStream fStream;
-
- /**
- * Information on the file (used for debugging)
- */
- private final File fFile;
-
- /**
- * The packet index of this input
- */
- private final StreamInputPacketIndex fIndex;
-
- private long fTimestampEnd;
-
- /**
- * Definition of trace packet header
- */
- private final StructDeclaration fTracePacketHeaderDecl;
-
- /**
- * Definition of trace stream packet context
- */
- private final StructDeclaration fStreamPacketContextDecl;
-
- /**
- * Total number of lost events in this stream
- */
- private long fLostSoFar = 0;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a StreamInput.
- *
- * @param stream
- * The stream to which this StreamInput belongs to.
- * @param file
- * Information about the trace file (for debugging purposes).
- */
- public CTFStreamInput(CTFStream stream, File file) {
- fStream = stream;
- fFile = file;
- fIndex = new StreamInputPacketIndex();
- /*
- * Create the definitions we need to read the packet headers + contexts
- */
- StructDeclaration packetHeader = getStream().getTrace().getPacketHeader();
- if (packetHeader != null) {
- fTracePacketHeaderDecl = packetHeader;
- } else {
- fTracePacketHeaderDecl = new StructDeclaration(1);
- }
- StructDeclaration packetContextDecl = getStream().getPacketContextDecl();
- if (packetContextDecl != null) {
- fStreamPacketContextDecl = packetContextDecl;
- } else {
- fStreamPacketContextDecl = new StructDeclaration(1);
- }
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the stream the streamInput wrapper is wrapping
- *
- * @return the stream the streamInput wrapper is wrapping
- */
- public CTFStream getStream() {
- return fStream;
- }
-
- /**
- * The common streamInput Index
- *
- * @return the stream input Index
- */
- StreamInputPacketIndex getIndex() {
- return fIndex;
- }
-
- /**
- * Gets the filename of the streamInput file.
- *
- * @return the filename of the streaminput file.
- */
- public String getFilename() {
- String name = fFile.getName();
- if (name == null) {
- throw new IllegalStateException("File cannot have a null name"); //$NON-NLS-1$
- }
- return name;
- }
-
- /**
- * Gets the last read timestamp of a stream. (this is not necessarily the
- * last time in the stream.)
- *
- * @return the last read timestamp
- */
- public long getTimestampEnd() {
- return fTimestampEnd;
- }
-
- /**
- * Sets the last read timestamp of a stream. (this is not necessarily the
- * last time in the stream.)
- *
- * @param timestampEnd
- * the last read timestamp
- */
- public void setTimestampEnd(long timestampEnd) {
- fTimestampEnd = timestampEnd;
- }
-
- /**
- * Useless for streaminputs
- */
- @Override
- public LexicalScope getScopePath() {
- return ILexicalScope.STREAM;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public @Nullable Definition lookupDefinition(@Nullable String lookupPath) {
- /* TODO: lookup in different dynamic scopes is not supported yet. */
- return null;
- }
-
- /**
- * Create the index for this trace file.
- */
- public void setupIndex() {
-
- /*
- * The BitBuffer to extract data from the StreamInput
- */
- BitBuffer bitBuffer = new BitBuffer();
- bitBuffer.setByteOrder(getStream().getTrace().getByteOrder());
-
- }
-
- /**
- * Adds the next packet header index entry to the index of a stream input.
- *
- * <strong>This method is slow and can corrupt data if not used
- * properly</strong>
- *
- * @return true if there are more packets to add
- * @throws CTFException
- * If there was a problem reading the packed header
- */
- public boolean addPacketHeaderIndex() throws CTFException {
- long currentPosBits = 0L;
- if (!fIndex.isEmpty()) {
- ICTFPacketDescriptor pos = fIndex.lastElement();
- if (pos == null) {
- throw new IllegalStateException("Index contains null packet entries"); //$NON-NLS-1$
- }
- currentPosBits = pos.getOffsetBits() + pos.getPacketSizeBits();
- }
- if (currentPosBits < getStreamSizeBits()) {
- fIndex.append(createPacketIndexEntry(currentPosBits));
- return true;
- }
- return false;
- }
-
- private long getStreamSizeBits() {
- return fFile.length() * Byte.SIZE;
- }
-
- private ICTFPacketDescriptor createPacketIndexEntry(long dataOffsetbits)
- throws CTFException {
-
- try (FileChannel fc = FileChannel.open(fFile.toPath(), StandardOpenOption.READ)) {
- if (fc == null) {
- throw new IOException("Failed to create FileChannel"); //$NON-NLS-1$
- }
- BitBuffer bitBuffer = createBitBufferForPacketHeader(fc, dataOffsetbits);
- /*
- * Read the trace packet header if it exists.
- */
- parseTracePacketHeader(bitBuffer);
-
- /*
- * Read the stream packet context if it exists.
- */
- long size = fc.size();
- ICTFPacketDescriptor packetIndex = parsePacketContext(dataOffsetbits, size, bitBuffer);
-
- /* Basic validation */
- if (packetIndex.getContentSizeBits() > packetIndex.getPacketSizeBits()) {
- throw new CTFException("Content size > packet size"); //$NON-NLS-1$
- }
-
- if (packetIndex.getPacketSizeBits() > ((size * Byte.SIZE - packetIndex.getOffsetBits()))) {
- throw new CTFException("Not enough data remaining in the file for the size of this packet"); //$NON-NLS-1$
- }
- return packetIndex;
- } catch (IOException e) {
- throw new CTFException("Failed to create packet index entry", e); //$NON-NLS-1$
- }
- }
-
- private BitBuffer createBitBufferForPacketHeader(FileChannel fc, long dataOffsetbits) throws CTFException, IOException {
- /*
- * create a packet bit buffer to read the packet header
- */
- int maximumSize = fStreamPacketContextDecl.getMaximumSize() + fTracePacketHeaderDecl.getMaximumSize();
- BitBuffer bitBuffer = new BitBuffer(createPacketBitBuffer(fc, dataOffsetbits/Byte.SIZE, maximumSize));
- bitBuffer.setByteOrder(getStream().getTrace().getByteOrder());
- return bitBuffer;
- }
-
- private static ByteBuffer getByteBufferAt(FileChannel fc, long position, long size) throws CTFException, IOException {
- ByteBuffer map = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, position, size);
- if (map == null) {
- throw new CTFException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$
- }
- return map;
- }
-
- private static ByteBuffer createPacketBitBuffer(FileChannel fc,
- long packetOffsetBytes, long maxSize) throws CTFException, IOException {
- /*
- * If there is less data remaining than what we want to map, reduce the
- * map size.
- */
- long remain = fc.size() - packetOffsetBytes;
- /*
- * Initial size, it is the minimum of the the file size and the maximum
- * possible size of the
- */
- long mapSize = Math.min(remain, MAP_SIZE);
- if (maxSize < mapSize) {
- mapSize = maxSize;
- }
-
- /*
- * Map the packet.
- */
- try {
- return getByteBufferAt(fc, packetOffsetBytes, mapSize);
- } catch (IllegalArgumentException | IOException e) {
- throw new CTFException(e);
- }
- }
-
- private StructDefinition parseTracePacketHeader(
- BitBuffer bitBuffer) throws CTFException {
-
- StructDefinition tracePacketHeaderDef = fTracePacketHeaderDecl.createDefinition(fStream.getTrace(), ILexicalScope.TRACE_PACKET_HEADER, bitBuffer);
-
- /*
- * Check the CTF magic number
- */
- IntegerDefinition magicDef = (IntegerDefinition) tracePacketHeaderDef
- .lookupDefinition("magic"); //$NON-NLS-1$
- if (magicDef != null) {
- int magic = (int) magicDef.getValue();
- if (magic != Utils.CTF_MAGIC) {
- throw new CTFException(
- "CTF magic mismatch " + Integer.toHexString(magic) + " vs " + Integer.toHexString(Utils.CTF_MAGIC)); //$NON-NLS-1$//$NON-NLS-2$
- }
- }
-
- /*
- * Check the trace UUID
- */
- AbstractArrayDefinition uuidDef =
- (AbstractArrayDefinition) tracePacketHeaderDef.lookupDefinition("uuid"); //$NON-NLS-1$
- if (uuidDef != null) {
- UUID uuid = Utils.getUUIDfromDefinition(uuidDef);
-
- if (!getStream().getTrace().getUUID().equals(uuid)) {
- throw new CTFException("UUID mismatch"); //$NON-NLS-1$
- }
- }
-
- /*
- * Check that the stream id did not change
- */
- IntegerDefinition streamIDDef = (IntegerDefinition) tracePacketHeaderDef
- .lookupDefinition("stream_id"); //$NON-NLS-1$
- if (streamIDDef != null) {
- long streamID = streamIDDef.getValue();
-
- if (streamID != getStream().getId()) {
- throw new CTFException("Stream ID changing within a StreamInput"); //$NON-NLS-1$
- }
- }
- return tracePacketHeaderDef;
- }
-
- private ICTFPacketDescriptor parsePacketContext(long dataOffsetBits, long fileSizeBytes,
- BitBuffer bitBuffer) throws CTFException {
- ICTFPacketDescriptor packetIndex;
- StructDefinition streamPacketContextDef = fStreamPacketContextDecl.createDefinition(this, ILexicalScope.STREAM_PACKET_CONTEXT, bitBuffer);
- packetIndex = new StreamInputPacketIndexEntry(dataOffsetBits, streamPacketContextDef, fileSizeBytes, fLostSoFar);
- fLostSoFar = packetIndex.getLostEvents() + fLostSoFar;
- setTimestampEnd(packetIndex.getTimestampEnd());
- return packetIndex;
- }
-
- /**
- * Get the file
- *
- * @return the file
- * @since 1.0
- */
- public File getFile() {
- return fFile;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + fFile.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof CTFStreamInput)) {
- return false;
- }
- CTFStreamInput other = (CTFStreamInput) obj;
- if (!fFile.equals(other.fFile)) {
- return false;
- }
- return true;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel.MapMode;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.LostEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.SimpleDatatypeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderDefinition;
-
-/**
- * CTF trace packet reader. Reads the events of a packet of a trace file.
- *
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseable {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final int BITS_PER_BYTE = Byte.SIZE;
-
- /** BitBuffer used to read the trace file. */
- @Nullable
- private BitBuffer fBitBuffer;
-
- /** StreamInputReader that uses this StreamInputPacketReader. */
- private final CTFStreamInputReader fStreamInputReader;
-
- /** Trace packet header. */
- private final StructDeclaration fTracePacketHeaderDecl;
-
- /** Stream packet context definition. */
- private final StructDeclaration fStreamPacketContextDecl;
-
- /** Stream event header definition. */
- private final IDeclaration fStreamEventHeaderDecl;
-
- /** Stream event context definition. */
- private final StructDeclaration fStreamEventContextDecl;
-
- private ICompositeDefinition fCurrentTracePacketHeaderDef;
- private ICompositeDefinition fCurrentStreamEventHeaderDef;
- private ICompositeDefinition fCurrentStreamPacketContextDef;
- /** Reference to the index entry of the current packet. */
- private ICTFPacketDescriptor fCurrentPacket = null;
-
- /**
- * Last timestamp recorded.
- *
- * Needed to calculate the complete timestamp values for the events with
- * compact headers.
- */
- private long fLastTimestamp = 0;
-
- /** CPU id of current packet. */
- private int fCurrentCpu = 0;
-
- private int fLostEventsInThisPacket;
-
- private long fLostEventsDuration;
-
- private boolean fHasLost = false;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a StreamInputPacketReader.
- *
- * @param streamInputReader
- * The StreamInputReader to which this packet reader belongs to.
- */
- public CTFStreamInputPacketReader(CTFStreamInputReader streamInputReader) {
- fStreamInputReader = streamInputReader;
-
- /* Set the BitBuffer's byte order. */
- ByteBuffer allocateDirect = ByteBuffer.allocateDirect(0);
- if (allocateDirect == null) {
- throw new IllegalStateException("Unable to allocate 0 bytes!"); //$NON-NLS-1$
- }
- fBitBuffer = new BitBuffer(allocateDirect);
-
- final CTFStream currentStream = streamInputReader.getStreamInput().getStream();
- fTracePacketHeaderDecl = currentStream.getTrace().getPacketHeader();
- fStreamPacketContextDecl = currentStream.getPacketContextDecl();
- fStreamEventHeaderDecl = currentStream.getEventHeaderDeclaration();
- fStreamEventContextDecl = currentStream.getEventContextDecl();
- }
-
- /**
- * Get the event context defintiion
- *
- * @param input
- * the bitbuffer to read from
- * @return an context definition, can be null
- * @throws CTFException
- * out of bounds exception or such
- */
- public StructDefinition getEventContextDefinition(@NonNull BitBuffer input) throws CTFException {
- return fStreamEventContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_EVENT_CONTEXT, input);
- }
-
- /**
- * Get the packet context defintiion
- *
- * @param input
- * the bitbuffer to read from
- * @return an context definition, can be null
- * @throws CTFException
- * out of bounds exception or such
- */
- public StructDefinition getStreamPacketContextDefinition(@NonNull BitBuffer input) throws CTFException {
- return fStreamPacketContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_PACKET_CONTEXT, input);
- }
-
- /**
- * Get the event header defintiion
- *
- * @param input
- * the bitbuffer to read from
- * @return an header definition, can be null
- * @throws CTFException
- * out of bounds exception or such
- */
- public StructDefinition getTracePacketHeaderDefinition(@NonNull BitBuffer input) throws CTFException {
- return fTracePacketHeaderDecl.createDefinition(fStreamInputReader.getStreamInput().getStream().getTrace(), ILexicalScope.TRACE_PACKET_HEADER, input);
- }
-
- /**
- * Dispose the StreamInputPacketReader
- */
- @Override
- public void close() {
- fBitBuffer = null;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the current packet
- *
- * @return the current packet
- */
- ICTFPacketDescriptor getCurrentPacket() {
- return fCurrentPacket;
- }
-
- /**
- * Gets the CPU (core) number
- *
- * @return the CPU (core) number
- */
- public int getCPU() {
- return fCurrentCpu;
- }
-
- @Override
- public LexicalScope getScopePath() {
- return ILexicalScope.PACKET;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @NonNull
- private ByteBuffer getByteBufferAt(long position, long size) throws CTFException, IOException {
- ByteBuffer map = SafeMappedByteBuffer.map(fStreamInputReader.getFc(), MapMode.READ_ONLY, position, size);
- if (map == null) {
- throw new CTFIOException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$
- }
- return map;
- }
-
- /**
- * Changes the current packet to the given one.
- *
- * @param currentPacket
- * The index entry of the packet to switch to.
- * @throws CTFException
- * If we get an error reading the packet
- * @since 1.0
- */
- public void setCurrentPacket(ICTFPacketDescriptor currentPacket) throws CTFException {
- ICTFPacketDescriptor prevPacket = null;
- fCurrentPacket = currentPacket;
-
- if (fCurrentPacket != null) {
- /*
- * Change the map of the BitBuffer.
- */
- ByteBuffer bb = null;
- try {
- bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE);
- } catch (IOException e) {
- throw new CTFIOException(e.getMessage(), e);
- }
-
- BitBuffer bitBuffer = new BitBuffer(bb);
- fBitBuffer = bitBuffer;
- /*
- * Read trace packet header.
- */
- if (fTracePacketHeaderDecl != null) {
- fCurrentTracePacketHeaderDef = getTracePacketHeaderDefinition(bitBuffer);
- }
-
- /*
- * Read stream packet context.
- */
- if (fStreamPacketContextDecl != null) {
- fCurrentStreamPacketContextDef = getStreamPacketContextDefinition(bitBuffer);
-
- /* Read CPU ID */
- if (getCurrentPacket().getTarget() != null) {
- fCurrentCpu = (int) getCurrentPacket().getTargetId();
- }
-
- /* Read number of lost events */
- fLostEventsInThisPacket = (int) getCurrentPacket().getLostEvents();
- if (fLostEventsInThisPacket != 0) {
- fHasLost = true;
- /*
- * Compute the duration of the lost event time range. If the
- * current packet is the first packet, duration will be set
- * to 1.
- */
- long lostEventsStartTime;
- int index = fStreamInputReader.getStreamInput().getIndex().indexOf(currentPacket);
- if (index == 0) {
- lostEventsStartTime = currentPacket.getTimestampBegin() + 1;
- } else {
- prevPacket = fStreamInputReader.getStreamInput().getIndex().getElement(index - 1);
- lostEventsStartTime = prevPacket.getTimestampEnd();
- }
- fLostEventsDuration = Math.abs(lostEventsStartTime - currentPacket.getTimestampBegin());
- }
- }
-
- /*
- * Use the timestamp begin of the packet as the reference for the
- * timestamp reconstitution.
- */
- fLastTimestamp = currentPacket.getTimestampBegin();
- } else {
- fBitBuffer = null;
- fLastTimestamp = 0;
- }
- }
-
- /**
- * Returns whether it is possible to read any more events from this packet.
- *
- * @return True if it is possible to read any more events from this packet.
- */
- public boolean hasMoreEvents() {
- BitBuffer bitBuffer = fBitBuffer;
- ICTFPacketDescriptor currentPacket = fCurrentPacket;
- if (currentPacket != null && bitBuffer != null) {
- return fHasLost || (bitBuffer.position() < currentPacket.getContentSizeBits());
- }
- return false;
- }
-
- /**
- * Reads the next event of the packet into the right event definition.
- *
- * @return The event definition containing the event data that was just
- * read.
- * @throws CTFException
- * If there was a problem reading the trace
- */
- public EventDefinition readNextEvent() throws CTFException {
- /* Default values for those fields */
- // compromise since we cannot have 64 bit addressing of arrays yet.
- int eventID = (int) IEventDeclaration.UNSET_EVENT_ID;
- long timestamp = 0;
- if (fHasLost) {
- fHasLost = false;
- IEventDeclaration lostEventDeclaration = LostEventDeclaration.INSTANCE;
- StructDeclaration lostFields = lostEventDeclaration.getFields();
- // this is a hard coded map, we know it's not null
- IntegerDeclaration lostFieldsDecl = (IntegerDeclaration) lostFields.getField(CTFStrings.LOST_EVENTS_FIELD);
- if (lostFieldsDecl == null)
- {
- throw new IllegalStateException("Lost events count not declared!"); //$NON-NLS-1$
- }
- IntegerDeclaration lostEventsDurationDecl = (IntegerDeclaration) lostFields.getField(CTFStrings.LOST_EVENTS_DURATION);
- if (lostEventsDurationDecl == null) {
- throw new IllegalStateException("Lost events duration not declared!"); //$NON-NLS-1$
- }
- IntegerDefinition lostDurationDef = new IntegerDefinition(lostFieldsDecl, null, CTFStrings.LOST_EVENTS_DURATION, fLostEventsDuration);
- IntegerDefinition lostCountDef = new IntegerDefinition(lostEventsDurationDecl, null, CTFStrings.LOST_EVENTS_FIELD, fLostEventsInThisPacket);
- IntegerDefinition[] fields = new IntegerDefinition[] { lostCountDef, lostDurationDef };
- return new EventDefinition(
- lostEventDeclaration,
- fStreamInputReader,
- fLastTimestamp,
- null,
- null,
- null,
- new StructDefinition(
- lostFields,
- this, "fields", //$NON-NLS-1$
- fields
- ));
-
- }
-
- final BitBuffer currentBitBuffer = fBitBuffer;
- if (currentBitBuffer == null) {
- return null;
- }
- final long posStart = currentBitBuffer.position();
- /* Read the stream event header. */
- if (fStreamEventHeaderDecl != null) {
- if (fStreamEventHeaderDecl instanceof IEventHeaderDeclaration) {
- fCurrentStreamEventHeaderDef = (ICompositeDefinition) fStreamEventHeaderDecl.createDefinition(null, "", currentBitBuffer); //$NON-NLS-1$
- EventHeaderDefinition ehd = (EventHeaderDefinition) fCurrentStreamEventHeaderDef;
- eventID = ehd.getId();
- timestamp = calculateTimestamp(ehd.getTimestamp(), ehd.getTimestampLength());
- } else {
- fCurrentStreamEventHeaderDef = ((StructDeclaration) fStreamEventHeaderDecl).createDefinition(null, ILexicalScope.EVENT_HEADER, currentBitBuffer);
- StructDefinition StructEventHeaderDef = (StructDefinition) fCurrentStreamEventHeaderDef;
- /* Check for the event id. */
- IDefinition idDef = StructEventHeaderDef.lookupDefinition("id"); //$NON-NLS-1$
- SimpleDatatypeDefinition simpleIdDef = null;
- if (idDef instanceof SimpleDatatypeDefinition) {
- simpleIdDef = ((SimpleDatatypeDefinition) idDef);
- } else if (idDef != null) {
- throw new CTFIOException("Id defintion not an integer, enum or float definiton in event header."); //$NON-NLS-1$
- }
-
- /*
- * Get the timestamp from the event header (may be overridden
- * later on)
- */
- IntegerDefinition timestampDef = StructEventHeaderDef.lookupInteger("timestamp"); //$NON-NLS-1$
-
- /* Check for the variant v. */
- IDefinition variantDef = StructEventHeaderDef.lookupDefinition("v"); //$NON-NLS-1$
- if (variantDef instanceof VariantDefinition) {
-
- /* Get the variant current field */
- StructDefinition variantCurrentField = (StructDefinition) ((VariantDefinition) variantDef).getCurrentField();
-
- /*
- * Try to get the id field in the current field of the
- * variant. If it is present, it overrides the previously
- * read event id.
- */
- IDefinition vIdDef = variantCurrentField.lookupDefinition("id"); //$NON-NLS-1$
- if (vIdDef instanceof IntegerDefinition) {
- simpleIdDef = (SimpleDatatypeDefinition) vIdDef;
- }
-
- /*
- * Get the timestamp. This would overwrite any previous
- * timestamp definition
- */
- timestampDef = variantCurrentField.lookupInteger("timestamp"); //$NON-NLS-1$
- }
- if (simpleIdDef != null) {
- eventID = simpleIdDef.getIntegerValue().intValue();
- }
- if (timestampDef != null) {
- timestamp = calculateTimestamp(timestampDef);
- } // else timestamp remains 0
- }
- }
- /* Get the right event definition using the event id. */
- IEventDeclaration eventDeclaration = fStreamInputReader.getStreamInput().getStream().getEventDeclaration(eventID);
- if (eventDeclaration == null) {
- throw new CTFIOException("Incorrect event id : " + eventID); //$NON-NLS-1$
- }
- EventDefinition eventDef = eventDeclaration.createDefinition(fStreamInputReader, currentBitBuffer, timestamp);
-
- /*
- * Set the event timestamp using the timestamp calculated by
- * updateTimestamp.
- */
-
- if (posStart == currentBitBuffer.position()) {
- throw new CTFIOException("Empty event not allowed, event: " + eventDef.getDeclaration().getName()); //$NON-NLS-1$
- }
-
- return eventDef;
- }
-
- /**
- * Calculates the timestamp value of the event, possibly using the timestamp
- * from the last event.
- *
- * @param timestampDef
- * Integer definition of the timestamp.
- * @return The calculated timestamp value.
- */
- private long calculateTimestamp(IntegerDefinition timestampDef) {
- int len = timestampDef.getDeclaration().getLength();
- final long value = timestampDef.getValue();
-
- return calculateTimestamp(value, len);
- }
-
- private long calculateTimestamp(final long value, int len) {
- long newval;
- long majorasbitmask;
- /*
- * If the timestamp length is 64 bits, it is a full timestamp.
- */
- if (len == Long.SIZE) {
- fLastTimestamp = value;
- return fLastTimestamp;
- }
-
- /*
- * Bit mask to keep / remove all old / new bits.
- */
- majorasbitmask = (1L << len) - 1;
-
- /*
- * If the new value is smaller than the corresponding bits of the last
- * timestamp, we assume an overflow of the compact representation.
- */
- newval = value;
- if (newval < (fLastTimestamp & majorasbitmask)) {
- newval = newval + (1L << len);
- }
-
- /* Keep only the high bits of the old value */
- fLastTimestamp = fLastTimestamp & ~majorasbitmask;
-
- /* Then add the low bits of the new value */
- fLastTimestamp = fLastTimestamp + newval;
-
- return fLastTimestamp;
- }
-
- @Override
- public Definition lookupDefinition(String lookupPath) {
- if (lookupPath.equals(ILexicalScope.STREAM_PACKET_CONTEXT.getPath())) {
- return (Definition) fCurrentStreamPacketContextDef;
- }
- if (lookupPath.equals(ILexicalScope.TRACE_PACKET_HEADER.getPath())) {
- return (Definition) fCurrentTracePacketHeaderDef;
- }
- return null;
- }
-
-
- /**
- * Get stream event header
- *
- * @return the stream event header
- */
- public ICompositeDefinition getStreamEventHeaderDefinition() {
- return fCurrentStreamEventHeaderDef;
- }
-
- /**
- * Get the current packet event header
- *
- * @return the current packet event header
- */
- public StructDefinition getCurrentPacketEventHeader() {
- if (fCurrentTracePacketHeaderDef instanceof StructDefinition) {
- return (StructDefinition) fCurrentTracePacketHeaderDef;
- }
- return null;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-import java.nio.file.StandardOpenOption;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.Activator;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * A CTF trace event reader. Reads the events of a trace file.
- *
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public class CTFStreamInputReader implements AutoCloseable {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The StreamInput we are reading.
- */
- private final @NonNull File fFile;
-
- private final @NonNull CTFStreamInput fStreamInput;
-
- private final FileChannel fFileChannel;
-
- /**
- * The packet reader used to read packets from this trace file.
- */
- private final CTFStreamInputPacketReader fPacketReader;
-
- /**
- * Iterator on the packet index
- */
- private int fPacketIndex;
-
- /**
- * Reference to the current event of this trace file (iow, the last on that
- * was read, the next one to be returned)
- */
- private EventDefinition fCurrentEvent = null;
-
- private int fId;
-
- private CTFTraceReader fParent;
-
- /**
- * Live trace reading
- */
- private boolean fLive = false;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
- /**
- * Constructs a StreamInputReader that reads a StreamInput.
- *
- * @param streamInput
- * The StreamInput to read.
- * @throws CTFException
- * If the file cannot be opened
- */
- public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFException {
- if (streamInput == null) {
- throw new IllegalArgumentException("stream cannot be null"); //$NON-NLS-1$
- }
- fStreamInput = streamInput;
- fFile = fStreamInput.getFile();
- try {
- fFileChannel = FileChannel.open(fFile.toPath(), StandardOpenOption.READ);
- } catch (IOException e) {
- throw new CTFIOException(e);
- }
- fPacketReader = new CTFStreamInputPacketReader(this);
- /*
- * Get the iterator on the packet index.
- */
- fPacketIndex = 0;
- /*
- * Make first packet the current one.
- */
- goToNextPacket();
- }
-
- /**
- * Dispose the StreamInputReader, closes the file channel and its packet
- * reader
- *
- * @throws IOException
- * If an I/O error occurs
- */
- @Override
- public void close() throws IOException {
- fFileChannel.close();
- fPacketReader.close();
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the current event in this stream
- *
- * @return the current event in the stream, null if the stream is
- * finished/empty/malformed
- */
- public EventDefinition getCurrentEvent() {
- return fCurrentEvent;
- }
-
- /**
- * Gets the byte order for a trace
- *
- * @return the trace byte order
- */
- public ByteOrder getByteOrder() {
- return fStreamInput.getStream().getTrace().getByteOrder();
- }
-
- /**
- * Gets the name of the stream (it's an id and a number)
- *
- * @return gets the stream name (it's a number)
- */
- public int getName() {
- return fId;
- }
-
- /**
- * Sets the name of the stream
- *
- * @param name
- * the name of the stream, (it's a number)
- */
- public void setName(int name) {
- fId = name;
- }
-
- /**
- * Gets the CPU of a stream. It's the same as the one in /proc or running
- * the asm CPUID instruction
- *
- * @return The CPU id (a number)
- */
- public int getCPU() {
- return fPacketReader.getCPU();
- }
-
- /**
- * Gets the filename of the stream being read
- *
- * @return The filename of the stream being read
- */
- public String getFilename() {
- return fStreamInput.getFilename();
- }
-
- /*
- * for internal use only
- */
- CTFStreamInput getStreamInput() {
- return fStreamInput;
- }
-
- /**
- * Gets the event definition set for this StreamInput
- *
- * @return Unmodifiable set with the event definitions
- */
- public Iterable<IEventDeclaration> getEventDeclarations() {
- return ImmutableList.copyOf(fStreamInput.getStream().getEventDeclarations());
- }
-
- /**
- * Set the trace to live mode
- *
- * @param live
- * whether the trace is read live or not
- */
- public void setLive(boolean live) {
- fLive = live;
- }
-
- /**
- * Get if the trace is to read live or not
- *
- * @return whether the trace is live or not
- */
- public boolean isLive() {
- return fLive;
- }
-
- /**
- * Get the event context of the stream
- *
- * @return the event context declaration of the stream
- */
- public StructDeclaration getStreamEventContextDecl() {
- return getStreamInput().getStream().getEventContextDecl();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
- /**
- * Reads the next event in the current event variable.
- *
- * @return If an event has been successfully read.
- * @throws CTFException
- * if an error occurs
- */
- public CTFResponse readNextEvent() throws CTFException {
-
- /*
- * Change packet if needed
- */
- if (!fPacketReader.hasMoreEvents()) {
- final ICTFPacketDescriptor prevPacket = fPacketReader
- .getCurrentPacket();
- if (prevPacket != null || fLive) {
- goToNextPacket();
- }
-
- }
-
- /*
- * If an event is available, read it.
- */
- if (fPacketReader.hasMoreEvents()) {
- setCurrentEvent(fPacketReader.readNextEvent());
- return CTFResponse.OK;
- }
- this.setCurrentEvent(null);
- return fLive ? CTFResponse.WAIT : CTFResponse.FINISH;
- }
-
- /**
- * Change the current packet of the packet reader to the next one.
- *
- * @throws CTFException
- * if an error occurs
- */
- private void goToNextPacket() throws CTFException {
- fPacketIndex++;
- // did we already index the packet?
- if (getPacketSize() >= (fPacketIndex + 1)) {
- fPacketReader.setCurrentPacket(getPacket());
- } else {
- // go to the next packet if there is one, index it at the same time
- if (fStreamInput.addPacketHeaderIndex()) {
- fPacketIndex = getPacketSize() - 1;
- fPacketReader.setCurrentPacket(getPacket());
- } else {
- // out of packets
- fPacketReader.setCurrentPacket(null);
- }
- }
- }
-
- /**
- * @return
- */
- private int getPacketSize() {
- return fStreamInput.getIndex().size();
- }
-
- /**
- * Changes the location of the trace file reader so that the current event
- * is the first event with a timestamp greater or equal the given timestamp.
- *
- * @param timestamp
- * The timestamp to seek to.
- * @return The offset compared to the current position
- * @throws CTFException
- * if an error occurs
- */
- public long seek(long timestamp) throws CTFException {
- long offset = 0;
-
- gotoPacket(timestamp);
-
- /*
- * index up to the desired timestamp.
- */
- while ((fPacketReader.getCurrentPacket() != null)
- && (fPacketReader.getCurrentPacket().getTimestampEnd() < timestamp)) {
- try {
- fStreamInput.addPacketHeaderIndex();
- goToNextPacket();
- } catch (CTFException e) {
- // do nothing here
- Activator.log(e.getMessage());
- }
- }
- if (fPacketReader.getCurrentPacket() == null) {
- gotoPacket(timestamp);
- }
-
- /*
- * Advance until either of these conditions are met:
- *
- * - reached the end of the trace file (the given timestamp is after the
- * last event)
- *
- * - found the first event with a timestamp greater or equal the given
- * timestamp.
- */
- readNextEvent();
- boolean done = (this.getCurrentEvent() == null);
- while (!done && (this.getCurrentEvent().getTimestamp() < timestamp)) {
- readNextEvent();
- done = (this.getCurrentEvent() == null);
- offset++;
- }
- return offset;
- }
-
- /**
- * @param timestamp
- * the time to seek
- * @throws CTFException
- * if an error occurs
- */
- private void gotoPacket(long timestamp) throws CTFException {
- fPacketIndex = fStreamInput.getIndex().search(timestamp)
- .previousIndex();
- /*
- * Switch to this packet.
- */
- goToNextPacket();
- }
-
- /**
- * Seeks the last event of a stream and returns it.
- *
- * @throws CTFException
- * if an error occurs
- */
- public void goToLastEvent() throws CTFException {
-
- /*
- * Go to the beginning of the trace
- */
- seek(0);
-
- /*
- * Check that there is at least one event
- */
- if ((fStreamInput.getIndex().isEmpty()) || (!fPacketReader.hasMoreEvents())) {
- /*
- * This means the trace is empty. abort.
- */
- return;
- }
-
- fPacketIndex = fStreamInput.getIndex().size() - 1;
- /*
- * Go to last indexed packet
- */
- fPacketReader.setCurrentPacket(getPacket());
-
- /*
- * Keep going until you cannot
- */
- while (fPacketReader.getCurrentPacket() != null) {
- goToNextPacket();
- }
-
- final int lastPacketIndex = fStreamInput.getIndex().size() - 1;
- /*
- * Go to the last packet that contains events.
- */
- for (int pos = lastPacketIndex; pos > 0; pos--) {
- fPacketIndex = pos;
- fPacketReader.setCurrentPacket(getPacket());
-
- if (fPacketReader.hasMoreEvents()) {
- break;
- }
- }
-
- /*
- * Go until the end of that packet
- */
- EventDefinition prevEvent = null;
- while (fCurrentEvent != null) {
- prevEvent = fCurrentEvent;
- this.readNextEvent();
- }
- /*
- * Go back to the previous event
- */
- this.setCurrentEvent(prevEvent);
- }
-
- /**
- * @return the parent
- */
- public CTFTraceReader getParent() {
- return fParent;
- }
-
- /**
- * @param parent
- * the parent to set
- */
- public void setParent(CTFTraceReader parent) {
- fParent = parent;
- }
-
- /**
- * Sets the current event in a stream input reader
- *
- * @param currentEvent
- * the event to set
- */
- public void setCurrentEvent(EventDefinition currentEvent) {
- fCurrentEvent = currentEvent;
- }
-
- /**
- * @return the packetIndexIt
- */
- private int getPacketIndex() {
- return fPacketIndex;
- }
-
- private ICTFPacketDescriptor getPacket() {
- return fStreamInput.getIndex().getElement(getPacketIndex());
- }
-
- /**
- * Get the file channel wrapped by this reader
- *
- * @return the file channel
- */
- FileChannel getFc() {
- return fFileChannel;
- }
-
- /**
- * @return the packetReader
- */
- public CTFStreamInputPacketReader getPacketReader() {
- return fPacketReader;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + fId;
- result = (prime * result)
- + fFile.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof CTFStreamInputReader)) {
- return false;
- }
- CTFStreamInputReader other = (CTFStreamInputReader) obj;
- if (fId != other.fId) {
- return false;
- }
- return fFile.equals(other.fFile);
- }
-
- @Override
- public String toString() {
- // this helps debugging
- return fId + ' ' + fCurrentEvent.toString();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileChannel.MapMode;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex;
-
-/**
- * A CTF Stream output writer. Reads the packets of a given CTFStreamInput and
- * writes packets that are within a given time range to output stream file.
- *
- * @author Bernd Hufmann
- * @since 1.0
- */
-public class CTFStreamOutputWriter {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
- // Stream input when copying stream from an input
- // It is @Nullable for future implementations that doesn't use an input
- // stream
- @Nullable
- private final CTFStreamInput fStreamInput;
- @NonNull
- private final CTFStreamPacketOutputWriter fStreamPacketOutputWriter;
- @NonNull
- private final File fOutFile;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a StreamInput.
- *
- * @param streamInput
- * The stream to which this StreamInput belongs to.
- * @param file
- * The output trace directory.
- * @throws CTFException
- * If a reading or writing error occurs
- */
- public CTFStreamOutputWriter(@NonNull CTFStreamInput streamInput, @NonNull File file) throws CTFException {
- fStreamInput = streamInput;
- String inFileName = streamInput.getFile().getName();
- Path outFilePath = FileSystems.getDefault().getPath(file.getAbsolutePath(), inFileName);
-
- try {
- fOutFile = checkNotNull(Files.createFile(outFilePath).toFile());
- } catch (IOException e) {
- throw new CTFIOException("Output file can't be created: " + outFilePath, e); //$NON-NLS-1$
- }
-
- fStreamPacketOutputWriter = new CTFStreamPacketOutputWriter();
- }
-
- /**
- * Copies packets from the relevant input this input stream to a
- * corresponding output stream based on a given time range. The following
- * condition has to be met so that a packet is written to the output stream:
- *
- * startTime <= packet.getTimestampBegin() <= endTime
- *
- * @param startTime
- * the start time for packets to be written
- * @param endTime
- * the end time for packets to be written
- * @throws CTFException
- * if a reading or writing error occurs
- * @since 1.0
- */
- public void copyPackets(long startTime, long endTime) throws CTFException {
- CTFStreamInput streamInput = fStreamInput;
- if (streamInput == null) {
- throw new CTFIOException("StreamInput is null. Can't copy packets"); //$NON-NLS-1$
- }
-
- try (FileChannel fc = checkNotNull(FileChannel.open(fOutFile.toPath(), StandardOpenOption.WRITE))) {
- StreamInputPacketIndex index = streamInput.getIndex();
- int count = 0;
- try (FileChannel source = FileChannel.open(streamInput.getFile().toPath(), StandardOpenOption.READ)) {
- for (int i = 0; i < index.size(); i++) {
- ICTFPacketDescriptor entry = index.getElement(i);
- if ((entry.getTimestampBegin() >= startTime) && (entry.getTimestampBegin() <= endTime)) {
- ByteBuffer buffer = SafeMappedByteBuffer.map(source, MapMode.READ_ONLY, entry.getOffsetBytes(), entry.getPacketSizeBits() / Byte.SIZE);
- fStreamPacketOutputWriter.writePacket(buffer, fc);
- count++;
- }
- }
- }
-
- if (count == 0 && fOutFile.exists()) {
- boolean deleteResult = fOutFile.delete();
- if (!deleteResult) {
- throw new CTFIOException("Could not delete " + fOutFile.getAbsolutePath()); //$NON-NLS-1$
- }
- }
- } catch (IOException e) {
- throw new CTFIOException("Error copying packets: " + e.toString(), e); //$NON-NLS-1$
- }
- }
-
- /**
- * Get the stream file to write.
- *
- * @return the stream file to write
- */
- public File getOutFile() {
- return fOutFile;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
-/**
- * CTF trace packet writer.
- *
- * @author Bernd Hufmann
- * @since 1.0
- */
-public class CTFStreamPacketOutputWriter {
-
- /**
- * Writes a stream packet to the output file channel based on the packet
- * descriptor information.
- *
- * @param byteBuffer
- * a byte buffer with packet to write
- * @param fc
- * a file channel
- * @throws IOException
- * if a reading or writing error occurs
- */
- public void writePacket(ByteBuffer byteBuffer, FileChannel fc) throws IOException {
- fc.write(byteBuffer);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Initial API and implementation
- * Simon Delisle - Replace LinkedList by TreeSet in callsitesByName attribute
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.io.Serializable;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileChannel.MapMode;
-import java.nio.file.StandardOpenOption;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-import org.eclipse.tracecompass.ctf.core.event.CTFClock;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.internal.ctf.core.SafeMappedByteBuffer;
-import org.eclipse.tracecompass.internal.ctf.core.event.CTFCallsiteComparator;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
-
-/**
- * A CTF trace on the file system.
- *
- * Represents a trace on the filesystem. It is responsible of parsing the
- * metadata, creating declarations data structures, indexing the event packets
- * (in other words, all the work that can be shared between readers), but the
- * actual reading of events is left to TraceReader.
- *
- * @author Matthew Khouzam
- * @version $Revision: 1.0 $
- */
-public class CTFTrace implements IDefinitionScope {
-
- @Override
- public String toString() {
- /* Only for debugging, shouldn't be externalized */
- return "CTFTrace [path=" + fPath + ", major=" + fMajor + ", minor=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- + fMinor + ", uuid=" + fUuid + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * The trace directory on the filesystem.
- */
- private final File fPath;
-
- /**
- * Major CTF version number
- */
- private Long fMajor;
-
- /**
- * Minor CTF version number
- */
- private Long fMinor;
-
- /**
- * Trace UUID
- */
- private UUID fUuid;
-
- /**
- * Trace byte order
- */
- private ByteOrder fByteOrder;
-
- /**
- * Packet header structure declaration
- */
- private StructDeclaration fPacketHeaderDecl = null;
-
- /**
- * The clock of the trace
- */
- private CTFClock fSingleClock = null;
-
- /**
- * Packet header structure definition
- *
- * This is only used when opening the trace files, to read the first packet
- * header and see if they are valid trace files.
- */
- private StructDefinition fPacketHeaderDef;
-
- /**
- * Collection of streams contained in the trace.
- */
- private final Map<Long, CTFStream> fStreams = new HashMap<>();
-
- /**
- * Collection of environment variables set by the tracer
- */
- private final Map<String, String> fEnvironment = new HashMap<>();
-
- /**
- * Collection of all the clocks in a system.
- */
- private final Map<String, CTFClock> fClocks = new HashMap<>();
-
- /** Handlers for the metadata files */
- private static final FileFilter METADATA_FILE_FILTER = new MetadataFileFilter();
- private static final Comparator<File> METADATA_COMPARATOR = new MetadataComparator();
-
- /** Callsite helpers */
- private CTFCallsiteComparator fCtfCallsiteComparator = new CTFCallsiteComparator();
-
- private Map<String, TreeSet<CTFCallsite>> fCallsitesByName = new HashMap<>();
-
- /** Callsite helpers */
- private TreeSet<CTFCallsite> fCallsitesByIP = new TreeSet<>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Trace constructor.
- *
- * @param path
- * Filesystem path of the trace directory
- * @throws CTFException
- * If no CTF trace was found at the path
- */
- public CTFTrace(String path) throws CTFException {
- this(new File(path));
- }
-
- /**
- * Trace constructor.
- *
- * @param path
- * Filesystem path of the trace directory.
- * @throws CTFException
- * If no CTF trace was found at the path
- */
- public CTFTrace(File path) throws CTFException {
- fPath = path;
- final Metadata metadata = new Metadata(this);
-
- /* Set up the internal containers for this trace */
- if (!fPath.exists()) {
- throw new CTFException("Trace (" + path.getPath() + ") doesn't exist. Deleted or moved?"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- if (!fPath.isDirectory()) {
- throw new CTFException("Path must be a valid directory"); //$NON-NLS-1$
- }
-
- /* Open and parse the metadata file */
- metadata.parseFile();
-
- init(path);
- }
-
- /**
- * Streamed constructor
- */
- public CTFTrace() {
- fPath = null;
- }
-
- private void init(File path) throws CTFException {
-
- /* Open all the trace files */
-
- /* List files not called metadata and not hidden. */
- File[] files = path.listFiles(METADATA_FILE_FILTER);
- Arrays.sort(files, METADATA_COMPARATOR);
-
- /* Try to open each file */
- for (File streamFile : files) {
- openStreamInput(streamFile);
- }
-
- /* Create their index */
- for (CTFStream stream : getStreams()) {
- Set<CTFStreamInput> inputs = stream.getStreamInputs();
- for (CTFStreamInput s : inputs) {
- addStream(s);
- }
- }
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets an event declaration list for a given streamID
- *
- * @param streamId
- * The ID of the stream from which to read
- * @return The list of event declarations
- */
- public Collection<IEventDeclaration> getEventDeclarations(Long streamId) {
- return fStreams.get(streamId).getEventDeclarations();
- }
-
- /**
- * Method getStream gets the stream for a given id
- *
- * @param id
- * Long the id of the stream
- * @return Stream the stream that we need
- */
- public CTFStream getStream(Long id) {
- if (id == null) {
- return fStreams.get(0L);
- }
- return fStreams.get(id);
- }
-
- /**
- * Method nbStreams gets the number of available streams
- *
- * @return int the number of streams
- */
- public int nbStreams() {
- return fStreams.size();
- }
-
- /**
- * Method setMajor sets the major version of the trace (DO NOT USE)
- *
- * @param major
- * long the major version
- */
- public void setMajor(long major) {
- fMajor = major;
- }
-
- /**
- * Method setMinor sets the minor version of the trace (DO NOT USE)
- *
- * @param minor
- * long the minor version
- */
- public void setMinor(long minor) {
- fMinor = minor;
- }
-
- /**
- * Method setUUID sets the UUID of a trace
- *
- * @param uuid
- * UUID
- */
- public void setUUID(UUID uuid) {
- fUuid = uuid;
- }
-
- /**
- * Method setByteOrder sets the byte order
- *
- * @param byteOrder
- * ByteOrder of the trace, can be little-endian or big-endian
- */
- public void setByteOrder(ByteOrder byteOrder) {
- fByteOrder = byteOrder;
- }
-
- /**
- * Method setPacketHeader sets the packet header of a trace (DO NOT USE)
- *
- * @param packetHeader
- * StructDeclaration the header in structdeclaration form
- */
- public void setPacketHeader(StructDeclaration packetHeader) {
- fPacketHeaderDecl = packetHeader;
- }
-
- /**
- * Method majorIsSet is the major version number set?
- *
- * @return boolean is the major set?
- */
- public boolean majorIsSet() {
- return fMajor != null;
- }
-
- /**
- * Method minorIsSet. is the minor version number set?
- *
- * @return boolean is the minor set?
- */
- public boolean minorIsSet() {
- return fMinor != null;
- }
-
- /**
- * Method UUIDIsSet is the UUID set?
- *
- * @return boolean is the UUID set?
- */
- public boolean uuidIsSet() {
- return fUuid != null;
- }
-
- /**
- * Method byteOrderIsSet is the byteorder set?
- *
- * @return boolean is the byteorder set?
- */
- public boolean byteOrderIsSet() {
- return fByteOrder != null;
- }
-
- /**
- * Method packetHeaderIsSet is the packet header set?
- *
- * @return boolean is the packet header set?
- */
- public boolean packetHeaderIsSet() {
- return fPacketHeaderDecl != null;
- }
-
- /**
- * Method getUUID gets the trace UUID
- *
- * @return UUID gets the trace UUID
- */
- public UUID getUUID() {
- return fUuid;
- }
-
- /**
- * Method getMajor gets the trace major version
- *
- * @return long gets the trace major version
- */
- public long getMajor() {
- return fMajor;
- }
-
- /**
- * Method getMinor gets the trace minor version
- *
- * @return long gets the trace minor version
- */
- public long getMinor() {
- return fMinor;
- }
-
- /**
- * Method getByteOrder gets the trace byte order
- *
- * @return ByteOrder gets the trace byte order
- */
- public final ByteOrder getByteOrder() {
- return fByteOrder;
- }
-
- /**
- * Method getPacketHeader gets the trace packet header
- *
- * @return StructDeclaration gets the trace packet header
- */
- public StructDeclaration getPacketHeader() {
- return fPacketHeaderDecl;
- }
-
- /**
- * Method getTraceDirectory gets the trace directory
- *
- * @return File the path in "File" format.
- */
- public File getTraceDirectory() {
- return fPath;
- }
-
- /**
- * Get all the streams as an iterable.
- *
- * @return Iterable<Stream> an iterable over streams.
- */
- public Iterable<CTFStream> getStreams() {
- return fStreams.values();
- }
-
- /**
- * Method getPath gets the path of the trace directory
- *
- * @return String the path of the trace directory, in string format.
- * @see java.io.File#getPath()
- */
- public String getPath() {
- return (fPath != null) ? fPath.getPath() : ""; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- private void addStream(CTFStreamInput s) {
-
- /*
- * add the stream
- */
- CTFStream stream = s.getStream();
- fStreams.put(stream.getId(), stream);
-
- /*
- * index the trace
- */
- s.setupIndex();
- }
-
- /**
- * Tries to open the given file, reads the first packet header of the file
- * and check its validity. This will add a file to a stream as a streaminput
- *
- * @param streamFile
- * A trace file in the trace directory.
- * @param index
- * Which index in the class' streamFileChannel array this file
- * must use
- * @throws CTFException
- * if there is a file error
- */
- private CTFStream openStreamInput(File streamFile) throws CTFException {
- ByteBuffer byteBuffer;
- BitBuffer streamBitBuffer;
- CTFStream stream;
-
- if (!streamFile.canRead()) {
- throw new CTFException("Unreadable file : " //$NON-NLS-1$
- + streamFile.getPath());
- }
-
- try (FileChannel fc = FileChannel.open(streamFile.toPath(), StandardOpenOption.READ)) {
- /* Map one memory page of 4 kiB */
- byteBuffer = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, 0, (int) Math.min(fc.size(), 4096L));
- if (byteBuffer == null) {
- throw new IllegalStateException("Failed to allocate memory"); //$NON-NLS-1$
- }
- /* Create a BitBuffer with this mapping and the trace byte order */
- streamBitBuffer = new BitBuffer(byteBuffer, this.getByteOrder());
-
- if (fPacketHeaderDecl != null) {
- /* Read the packet header */
- fPacketHeaderDef = fPacketHeaderDecl.createDefinition(this, ILexicalScope.PACKET_HEADER, streamBitBuffer);
- }
- } catch (IOException e) {
- /* Shouldn't happen at this stage if every other check passed */
- throw new CTFException(e);
- }
- if (fPacketHeaderDef != null) {
- validateMagicNumber(fPacketHeaderDef);
-
- validateUUID(fPacketHeaderDef);
-
- /* Read the stream ID */
- IDefinition streamIDDef = fPacketHeaderDef.lookupDefinition("stream_id"); //$NON-NLS-1$
-
- if (streamIDDef instanceof IntegerDefinition) {
- /* This doubles as a null check */
- long streamID = ((IntegerDefinition) streamIDDef).getValue();
- stream = fStreams.get(streamID);
- } else {
- /* No stream_id in the packet header */
- stream = getStream(null);
- }
-
- } else {
- /* No packet header, we suppose there is only one stream */
- stream = getStream(null);
- }
-
- if (stream == null) {
- throw new CTFException("Unexpected end of stream"); //$NON-NLS-1$
- }
-
- /*
- * Create the stream input and add a reference to the streamInput in the
- * stream.
- */
- stream.addInput(new CTFStreamInput(stream, streamFile));
-
- return stream;
- }
-
- private void validateUUID(StructDefinition packetHeaderDef) throws CTFException {
- IDefinition lookupDefinition = packetHeaderDef.lookupDefinition("uuid"); //$NON-NLS-1$
- AbstractArrayDefinition uuidDef = (AbstractArrayDefinition) lookupDefinition;
- if (uuidDef != null) {
- UUID otheruuid = Utils.getUUIDfromDefinition(uuidDef);
- if (!fUuid.equals(otheruuid)) {
- throw new CTFException("UUID mismatch"); //$NON-NLS-1$
- }
- }
- }
-
- private static void validateMagicNumber(StructDefinition packetHeaderDef) throws CTFException {
- IntegerDefinition magicDef = (IntegerDefinition) packetHeaderDef.lookupDefinition(CTFStrings.MAGIC);
- if (magicDef != null) {
- int magic = (int) magicDef.getValue();
- if (magic != Utils.CTF_MAGIC) {
- throw new CTFException("CTF magic mismatch"); //$NON-NLS-1$
- }
- }
- }
-
- // ------------------------------------------------------------------------
- // IDefinitionScope
- // ------------------------------------------------------------------------
-
- /**
- * @since 1.0
- */
- @Override
- public ILexicalScope getScopePath() {
- return ILexicalScope.TRACE;
- }
-
- /**
- * Looks up a definition from packet
- *
- * @param lookupPath
- * String
- * @return Definition
- * @see org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope#lookupDefinition(String)
- */
- @Override
- public Definition lookupDefinition(String lookupPath) {
- if (lookupPath.equals(ILexicalScope.TRACE_PACKET_HEADER.getPath())) {
- return fPacketHeaderDef;
- }
- return null;
- }
-
- // ------------------------------------------------------------------------
- // Live trace reading
- // ------------------------------------------------------------------------
-
- /**
- * Add a new stream file to support new streams while the trace is being
- * read.
- *
- * @param streamFile
- * the file of the stream
- * @throws CTFException
- * A stream had an issue being read
- */
- public void addStreamFile(File streamFile) throws CTFException {
- openStreamInput(streamFile);
- }
-
- /**
- * Registers a new stream to the trace.
- *
- * @param stream
- * A stream object.
- * @throws ParseException
- * If there was some problem reading the metadata
- */
- public void addStream(CTFStream stream) throws ParseException {
- /*
- * If there is already a stream without id (the null key), it must be
- * the only one
- */
- if (fStreams.get(null) != null) {
- throw new ParseException("Stream without id with multiple streams"); //$NON-NLS-1$
- }
-
- /*
- * If the stream we try to add has no key set, it must be the only one.
- * Thus, if the streams container is not empty, it is not valid.
- */
- if ((!stream.isIdSet()) && (!fStreams.isEmpty())) {
- throw new ParseException("Stream without id with multiple streams"); //$NON-NLS-1$
- }
-
- /*
- * If a stream with the same ID already exists, it is not valid.
- */
- CTFStream existingStream = fStreams.get(stream.getId());
- if (existingStream != null) {
- throw new ParseException("Stream id already exists"); //$NON-NLS-1$
- }
-
- /* This stream is valid and has a unique id. */
- fStreams.put(stream.getId(), stream);
- }
-
- /**
- * Gets the Environment variables from the trace metadata (See CTF spec)
- *
- * @return The environment variables in the form of an unmodifiable map
- * (key, value)
- */
- public Map<String, String> getEnvironment() {
- return Collections.unmodifiableMap(fEnvironment);
- }
-
- /**
- * Add a variable to the environment variables
- *
- * @param varName
- * the name of the variable
- * @param varValue
- * the value of the variable
- */
- public void addEnvironmentVar(String varName, String varValue) {
- fEnvironment.put(varName, varValue);
- }
-
- /**
- * Add a clock to the clock list
- *
- * @param nameValue
- * the name of the clock (full name with scope)
- * @param ctfClock
- * the clock
- */
- public void addClock(String nameValue, CTFClock ctfClock) {
- fClocks.put(nameValue, ctfClock);
- }
-
- /**
- * gets the clock with a specific name
- *
- * @param name
- * the name of the clock.
- * @return the clock
- */
- public CTFClock getClock(String name) {
- return fClocks.get(name);
- }
-
- /**
- * gets the clock if there is only one. (this is 100% of the use cases as of
- * June 2012)
- *
- * @return the clock
- */
- public final CTFClock getClock() {
- if (fSingleClock != null && fClocks.size() == 1) {
- return fSingleClock;
- }
- if (fClocks.size() == 1) {
- fSingleClock = fClocks.get(fClocks.keySet().iterator().next());
- return fSingleClock;
- }
- return null;
- }
-
- /**
- * gets the time offset of a clock with respect to UTC in nanoseconds
- *
- * @return the time offset of a clock with respect to UTC in nanoseconds
- */
- public final long getOffset() {
- if (getClock() == null) {
- return 0;
- }
- return fSingleClock.getClockOffset();
- }
-
- /**
- * gets the time offset of a clock with respect to UTC in nanoseconds
- *
- * @return the time offset of a clock with respect to UTC in nanoseconds
- */
- private double getTimeScale() {
- if (getClock() == null) {
- return 1.0;
- }
- return fSingleClock.getClockScale();
- }
-
- /**
- * Gets the current first packet start time
- *
- * @return the current start time
- */
- public long getCurrentStartTime() {
- long currentStart = Long.MAX_VALUE;
- for (CTFStream stream : fStreams.values()) {
- for (CTFStreamInput si : stream.getStreamInputs()) {
- currentStart = Math.min(currentStart, si.getIndex().getElement(0).getTimestampBegin());
- }
- }
- return timestampCyclesToNanos(currentStart);
- }
-
- /**
- * Gets the current last packet end time
- *
- * @return the current end time
- */
- public long getCurrentEndTime() {
- long currentEnd = Long.MIN_VALUE;
- for (CTFStream stream : fStreams.values()) {
- for (CTFStreamInput si : stream.getStreamInputs()) {
- currentEnd = Math.max(currentEnd, si.getTimestampEnd());
- }
- }
- return timestampCyclesToNanos(currentEnd);
- }
-
- /**
- * Does the trace need to time scale?
- *
- * @return if the trace is in ns or cycles.
- */
- private boolean clockNeedsScale() {
- if (getClock() == null) {
- return false;
- }
- return fSingleClock.isClockScaled();
- }
-
- /**
- * the inverse clock for returning to a scale.
- *
- * @return 1.0 / scale
- */
- private double getInverseTimeScale() {
- if (getClock() == null) {
- return 1.0;
- }
- return fSingleClock.getClockAntiScale();
- }
-
- /**
- * @param cycles
- * clock cycles since boot
- * @return time in nanoseconds UTC offset
- */
- public long timestampCyclesToNanos(long cycles) {
- long retVal = cycles + getOffset();
- /*
- * this fix is since quite often the offset will be > than 53 bits and
- * therefore the conversion will be lossy
- */
- if (clockNeedsScale()) {
- retVal = (long) (retVal * getTimeScale());
- }
- return retVal;
- }
-
- /**
- * @param nanos
- * time in nanoseconds UTC offset
- * @return clock cycles since boot.
- */
- public long timestampNanoToCycles(long nanos) {
- long retVal;
- /*
- * this fix is since quite often the offset will be > than 53 bits and
- * therefore the conversion will be lossy
- */
- if (clockNeedsScale()) {
- retVal = (long) (nanos * getInverseTimeScale());
- } else {
- retVal = nanos;
- }
- return retVal - getOffset();
- }
-
- /**
- * Adds a callsite
- *
- * @param eventName
- * the event name of the callsite
- * @param funcName
- * the name of the callsite function
- * @param ip
- * the ip of the callsite
- * @param fileName
- * the filename of the callsite
- * @param lineNumber
- * the line number of the callsite
- */
- public void addCallsite(String eventName, String funcName, long ip,
- String fileName, long lineNumber) {
- final CTFCallsite cs = new CTFCallsite(eventName, funcName, ip,
- fileName, lineNumber);
- TreeSet<CTFCallsite> csl = fCallsitesByName.get(eventName);
- if (csl == null) {
- csl = new TreeSet<>(fCtfCallsiteComparator);
- fCallsitesByName.put(eventName, csl);
- }
-
- csl.add(cs);
-
- fCallsitesByIP.add(cs);
- }
-
- /**
- * Gets the set of callsites associated to an event name. O(1)
- *
- * @param eventName
- * the event name
- * @return the callsite set can be empty
- */
- public TreeSet<CTFCallsite> getCallsiteCandidates(String eventName) {
- TreeSet<CTFCallsite> retVal = fCallsitesByName.get(eventName);
- if (retVal == null) {
- retVal = new TreeSet<>(fCtfCallsiteComparator);
- }
- return retVal;
- }
-
- /**
- * The I'm feeling lucky of getCallsiteCandidates O(1)
- *
- * @param eventName
- * the event name
- * @return the first callsite that has that event name, can be null
- */
- public CTFCallsite getCallsite(String eventName) {
- TreeSet<CTFCallsite> callsites = fCallsitesByName.get(eventName);
- if (callsites != null) {
- return callsites.first();
- }
- return null;
- }
-
- /**
- * Gets a callsite from the instruction pointer O(log(n))
- *
- * @param ip
- * the instruction pointer to lookup
- * @return the callsite just before that IP in the list remember the IP is
- * backwards on X86, can be null if no callsite is before the IP.
- */
- public CTFCallsite getCallsite(long ip) {
- CTFCallsite cs = new CTFCallsite(null, null, ip, null, 0L);
- return fCallsitesByIP.ceiling(cs);
- }
-
- /**
- * Gets a callsite using the event name and instruction pointer O(log(n))
- *
- * @param eventName
- * the name of the event
- * @param ip
- * the instruction pointer
- * @return the closest matching callsite, can be null
- */
- public CTFCallsite getCallsite(String eventName, long ip) {
- final TreeSet<CTFCallsite> candidates = fCallsitesByName.get(eventName);
- if (candidates == null) {
- return null;
- }
- final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1);
- final CTFCallsite callsite = candidates.ceiling(dummyCs);
- if (callsite == null) {
- return candidates.floor(dummyCs);
- }
- return callsite;
- }
-
- /**
- * Add a new stream
- *
- * @param id
- * the ID of the stream
- * @param streamFile
- * new file in the stream
- * @throws CTFException
- * The file must exist
- */
- public void addStream(long id, File streamFile) throws CTFException {
- CTFStream stream = null;
- final File file = streamFile;
- if (file == null) {
- throw new CTFException("cannot create a stream with no file"); //$NON-NLS-1$
- }
- if (fStreams.containsKey(id)) {
- stream = fStreams.get(id);
- } else {
- stream = new CTFStream(this);
- fStreams.put(id, stream);
- }
- stream.addInput(new CTFStreamInput(stream, file));
- }
-}
-
-class MetadataFileFilter implements FileFilter {
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isDirectory()) {
- return false;
- }
- if (pathname.isHidden()) {
- return false;
- }
- if (pathname.getName().equals("metadata")) { //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
-}
-
-class MetadataComparator implements Comparator<File>, Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public int compare(File o1, File o2) {
- return o1.getName().compareTo(o2.getName());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.PriorityQueue;
-import java.util.Set;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.Activator;
-import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputReaderTimestampComparator;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-
-/**
- * A CTF trace reader. Reads the events of a trace.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Alexandre Montplaisir
- */
-public class CTFTraceReader implements AutoCloseable {
-
- private static final int LINE_LENGTH = 60;
-
- private static final int MIN_PRIO_SIZE = 16;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The trace to read from.
- */
- private final CTFTrace fTrace;
-
- /**
- * Vector of all the trace file readers.
- */
- private final List<CTFStreamInputReader> fStreamInputReaders =
- Collections.synchronizedList(new ArrayList<CTFStreamInputReader>());
-
- /**
- * Priority queue to order the trace file readers by timestamp.
- */
- private PriorityQueue<CTFStreamInputReader> fPrio;
-
- /**
- * Array to count the number of event per trace file.
- */
- private long[] fEventCountPerTraceFile;
-
- /**
- * Timestamp of the first event in the trace
- */
- private long fStartTime;
-
- /**
- * Timestamp of the last event read so far
- */
- private long fEndTime;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a TraceReader to read a trace.
- *
- * @param trace
- * The trace to read from.
- * @throws CTFException
- * if an error occurs
- */
- public CTFTraceReader(CTFTrace trace) throws CTFException {
- fTrace = trace;
- fStreamInputReaders.clear();
-
- /**
- * Create the trace file readers.
- */
- createStreamInputReaders();
-
- /**
- * Populate the timestamp-based priority queue.
- */
- populateStreamInputReaderHeap();
-
- /**
- * Get the start Time of this trace bear in mind that the trace could be
- * empty.
- */
- fStartTime = 0;
- if (hasMoreEvents()) {
- fStartTime = getTopStream().getCurrentEvent().getTimestamp();
- setEndTime(fStartTime);
- }
- }
-
- /**
- * Copy constructor
- *
- * @return The new CTFTraceReader
- * @throws CTFException
- * if an error occurs
- */
- public CTFTraceReader copyFrom() throws CTFException {
- CTFTraceReader newReader = null;
-
- newReader = new CTFTraceReader(fTrace);
- newReader.fStartTime = fStartTime;
- newReader.setEndTime(fEndTime);
- return newReader;
- }
-
- /**
- * Dispose the CTFTraceReader
- */
- @Override
- public void close() {
- synchronized (fStreamInputReaders) {
- for (CTFStreamInputReader reader : fStreamInputReaders) {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- Activator.logError(e.getMessage(), e);
- }
- }
- }
- fStreamInputReaders.clear();
- }
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Return the start time of this trace (== timestamp of the first event)
- *
- * @return the trace start time
- */
- public long getStartTime() {
- return fStartTime;
- }
-
- /**
- * Set the trace's end time
- *
- * @param endTime
- * The end time to use
- */
- protected final void setEndTime(long endTime) {
- fEndTime = endTime;
- }
-
- /**
- * Get the priority queue of this trace reader.
- *
- * @return The priority queue of input readers
- */
- protected PriorityQueue<CTFStreamInputReader> getPrio() {
- return fPrio;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Creates one trace file reader per trace file contained in the trace.
- *
- * @throws CTFException
- * if an error occurs
- */
- private void createStreamInputReaders() throws CTFException {
- /*
- * For each stream.
- */
- for (CTFStream stream : fTrace.getStreams()) {
- Set<CTFStreamInput> streamInputs = stream.getStreamInputs();
-
- /*
- * For each trace file of the stream.
- */
- for (CTFStreamInput streamInput : streamInputs) {
-
- /*
- * Create a reader and add it to the group.
- */
- fStreamInputReaders.add(new CTFStreamInputReader(streamInput));
- }
- }
-
- /*
- * Create the array to count the number of event per trace file.
- */
- fEventCountPerTraceFile = new long[fStreamInputReaders.size()];
- }
-
- /**
- * Update the priority queue to make it match the parent trace
- *
- * @throws CTFException
- * An error occured
- */
- public void update() throws CTFException {
- Set<CTFStreamInputReader> readers = new HashSet<>();
- for (CTFStream stream : fTrace.getStreams()) {
- Set<CTFStreamInput> streamInputs = stream.getStreamInputs();
- for (CTFStreamInput streamInput : streamInputs) {
- /*
- * Create a reader.
- */
- CTFStreamInputReader streamInputReader = new CTFStreamInputReader(
- streamInput);
-
- /*
- * Add it to the group.
- */
- if (!fStreamInputReaders.contains(streamInputReader)) {
- streamInputReader.readNextEvent();
- fStreamInputReaders.add(streamInputReader);
- readers.add(streamInputReader);
- }
- }
- }
- long[] temp = fEventCountPerTraceFile;
- fEventCountPerTraceFile = new long[readers.size() + temp.length];
- for (CTFStreamInputReader reader : readers) {
- fPrio.add(reader);
- }
- for (int i = 0; i < temp.length; i++) {
- fEventCountPerTraceFile[i] = temp[i];
- }
- }
-
- /**
- * Gets an iterable of the stream input readers, useful for foreaches
- *
- * @return the iterable of the stream input readers
- */
- public Iterable<IEventDeclaration> getEventDeclarations() {
- ImmutableSet.Builder<IEventDeclaration> builder = new Builder<>();
- for (CTFStreamInputReader sir : fStreamInputReaders) {
- builder.addAll(sir.getEventDeclarations());
- }
- return builder.build();
- }
-
- /**
- * Initializes the priority queue used to choose the trace file with the
- * lower next event timestamp.
- *
- * @throws CTFException
- * if an error occurs
- */
- private void populateStreamInputReaderHeap() throws CTFException {
- if (fStreamInputReaders.isEmpty()) {
- fPrio = new PriorityQueue<>(MIN_PRIO_SIZE,
- new StreamInputReaderTimestampComparator());
- return;
- }
-
- /*
- * Create the priority queue with a size twice as bigger as the number
- * of reader in order to avoid constant resizing.
- */
- fPrio = new PriorityQueue<>(
- Math.max(fStreamInputReaders.size() * 2, MIN_PRIO_SIZE),
- new StreamInputReaderTimestampComparator());
-
- int pos = 0;
-
- for (CTFStreamInputReader reader : fStreamInputReaders) {
- /*
- * Add each trace file reader in the priority queue, if we are able
- * to read an event from it.
- */
- reader.setParent(this);
- CTFResponse readNextEvent = reader.readNextEvent();
- if (readNextEvent == CTFResponse.OK || readNextEvent == CTFResponse.WAIT) {
- fPrio.add(reader);
-
- fEventCountPerTraceFile[pos] = 0;
- reader.setName(pos);
-
- pos++;
- }
- }
- }
-
- /**
- * Get the current event, which is the current event of the trace file
- * reader with the lowest timestamp.
- *
- * @return An event definition, or null of the trace reader reached the end
- * of the trace.
- */
- public EventDefinition getCurrentEventDef() {
- CTFStreamInputReader top = getTopStream();
- return (top != null) ? top.getCurrentEvent() : null;
- }
-
- /**
- * Go to the next event.
- *
- * @return True if an event was read.
- * @throws CTFException
- * if an error occurs
- */
- public boolean advance() throws CTFException {
- /*
- * Remove the reader from the top of the priority queue.
- */
- CTFStreamInputReader top = fPrio.poll();
-
- /*
- * If the queue was empty.
- */
- if (top == null) {
- return false;
- }
- /*
- * Read the next event of this reader.
- */
- switch (top.readNextEvent()) {
- case OK: {
- /*
- * Add it back in the queue.
- */
- fPrio.add(top);
- final long topEnd = fTrace.timestampCyclesToNanos(top.getCurrentEvent().getTimestamp());
- setEndTime(Math.max(topEnd, getEndTime()));
- fEventCountPerTraceFile[top.getName()]++;
-
- if (top.getCurrentEvent() != null) {
- fEndTime = Math.max(top.getCurrentEvent().getTimestamp(),
- fEndTime);
- }
- break;
- }
- case WAIT: {
- fPrio.add(top);
- break;
- }
- case FINISH:
- break;
- case ERROR:
- default:
- // something bad happend
- }
- /*
- * If there is no reader in the queue, it means the trace reader reached
- * the end of the trace.
- */
- return hasMoreEvents();
- }
-
- /**
- * Go to the last event in the trace.
- *
- * @throws CTFException
- * if an error occurs
- */
- public void goToLastEvent() throws CTFException {
- seek(getEndTime());
- while (fPrio.size() > 1) {
- advance();
- }
- }
-
- /**
- * Seeks to a given timestamp. It will seek to the nearest event greater or
- * equal to timestamp. If a trace is [10 20 30 40] and you are looking for
- * 19, it will give you 20. If you want 20, you will get 20, if you want 21,
- * you will get 30. The value -inf will seek to the first element and the
- * value +inf will seek to the end of the file (past the last event).
- *
- * @param timestamp
- * the timestamp to seek to
- * @return true if there are events above or equal the seek timestamp, false
- * if seek at the end of the trace (no valid event).
- * @throws CTFException
- * if an error occurs
- */
- public boolean seek(long timestamp) throws CTFException {
- /*
- * Remove all the trace readers from the priority queue
- */
- fPrio.clear();
- for (CTFStreamInputReader streamInputReader : fStreamInputReaders) {
- /*
- * Seek the trace reader.
- */
- streamInputReader.seek(timestamp);
-
- /*
- * Add it to the priority queue if there is a current event.
- */
- if (streamInputReader.getCurrentEvent() != null) {
- fPrio.add(streamInputReader);
- }
- }
- return hasMoreEvents();
- }
-
- /**
- * Gets the stream with the oldest event
- *
- * @return the stream with the oldest event
- */
- public CTFStreamInputReader getTopStream() {
- return fPrio.peek();
- }
-
- /**
- * Does the trace have more events?
- *
- * @return true if yes.
- */
- public final boolean hasMoreEvents() {
- return fPrio.size() > 0;
- }
-
- /**
- * Prints the event count stats.
- */
- public void printStats() {
- printStats(LINE_LENGTH);
- }
-
- /**
- * Prints the event count stats.
- *
- * @param width
- * Width of the display.
- */
- public void printStats(int width) {
- int numEvents = 0;
- if (width == 0) {
- return;
- }
-
- for (long i : fEventCountPerTraceFile) {
- numEvents += i;
- }
-
- for (int j = 0; j < fEventCountPerTraceFile.length; j++) {
- CTFStreamInputReader se = fStreamInputReaders.get(j);
-
- long len = (width * fEventCountPerTraceFile[se.getName()])
- / numEvents;
-
- StringBuilder sb = new StringBuilder(se.getFilename());
- sb.append("\t["); //$NON-NLS-1$
-
- for (int i = 0; i < len; i++) {
- sb.append('+');
- }
-
- for (long i = len; i < width; i++) {
- sb.append(' ');
- }
-
- sb.append("]\t" + fEventCountPerTraceFile[se.getName()] + " Events"); //$NON-NLS-1$//$NON-NLS-2$
- Activator.log(sb.toString());
- }
- }
-
- /**
- * Gets the last event timestamp that was read. This is NOT necessarily the
- * last event in a trace, just the last one read so far.
- *
- * @return the last event
- */
- public long getEndTime() {
- return fEndTime;
- }
-
- /**
- * Sets a trace to be live or not
- *
- * @param live
- * whether the trace is live
- */
- public void setLive(boolean live) {
- for (CTFStreamInputReader s : fPrio) {
- s.setLive(live);
- }
- }
-
- /**
- * Get if the trace is to read live or not
- *
- * @return whether the trace is live or not
- */
- public boolean isLive() {
- return getTopStream().isLive();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + (int) (fStartTime ^ (fStartTime >>> 32));
- result = (prime * result) + fStreamInputReaders.hashCode();
- result = (prime * result) + ((fTrace == null) ? 0 : fTrace.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof CTFTraceReader)) {
- return false;
- }
- CTFTraceReader other = (CTFTraceReader) obj;
- if (!fStreamInputReaders.equals(other.fStreamInputReaders)) {
- return false;
- }
- if (fTrace == null) {
- if (other.fTrace != null) {
- return false;
- }
- } else if (!fTrace.equals(other.fTrace)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- /* Only for debugging, shouldn't be externalized */
- return "CTFTraceReader [trace=" + fTrace + ']'; //$NON-NLS-1$
- }
-
- /**
- * Gets the parent trace
- *
- * @return the parent trace
- */
- public CTFTrace getTrace() {
- return fTrace;
- }
-
- /**
- * This will read the entire trace and populate all the indexes. The reader
- * will then be reset to the first event in the trace.
- *
- * Do not call in the fast path.
- *
- * @throws CTFException
- * A trace reading error occurred
- * @since 1.0
- */
- public void populateIndex() throws CTFException {
- for (CTFStreamInputReader sir : fPrio) {
- sir.goToLastEvent();
- }
- seek(0);
-
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-
-/**
- * A CTF trace reader. Reads the events of a trace.
- *
- * @author Bernd Hufmann
- * @since 1.0
- */
-public class CTFTraceWriter {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The trace to read from.
- */
- @Nullable private final CTFTrace fInTrace;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a TraceReader to read a trace.
- *
- * @param trace
- * The trace to read from.
- * @throws CTFException
- * if an error occurs
- */
- public CTFTraceWriter(@NonNull CTFTrace trace) throws CTFException {
- fInTrace = trace;
- try (CTFTraceReader fTraceReader = new CTFTraceReader(fInTrace)) {
- fTraceReader.populateIndex();
- }
- }
-
- /**
- * Copies packets from the relevant input to the output trace based
- * on a given time range. The following condition has to be met so that
- * a packet is written to the output trace:
- *
- * startTime <= packet.getTimestampBegin() <= endTime
- *
- * @param startTime
- * start time of packets to be included in output trace
- * @param endTime
- * end time of packets to be included in the output trace
- * @param newTracePath
- * the path of the new trace to be written
- * @throws CTFException
- * If a reading or writing error occurs
- */
- public void copyPackets(long startTime, long endTime, String newTracePath) throws CTFException {
- CTFTrace trace = fInTrace;
- if (trace != null) {
- long adjustedStart = startTime - trace.getClock().getClockOffset();
- long adjustedEnd = endTime - trace.getClock().getClockOffset();
- File out = new File(newTracePath);
- if (out.exists()) {
- throw new CTFIOException("Trace segment cannot be created since trace already exists: " + newTracePath); //$NON-NLS-1$
- }
-
- // create new directory
- boolean isSuccess = out.mkdir();
- if (!isSuccess) {
- throw new CTFIOException("Creating trace directory failed: " + newTracePath); //$NON-NLS-1$
- }
-
- // copy metadata
- Metadata metadata = new Metadata(fInTrace);
- try {
- metadata.copyTo(out);
- } catch (IOException e) {
- throw new CTFIOException("Error copying metadata: " + e.toString(), e); //$NON-NLS-1$
- }
-
- // Copy packets
- for (CTFStream stream : trace.getStreams()) {
- Set<CTFStreamInput> inputs = stream.getStreamInputs();
- for (CTFStreamInput s : inputs) {
- CTFStreamOutputWriter streamOutputwriter = new CTFStreamOutputWriter(checkNotNull(s), out);
- streamOutputwriter.copyPackets(adjustedStart, adjustedEnd);
- }
- }
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.tracecompass.ctf.core.trace;
-
-/**
- * CTF Packet descriptor, can come from a packet header or an index file, this
- * will show certain information about the packet such as the size and
- * timerange.
- *
- * @since 1.0
- */
-public interface ICTFPacketDescriptor {
-
- /**
- * Returns whether the packet includes (inclusively) the given timestamp in
- * the begin-end timestamp range.
- *
- * @param ts
- * The timestamp to check.
- * @return True if the packet includes the timestamp.
- */
- boolean includes(long ts);
-
- /**
- * Gets the offset of a packet within a stream in bits
- *
- * @return the offset bits
- */
- long getOffsetBits();
-
- /**
- * Gets the size of the packet in bits. If you have a 1mb packet that is 499kb
- * used and the header is 1kb, this will return 1mb
- *
- * @return the packetSizeBits
- */
- long getPacketSizeBits();
-
- /**
- * Get the content size of the packet in bits. If you have a 1mb packet that is 499kb
- * used and the header is 1kb, this will return 500kb (used data + header
- *
- * @return the contentSizeBits
- */
- long getContentSizeBits();
-
- /**
- * Gets the beginning timestamp of the packet, all events within the packet will have timestamps after or at this time
- *
- * @return the timestampBegin
- */
- long getTimestampBegin();
-
- /**
- * Gets the ending timestamp of the packet, all events within the packet will have timestamps before or at this time
- *
- * @return the timestampEnd
- */
- long getTimestampEnd();
-
- /**
- * Gets the number of lost events in this packet
- *
- * @return the lostEvents in this packet
- */
- long getLostEvents();
-
- /**
- * Retrieve the value of an existing attribute
- *
- * @param field
- * The name of the attribute
- * @return The value that was stored, or null if it wasn't found
- */
- Object lookupAttribute(String field);
-
- /**
- * Get the target of the packet (what device generated this packet)
- *
- * @return The target that is being traced
- */
- String getTarget();
-
- /**
- * Get the id of the target of the packet (a number helper)
- *
- * @return The ID of the target
- */
- long getTargetId();
-
- /**
- * Get the offset of the packet in bytes within the stream
- *
- * @return The offset of the packet in bytes
- */
- long getOffsetBytes();
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Matthew Khouzam - Update for live trace reading support
- * Bernd Hufmann - Add method to copy metadata file
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.core.trace;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.channels.FileChannel;
-import java.nio.charset.Charset;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
-import java.util.UUID;
-
-import org.antlr.runtime.ANTLRReaderStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.RecognitionException;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.RewriteCardinalityException;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.parser.CTFLexer;
-import org.eclipse.tracecompass.ctf.parser.CTFParser;
-import org.eclipse.tracecompass.ctf.parser.CTFParser.parse_return;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.IOStructGen;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.CtfAntlrException;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-import org.eclipse.tracecompass.internal.ctf.core.trace.Utils;
-
-/**
- * The CTF trace metadata TSDL file
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public class Metadata {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
- private static final String TEXT_ONLY_METADATA_HEADER_PREFIX = "/* CTF"; //$NON-NLS-1$
-
- private static final int PREVALIDATION_SIZE = 8;
-
- private static final int BITS_PER_BYTE = Byte.SIZE;
-
- /**
- * Name of the metadata file in the trace directory
- */
- private static final String METADATA_FILENAME = "metadata"; //$NON-NLS-1$
-
- /**
- * Size of the metadata packet header, in bytes, computed by hand.
- */
- private static final int METADATA_PACKET_HEADER_SIZE = 37;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * Byte order as detected when reading the TSDL magic number.
- */
- private ByteOrder detectedByteOrder = null;
-
- /**
- * The trace file to which belongs this metadata file.
- */
- private final CTFTrace trace;
-
- private IOStructGen fTreeParser;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs a Metadata object.
- *
- * @param trace
- * The trace to which belongs this metadata file.
- */
- public Metadata(CTFTrace trace) {
- this.trace = trace;
- }
-
- /**
- * For network streaming
- */
- public Metadata() {
- trace = new CTFTrace();
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Returns the ByteOrder that was detected while parsing the metadata.
- *
- * @return The byte order.
- */
- public ByteOrder getDetectedByteOrder() {
- return detectedByteOrder;
- }
-
- /**
- * Gets the parent trace
- *
- * @return the parent trace
- */
- public CTFTrace getTrace() {
- return trace;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Parse the metadata file.
- *
- * @throws CTFException
- * If there was a problem parsing the metadata
- */
- public void parseFile() throws CTFException {
-
- /*
- * Reader. It will contain a StringReader if we are using packet-based
- * metadata and it will contain a FileReader if we have text-based
- * metadata.
- */
-
- try (FileInputStream fis = new FileInputStream(getMetadataPath());
- FileChannel metadataFileChannel = fis.getChannel();
- /* Check if metadata is packet-based, if not it is text based */
- Reader metadataTextInput =
- (isPacketBased(metadataFileChannel) ?
- readBinaryMetaData(metadataFileChannel) :
- new FileReader(getMetadataPath()));) {
-
- readMetaDataText(metadataTextInput);
-
- } catch (FileNotFoundException e) {
- throw new CTFException("Cannot find metadata file!", e); //$NON-NLS-1$
- } catch (IOException | ParseException e) {
- throw new CTFException(e);
- } catch (RecognitionException | RewriteCardinalityException e) {
- throw new CtfAntlrException(e);
- }
- }
-
- private Reader readBinaryMetaData(FileChannel metadataFileChannel) throws CTFException {
- /* Create StringBuffer to receive metadata text */
- StringBuffer metadataText = new StringBuffer();
-
- /*
- * Read metadata packet one by one, appending the text to the
- * StringBuffer
- */
- MetadataPacketHeader packetHeader = readMetadataPacket(
- metadataFileChannel, metadataText);
- while (packetHeader != null) {
- packetHeader = readMetadataPacket(metadataFileChannel,
- metadataText);
- }
-
- /* Wrap the metadata string with a StringReader */
- return new StringReader(metadataText.toString());
- }
-
- /**
- * Executes a weak validation of the metadata. It checks if a file with
- * name metadata exists and if one of the following conditions are met:
- * - For text-only metadata, the file starts with "/* CTF" (without the quotes)
- * - For packet-based metadata, the file starts with correct magic number
- *
- * @param path
- * path to CTF trace directory
- * @return <code>true</code> if pre-validation is ok else <code>false</code>
- * @throws CTFException
- * file channel cannot be created
- * @since 1.0
- */
- public static boolean preValidate(String path) throws CTFException {
- String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME;
- File metadataFile = new File(metadataPath);
- if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) {
- try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) {
- ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE);
- bb.clear();
- fc.read(bb);
- bb.flip();
- if (bb.getInt(0) == Utils.TSDL_MAGIC) {
- return true;
- }
- bb.order(ByteOrder.LITTLE_ENDIAN);
- if (bb.getInt(0) == Utils.TSDL_MAGIC) {
- return true;
- }
- bb.position(0);
- Charset forName = Charset.forName("ASCII"); //$NON-NLS-1$
- byte bytes[] = new byte[PREVALIDATION_SIZE];
- bb.get(bytes);
- String text = new String(bytes, forName);
- return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX);
- } catch (IOException e) {
- throw new CTFException(e.getMessage(), e);
- }
- }
- return false;
- }
-
- /**
- * Read the metadata from a formatted TSDL string
- *
- * @param data
- * the data to read
- * @throws CTFException
- * this exception wraps a ParseException, IOException or
- * CtfAntlrException, three exceptions that can be obtained from
- * parsing a TSDL file
- */
- public void parseText(String data) throws CTFException {
- Reader metadataTextInput = new StringReader(data);
- try {
- readMetaDataText(metadataTextInput);
- } catch (IOException | ParseException e) {
- throw new CTFException(e);
- } catch (RecognitionException | RewriteCardinalityException e) {
- throw new CtfAntlrException(e);
- }
-
- }
-
- private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException {
- CommonTree tree = createAST(metadataTextInput);
-
- /* Generate IO structures (declarations) */
- fTreeParser = new IOStructGen(tree, trace);
- fTreeParser.generate();
- }
-
- /**
- * Read a metadata fragment from a formatted TSDL string
- *
- * @param dataFragment
- * the data to read
- * @throws CTFException
- * this exception wraps a ParseException, IOException or
- * CtfAntlrException, three exceptions that can be obtained from
- * parsing a TSDL file
- */
- public void parseTextFragment(String dataFragment) throws CTFException {
- Reader metadataTextInput = new StringReader(dataFragment);
- try {
- readMetaDataTextFragment(metadataTextInput);
- } catch (IOException | ParseException e) {
- throw new CTFException(e);
- } catch (RecognitionException | RewriteCardinalityException e) {
- throw new CtfAntlrException(e);
- }
- }
-
- private void readMetaDataTextFragment(Reader metadataTextInput) throws IOException, RecognitionException, ParseException {
- CommonTree tree = createAST(metadataTextInput);
- fTreeParser.setTree(tree);
- fTreeParser.generateFragment();
- }
-
- private static CommonTree createAST(Reader metadataTextInput) throws IOException,
- RecognitionException {
- /* Create an ANTLR reader */
- ANTLRReaderStream antlrStream;
- antlrStream = new ANTLRReaderStream(metadataTextInput);
-
- /* Parse the metadata text and get the AST */
- CTFLexer ctfLexer = new CTFLexer(antlrStream);
- CommonTokenStream tokens = new CommonTokenStream(ctfLexer);
- CTFParser ctfParser = new CTFParser(tokens, false);
-
- parse_return pr = ctfParser.parse();
- return pr.getTree();
- }
-
- /**
- * Determines whether the metadata file is packet-based by looking at the
- * TSDL magic number. If it is packet-based, it also gives information about
- * the endianness of the trace using the detectedByteOrder attribute.
- *
- * @param metadataFileChannel
- * FileChannel of the metadata file.
- * @return True if the metadata is packet-based.
- * @throws CTFException
- */
- private boolean isPacketBased(FileChannel metadataFileChannel)
- throws CTFException {
- /*
- * Create a ByteBuffer to read the TSDL magic number (default is
- * big-endian)
- */
- ByteBuffer magicByteBuffer = ByteBuffer.allocate(Utils.TSDL_MAGIC_LEN);
-
- /* Read without changing file position */
- try {
- metadataFileChannel.read(magicByteBuffer, 0);
- } catch (IOException e) {
- throw new CTFException("Unable to read metadata file channel.", e); //$NON-NLS-1$
- }
-
- /* Get the first int from the file */
- int magic = magicByteBuffer.getInt(0);
-
- /* Check if it matches */
- if (Utils.TSDL_MAGIC == magic) {
- detectedByteOrder = ByteOrder.BIG_ENDIAN;
- return true;
- }
-
- /* Try the same thing, but with little-endian */
- magicByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
- magic = magicByteBuffer.getInt(0);
-
- if (Utils.TSDL_MAGIC == magic) {
- detectedByteOrder = ByteOrder.LITTLE_ENDIAN;
- return true;
- }
-
- return false;
- }
-
- private String getMetadataPath() {
- /* Path of metadata file = trace directory path + metadata filename */
- if (trace.getTraceDirectory() == null) {
- return new String();
- }
- return trace.getTraceDirectory().getPath()
- + Utils.SEPARATOR + METADATA_FILENAME;
- }
-
- /**
- * Reads a metadata packet from the given metadata FileChannel, do some
- * basic validation and append the text to the StringBuffer.
- *
- * @param metadataFileChannel
- * Metadata FileChannel
- * @param metadataText
- * StringBuffer to which the metadata text will be appended.
- * @return A structure describing the header of the metadata packet, or null
- * if the end of the file is reached.
- * @throws CTFException
- */
- private MetadataPacketHeader readMetadataPacket(
- FileChannel metadataFileChannel, StringBuffer metadataText)
- throws CTFException {
- /* Allocate a ByteBuffer for the header */
- ByteBuffer headerByteBuffer = ByteBuffer.allocate(METADATA_PACKET_HEADER_SIZE);
-
- /* Read the header */
- try {
- int nbBytesRead = metadataFileChannel.read(headerByteBuffer);
-
- /* Return null if EOF */
- if (nbBytesRead < 0) {
- return null;
- }
-
- if (nbBytesRead != METADATA_PACKET_HEADER_SIZE) {
- throw new CTFException("Error reading the metadata header."); //$NON-NLS-1$
- }
-
- } catch (IOException e) {
- throw new CTFException("Error reading the metadata header.", e); //$NON-NLS-1$
- }
-
- /* Set ByteBuffer's position to 0 */
- headerByteBuffer.position(0);
-
- /* Use byte order that was detected with the magic number */
- headerByteBuffer.order(detectedByteOrder);
-
- MetadataPacketHeader header = new MetadataPacketHeader(headerByteBuffer);
-
- /* Check TSDL magic number */
- if (!header.isMagicValid()) {
- throw new CTFException("TSDL magic number does not match"); //$NON-NLS-1$
- }
-
- /* Check UUID */
- if (!trace.uuidIsSet()) {
- trace.setUUID(header.getUuid());
- } else if (!trace.getUUID().equals(header.getUuid())) {
- throw new CTFException("UUID mismatch"); //$NON-NLS-1$
- }
-
- /* Extract the text from the packet */
- int payloadSize = ((header.getContentSize() / BITS_PER_BYTE) - METADATA_PACKET_HEADER_SIZE);
- if (payloadSize < 0) {
- throw new CTFException("Invalid metadata packet payload size."); //$NON-NLS-1$
- }
- int skipSize = (header.getPacketSize() - header.getContentSize()) / BITS_PER_BYTE;
-
- /* Read the payload + the padding in a ByteBuffer */
- ByteBuffer payloadByteBuffer = ByteBuffer.allocateDirect(payloadSize
- + skipSize);
- try {
- metadataFileChannel.read(payloadByteBuffer);
- } catch (IOException e) {
- throw new CTFException("Error reading metadata packet payload.", e); //$NON-NLS-1$
- }
- payloadByteBuffer.rewind();
-
- /* Read only the payload from the ByteBuffer into a byte array */
- byte payloadByteArray[] = new byte[payloadByteBuffer.remaining()];
- payloadByteBuffer.get(payloadByteArray, 0, payloadSize);
-
- /* Convert the byte array to a String */
- String str = new String(payloadByteArray, 0, payloadSize);
-
- /* Append it to the existing metadata */
- metadataText.append(str);
-
- return header;
- }
-
- private static class MetadataPacketHeader {
-
- private static final int UUID_SIZE = 16;
- private final int fMagic;
- private final UUID fUuid;
- private final int fChecksum;
- private final int fContentSize;
- private final int fPacketSize;
- private final byte fCompressionScheme;
- private final byte fEncryptionScheme;
- private final byte fChecksumScheme;
- private final byte fCtfMajorVersion;
- private final byte fCtfMinorVersion;
-
- public MetadataPacketHeader(ByteBuffer headerByteBuffer) {
- /* Read from the ByteBuffer */
- fMagic = headerByteBuffer.getInt();
- byte[] uuidBytes = new byte[UUID_SIZE];
- headerByteBuffer.get(uuidBytes);
- fUuid = Utils.makeUUID(uuidBytes);
- fChecksum = headerByteBuffer.getInt();
- fContentSize = headerByteBuffer.getInt();
- fPacketSize = headerByteBuffer.getInt();
- fCompressionScheme = headerByteBuffer.get();
- fEncryptionScheme = headerByteBuffer.get();
- fChecksumScheme = headerByteBuffer.get();
- fCtfMajorVersion = headerByteBuffer.get();
- fCtfMinorVersion = headerByteBuffer.get();
- }
-
- public boolean isMagicValid() {
- return fMagic == Utils.TSDL_MAGIC;
- }
-
- public UUID getUuid() {
- return fUuid;
- }
-
- public int getContentSize() {
- return fContentSize;
- }
-
- public int getPacketSize() {
- return fPacketSize;
- }
-
- @Override
- public String toString() {
- /* Only for debugging, shouldn't be externalized */
- /* Therefore it cannot be covered by test cases */
- return "MetadataPacketHeader [magic=0x" //$NON-NLS-1$
- + Integer.toHexString(fMagic) + ", uuid=" //$NON-NLS-1$
- + fUuid.toString() + ", checksum=" + fChecksum //$NON-NLS-1$
- + ", contentSize=" + fContentSize + ", packetSize=" //$NON-NLS-1$ //$NON-NLS-2$
- + fPacketSize + ", compressionScheme=" + fCompressionScheme //$NON-NLS-1$
- + ", encryptionScheme=" + fEncryptionScheme //$NON-NLS-1$
- + ", checksumScheme=" + fChecksumScheme //$NON-NLS-1$
- + ", ctfMajorVersion=" + fCtfMajorVersion //$NON-NLS-1$
- + ", ctfMinorVersion=" + fCtfMinorVersion + ']'; //$NON-NLS-1$
- }
-
- }
-
- /**
- * Copies the metadata file to a destination directory.
- * @param path
- * the destination directory
- * @return the path to the target file
- * @throws IOException
- * if an error occurred
- *
- * @since 1.0
- */
- public Path copyTo(final File path) throws IOException {
- Path source = FileSystems.getDefault().getPath(trace.getTraceDirectory().getAbsolutePath(), METADATA_FILENAME);
- Path destPath = FileSystems.getDefault().getPath(path.getAbsolutePath());
- return Files.copy(source, destPath.resolve(source.getFileName()));
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-/**
- * <b><u>Activator</u></b>
- * <p>
- * The activator class controls the plug-in life cycle.
- */
-public class Activator extends Plugin {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.tracecompass.ctf.core"; //$NON-NLS-1$
-
- /**
- * The shared instance
- */
- private static Activator fPlugin;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- */
- public Activator() {
- setDefault(this);
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Get the default activator
- * @return the default activator
- */
- public static Activator getDefault() {
- return fPlugin;
- }
-
- /**
- * Sets the default activator
- *
- * @param plugin the default activator
- */
- private static void setDefault(Activator plugin) {
- fPlugin = plugin;
- }
-
- // ------------------------------------------------------------------------
- // Plugin
- // ------------------------------------------------------------------------
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- setDefault(this);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- setDefault(null);
- super.stop(context);
- }
-
- // ------------------------------------------------------------------------
- // Logging
- // ------------------------------------------------------------------------
-
- /**
- * Log a message
- *
- * @param msg
- * The message to log
- */
- public static void log(String msg) {
- log(msg, null);
- }
-
- /**
- * Log a message with an exception
- *
- * @param msg
- * The message
- * @param e
- * The exception
- */
- public static void log(String msg, Exception e) {
- getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
- }
-
- /**
- * Log an error, with an associated exception
- *
- * @param msg
- * The error message
- * @param e
- * The cause
- */
- public static void logError(String msg, Exception e) {
- getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, e));
- }
-
- /**
- * Log a message
- *
- * @param severity
- * Desired severity of the message in the log, one of
- * {@link IStatus#INFO}, {@link IStatus#WARNING} or
- * {@link IStatus#ERROR}
- * @param msg
- * The message to log
- */
- public static void log(int severity, String msg) {
- getDefault().getLog().log(new Status(severity, PLUGIN_ID, msg));
- }
-
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Marc-Andre Laperle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
-/**
- * A common utility for mapping a ByteBuffer safely to work around a bug on
- * Windows which prevents deleting a file after it was mapped. On Windows, the
- * ByteBuffer will be allocated and the file will be read instead of being
- * mapped.
- *
- * http://bugs.java.com/view_bug.do?bug_id=4715154
- */
-public class SafeMappedByteBuffer {
-
- private static final boolean IS_WIN32 = System.getProperty("os.name").startsWith("Windows"); //$NON-NLS-1$//$NON-NLS-2$
-
- private SafeMappedByteBuffer(){}
-
- /**
- * Maps a region of this channel's file directly into memory. On Windows,
- * this will allocate a new ByteBuffer and read the file.
- *
- * @param fc
- * the file channel
- * @param mode
- * the mapping mode
- * @param position
- * the position within the file
- * @param size
- * the size of the region to be mapped (or read)
- * @return the mapped ByteBuffer
- * @throws IOException
- * on FileChannel operations failures
- */
- public static ByteBuffer map(FileChannel fc, FileChannel.MapMode mode, long position, long size) throws IOException {
- ByteBuffer byteBuffer;
- if (IS_WIN32) {
- byteBuffer = ByteBuffer.allocate((int) size);
- fc.read(byteBuffer, position);
- byteBuffer.flip();
- } else {
- byteBuffer = fc.map(mode, position, size);
- }
-
- return byteBuffer;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Simon Delisle - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event;
-
-import java.util.Comparator;
-
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-
-/**
- * Comparator for CTFCallsite
- *
- * @author Simon Delisle
- */
-public class CTFCallsiteComparator implements Comparator<CTFCallsite> {
-
- private static final long MASK32 = 0x00000000ffffffffL;
-
- /*
- * The callsites will be sorted by calling addresses. To do this we take IPs
- * (instruction pointers) and compare them. Java only supports signed
- * operation and since memory addresses are unsigned, we will convert the
- * longs into integers that contain the high and low bytes and compare them.
- */
- @Override
- public int compare(CTFCallsite o1, CTFCallsite o2) {
- /*
- * mask32 is 32 zeros followed by 32 ones, when we bitwise and this it
- * will return the lower 32 bits
- */
-
- long other = o2.getIp();
- /*
- * To get a high int: we downshift by 32 and bitwise and with the mask
- * to get rid of the sign
- *
- * To get the low int: we bitwise and with the mask.
- */
- long otherHigh = (other >> 32) & MASK32;
- long otherLow = other & MASK32;
- long ownHigh = (o1.getIp() >> 32) & MASK32;
- long ownLow = o1.getIp() & MASK32;
- /* are the high values different, if so ignore the lower values */
- if (ownHigh > otherHigh) {
- return 1;
- }
- if (ownHigh < otherHigh ) {
- return -1;
- }
- /* the high values are the same, compare the lower values */
- if (ownLow > otherLow) {
- return 1;
- }
- if (ownLow < otherLow) {
- return -1;
- }
- /* the values are identical */
- return 0;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-
-/**
- * Representation of one type of event. A bit like "int" or "long" but for trace
- * events.
- */
-public class EventDeclaration implements IEventDeclaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * Name of the event
- */
- private String fName;
-
- /**
- * Event context structure declaration
- */
- private StructDeclaration fContext = null;
-
- /**
- * Event fields structure declaration
- */
- private StructDeclaration fFields = null;
-
- /**
- * Stream to which belongs this event.
- */
- private CTFStream fStream = null;
-
- /**
- * Loglevel of an event
- */
- private long fLogLevel;
-
- /** Map of this event type's custom CTF attributes */
- private final Map<String, String> fCustomAttributes = new HashMap<>();
-
- private int fId = (int) UNSET_EVENT_ID;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Default constructor. Use the setters afterwards to set the fields
- * accordingly.
- */
- public EventDeclaration() {
- }
-
- @Override
- public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException {
- StructDeclaration streamEventContextDecl = streamInputReader.getStreamEventContextDecl();
- StructDefinition streamEventContext = streamEventContextDecl != null ? streamEventContextDecl.createDefinition(fStream.getTrace(), ILexicalScope.STREAM_EVENT_CONTEXT, input) : null;
- ICompositeDefinition packetContext = streamInputReader.getPacketReader().getCurrentPacketEventHeader();
- StructDefinition eventContext = fContext != null ? fContext.createDefinition(fStream.getTrace(), ILexicalScope.CONTEXT, input) : null;
- StructDefinition eventPayload = fFields != null ? fFields.createDefinition(fStream.getTrace(), ILexicalScope.FIELDS, input) : null;
-
- // a bit lttng specific
- // CTF doesn't require a timestamp,
- // but it's passed to us
- return new EventDefinition(
- this,
- streamInputReader,
- timestamp,
- streamEventContext,
- eventContext,
- packetContext,
- eventPayload);
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Sets a name for an event Declaration
- *
- * @param name
- * the name
- */
- public void setName(String name) {
- fName = name;
- }
-
- @Override
- public String getName() {
- return fName;
- }
-
- /**
- * Sets the context for an event declaration (see CTF specification)
- *
- * @param context
- * the context in structdeclaration format
- */
- public void setContext(StructDeclaration context) {
- fContext = context;
- }
-
- /**
- * Sets the fields of an event declaration
- *
- * @param fields
- * the fields in structdeclaration format
- */
- public void setFields(StructDeclaration fields) {
- fFields = fields;
- }
-
- @Override
- public StructDeclaration getFields() {
- return fFields;
- }
-
- @Override
- public StructDeclaration getContext() {
- return fContext;
- }
-
- /**
- * Sets the id of an event declaration
- *
- * @param id
- * the id
- */
- public void setId(long id) {
- if (id < 0 || id > Integer.MAX_VALUE) {
- throw new IllegalArgumentException("id out of range"); //$NON-NLS-1$
- }
- fId = (int) id;
- }
-
- @Override
- public Long getId() {
- return Long.valueOf(fId);
- }
-
- /**
- * Faster get id assuming you have less than a billion event types
- *
- * @return the event id
- */
- public int id() {
- return fId;
- }
-
- /**
- * Sets the stream of an event declaration
- *
- * @param stream
- * the stream
- */
- public void setStream(CTFStream stream) {
- fStream = stream;
- }
-
- @Override
- public CTFStream getStream() {
- return fStream;
- }
-
- /**
- * Is the name of the event declaration set
- *
- * @return is the name set?
- */
- public boolean nameIsSet() {
- return fName != null;
- }
-
- /**
- * Is the context set
- *
- * @return is the context set
- */
- public boolean contextIsSet() {
- return fContext != null;
- }
-
- /**
- * Is a field set?
- *
- * @return Is the field set?
- */
- public boolean fieldsIsSet() {
- return fFields != null;
- }
-
- /**
- * Is the id set?
- *
- * @return is the id set?
- */
- public boolean idIsSet() {
- return (fId != UNSET_EVENT_ID);
- }
-
- /**
- * Is the stream set?
- *
- * @return is the stream set?
- */
- public boolean streamIsSet() {
- return fStream != null;
- }
-
- @Override
- public long getLogLevel() {
- return fLogLevel;
- }
-
- /**
- * Sets the log level
- *
- * @param level
- * the log level
- */
- public void setLogLevel(long level) {
- fLogLevel = level;
- }
-
- @Override
- public Set<String> getCustomAttributes() {
- return fCustomAttributes.keySet();
- }
-
- @Override
- public String getCustomAttribute(String key) {
- return fCustomAttributes.get(key);
- }
-
- /**
- * Sets a custom attribute value.
- *
- * @param key
- * the key of the attribute
- * @param value
- * the value of the attribute
- */
- public void setCustomAttribute(String key, String value) {
- fCustomAttributes.put(key, value);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof EventDeclaration)) {
- return false;
- }
- EventDeclaration other = (EventDeclaration) obj;
- if (fContext == null) {
- if (other.fContext != null) {
- return false;
- }
- } else if (!fContext.equals(other.fContext)) {
- return false;
- }
- if (fFields == null) {
- if (other.fFields != null) {
- return false;
- }
- } else if (!fFields.equals(other.fFields)) {
- return false;
- }
- if (fId != (other.fId)) {
- return false;
- }
- if (fName == null) {
- if (other.fName != null) {
- return false;
- }
- } else if (!fName.equals(other.fName)) {
- return false;
- }
- if (fStream == null) {
- if (other.fStream != null) {
- return false;
- }
- } else if (!fStream.equals(other.fStream)) {
- return false;
- }
- if (!fCustomAttributes.equals(other.fCustomAttributes)) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result)
- + ((fContext == null) ? 0 : fContext.hashCode());
- result = (prime * result) + ((fFields == null) ? 0 : fFields.hashCode());
- result = (prime * result) + fId;
- result = (prime * result) + ((fName == null) ? 0 : fName.hashCode());
- result = (prime * result) + ((fStream == null) ? 0 : fStream.hashCode());
- result = (prime * result) + fCustomAttributes.hashCode();
- return result;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial Design and Grammar
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-
-/**
- * <b><u>DeclarationScope</u></b>
- * <p>
- * A DeclarationScope keeps track of the various CTF declarations for a given
- * scope.
- *
- * TODO: The notion of "symbols" and the notion of "scope" are misused in this
- * parser, which leads to inefficient tree management. It should be cleaned up.
- *
- * @author Matthew Khouzam
- * @author Simon Marchi
- *
- */
-class DeclarationScope {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private DeclarationScope fParentScope = null;
-
- private final Map<String, StructDeclaration> fStructs = new HashMap<>();
- private final Map<String, EnumDeclaration> fEnums = new HashMap<>();
- private final Map<String, VariantDeclaration> fVariants = new HashMap<>();
- private final Map<String, IDeclaration> fTypes = new HashMap<>();
- private final Map<String, IDeclaration> fIdentifiers = new HashMap<>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Creates a declaration scope with no parent.
- */
- public DeclarationScope() {
- }
-
- /**
- * Creates a declaration scope with the specified parent.
- *
- * @param parentScope
- * The parent of the newly created scope.
- */
- public DeclarationScope(DeclarationScope parentScope) {
- fParentScope = parentScope;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Returns the parent of the current scope.
- *
- * @return The parent scope.
- */
- public DeclarationScope getParentScope() {
- return fParentScope;
- }
-
- // ------------------------------------------------------------------------
- // Registration operations
- // ------------------------------------------------------------------------
-
- /**
- * Registers a type declaration.
- *
- * @param name
- * The name of the type.
- * @param declaration
- * The type declaration.
- * @throws ParseException
- * if a type with the same name has already been defined.
- */
- public void registerType(String name, IDeclaration declaration)
- throws ParseException {
- /* Check if the type has been defined in the current scope */
- if (fTypes.containsKey(name)) {
- throw new ParseException("Type has already been defined:" + name); //$NON-NLS-1$
- }
-
- /* Add it to the register. */
- fTypes.put(name, declaration);
- }
-
- /**
- * Registers an identifier declaration.
- *
- * @param name
- * name of the identifier
- * @param declaration
- * the identfier's declaration
- * @throws ParseException
- * if an identifier with the same name has already been defined.
- */
- public void registerIdentifier(String name, IDeclaration declaration) throws ParseException {
- /* Check if the type has been defined in the current scope */
- if (fIdentifiers.containsKey(name)) {
- throw new ParseException("Identifier has already been defined:" + name); //$NON-NLS-1$
- }
-
- /* Add it to the register. */
- fIdentifiers.put(name, declaration);
- }
-
- /**
- * Registers a struct declaration.
- *
- * @param name
- * The name of the struct.
- * @param declaration
- * The declaration of the struct.
- * @throws ParseException
- * if a struct with the same name has already been registered.
- */
- public void registerStruct(String name, StructDeclaration declaration)
- throws ParseException {
- /* Check if the struct has been defined in the current scope. */
- if (fStructs.containsKey(name)) {
- throw new ParseException("Struct has already been defined:" + name); //$NON-NLS-1$
- }
-
- /* Add it to the register. */
- fStructs.put(name, declaration);
-
- /* It also defined a new type, so add it to the type declarations. */
- String structPrefix = "struct "; //$NON-NLS-1$
- registerType(structPrefix + name, declaration);
- }
-
- /**
- * Registers an enum declaration.
- *
- * @param name
- * The name of the enum.
- * @param declaration
- * The declaration of the enum.
- * @throws ParseException
- * if an enum with the same name has already been registered.
- */
- public void registerEnum(String name, EnumDeclaration declaration)
- throws ParseException {
- /* Check if the enum has been defined in the current scope. */
- if (lookupEnum(name) != null) {
- throw new ParseException("Enum has already been defined:" + name); //$NON-NLS-1$
- }
-
- /* Add it to the register. */
- fEnums.put(name, declaration);
-
- /* It also defined a new type, so add it to the type declarations. */
- String enumPrefix = "enum "; //$NON-NLS-1$
- registerType(enumPrefix + name, declaration);
- }
-
- /**
- * Registers a variant declaration.
- *
- * @param name
- * The name of the variant.
- * @param declaration
- * The declaration of the variant.
- * @throws ParseException
- * if a variant with the same name has already been registered.
- */
- public void registerVariant(String name, VariantDeclaration declaration)
- throws ParseException {
- /* Check if the variant has been defined in the current scope. */
- if (lookupVariant(name) != null) {
- throw new ParseException("Variant has already been defined:" + name); //$NON-NLS-1$
- }
-
- /* Add it to the register. */
- fVariants.put(name, declaration);
-
- /* It also defined a new type, so add it to the type declarations. */
- String variantPrefix = "variant "; //$NON-NLS-1$
- registerType(variantPrefix + name, declaration);
- }
-
- // ------------------------------------------------------------------------
- // Lookup operations
- // ------------------------------------------------------------------------
-
- /**
- * Looks up a type declaration in the current scope.
- *
- * @param name
- * The name of the type to search for.
- * @return The type declaration, or null if no type with that name has been
- * defined.
- */
- public IDeclaration lookupType(String name) {
- return fTypes.get(name);
- }
-
- /**
- * Looks up a type declaration in the current scope and recursively in the
- * parent scopes.
- *
- * @param name
- * The name of the type to search for.
- * @return The type declaration, or null if no type with that name has been
- * defined.
- */
- public IDeclaration lookupTypeRecursive(String name) {
- IDeclaration declaration = lookupType(name);
- if (declaration != null) {
- return declaration;
- } else if (fParentScope != null) {
- return fParentScope.lookupTypeRecursive(name);
- } else {
- return null;
- }
- }
-
- /**
- * Looks up a struct declaration.
- *
- * @param name
- * The name of the struct to search for.
- * @return The struct declaration, or null if no struct with that name has
- * been defined.
- */
- public StructDeclaration lookupStruct(String name) {
- return fStructs.get(name);
- }
-
- /**
- * Looks up a struct declaration in the current scope and recursively in the
- * parent scopes.
- *
- * @param name
- * The name of the struct to search for.
- * @return The struct declaration, or null if no struct with that name has
- * been defined.
- */
- public StructDeclaration lookupStructRecursive(String name) {
- StructDeclaration declaration = lookupStruct(name);
- if (declaration != null) {
- return declaration;
- } else if (fParentScope != null) {
- return fParentScope.lookupStructRecursive(name);
- } else {
- return null;
- }
- }
-
- /**
- * Looks up an enum declaration.
- *
- * @param name
- * The name of the enum to search for.
- * @return The enum declaration, or null if no enum with that name has been
- * defined.
- */
- public EnumDeclaration lookupEnum(String name) {
- return fEnums.get(name);
- }
-
- /**
- * Looks up an enum declaration in the current scope and recursively in the
- * parent scopes.
- *
- * @param name
- * The name of the enum to search for.
- * @return The enum declaration, or null if no enum with that name has been
- * defined.
- */
- public EnumDeclaration lookupEnumRecursive(String name) {
- EnumDeclaration declaration = lookupEnum(name);
- if (declaration != null) {
- return declaration;
- } else if (fParentScope != null) {
- return fParentScope.lookupEnumRecursive(name);
- } else {
- return null;
- }
- }
-
- /**
- * Looks up a variant declaration.
- *
- * @param name
- * The name of the variant to search for.
- * @return The variant declaration, or null if no variant with that name has
- * been defined.
- */
- public VariantDeclaration lookupVariant(String name) {
- return fVariants.get(name);
- }
-
- /**
- * Looks up a variant declaration in the current scope and recursively in
- * the parent scopes.
- *
- * @param name
- * The name of the variant to search for.
- * @return The variant declaration, or null if no variant with that name has
- * been defined.
- */
- public VariantDeclaration lookupVariantRecursive(String name) {
- VariantDeclaration declaration = lookupVariant(name);
- if (declaration != null) {
- return declaration;
- } else if (fParentScope != null) {
- return fParentScope.lookupVariantRecursive(name);
- } else {
- return null;
- }
- }
-
- /**
- * Lookup query for an identifier in this scope.
- *
- * @param identifier
- * the name of the identifier to search for. In the case of int
- * x; it would be "x"
- * @return the declaration of the type associated to that identifier
- */
- public IDeclaration lookupIdentifier(String identifier) {
- return fIdentifiers.get(identifier);
- }
-
- /**
- * Lookup query for an identifier through this scope and its ancestors.
- * An ancestor scope is a scope in which this scope is nested.
- *
- * @param identifier
- * the name of the identifier to search for. In the case of int
- * x; it would be "x"
- * @return the declaration of the type associated to that identifier
- */
- public IDeclaration lookupIdentifierRecursive(String identifier) {
- IDeclaration declaration = lookupIdentifier(identifier);
- if (declaration != null) {
- return declaration;
- } else if (fParentScope != null) {
- return fParentScope.lookupIdentifierRecursive(identifier);
- }
- return null;
- }
-
- /**
- * Get all the type names of this scope.
- *
- * @return The type names
- */
- public Set<String> getTypeNames() {
- return fTypes.keySet();
- }
-
- /**
- * Replace a type with a new one.
- *
- * @param name
- * The name of the type
- * @param newType
- * The type
- * @throws ParseException
- * If the type does not exist.
- */
- public void replaceType(String name, IDeclaration newType) throws ParseException {
- if (fTypes.containsKey(name)) {
- fTypes.put(name, newType);
- } else {
- throw new ParseException("Trace does not contain type:" + name); //$NON-NLS-1$
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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:
- * Matthew Khouzam - Initial Design and Grammar
- * Francis Giraldeau - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
-
-import java.math.BigInteger;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.antlr.runtime.tree.CommonTree;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.CTFClock;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStream;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.parser.CTFParser;
-import org.eclipse.tracecompass.internal.ctf.core.Activator;
-import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.StructDeclarationFlattener;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderCompactDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.composite.EventHeaderLargeDeclaration;
-
-import com.google.common.collect.Iterables;
-
-/**
- * IOStructGen
- */
-public class IOStructGen {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final @NonNull String MAP = "map"; //$NON-NLS-1$
- private static final @NonNull String ENCODING = "encoding"; //$NON-NLS-1$
- private static final @NonNull String BASE = "base"; //$NON-NLS-1$
- private static final @NonNull String SIZE = "size"; //$NON-NLS-1$
- private static final @NonNull String SIGNED = "signed"; //$NON-NLS-1$
- private static final @NonNull String LINE = "line"; //$NON-NLS-1$
- private static final @NonNull String FILE = "file"; //$NON-NLS-1$
- private static final @NonNull String IP = "ip"; //$NON-NLS-1$
- private static final @NonNull String FUNC = "func"; //$NON-NLS-1$
- private static final @NonNull String NAME = "name"; //$NON-NLS-1$
- private static final @NonNull String EMPTY_STRING = ""; //$NON-NLS-1$
- private static final int INTEGER_BASE_16 = 16;
- private static final int INTEGER_BASE_10 = 10;
- private static final int INTEGER_BASE_8 = 8;
- private static final int INTEGER_BASE_2 = 2;
- private static final long DEFAULT_ALIGNMENT = 8;
- private static final int DEFAULT_FLOAT_EXPONENT = 8;
- private static final int DEFAULT_FLOAT_MANTISSA = 24;
- private static final int DEFAULT_INT_BASE = 10;
- /**
- * The trace
- */
- private final CTFTrace fTrace;
- private CommonTree fTree;
-
- /**
- * The current declaration scope.
- */
- private DeclarationScope fScope = null;
-
- /**
- * Data helpers needed for streaming
- */
-
- private boolean fHasBeenParsed = false;
-
- // ------------------------------------------------------------------------
- // Constructor
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param tree
- * the tree (ANTLR generated) with the parsed TSDL data.
- * @param trace
- * the trace containing the places to put all the read metadata
- */
- public IOStructGen(CommonTree tree, CTFTrace trace) {
- fTrace = trace;
- fTree = tree;
-
- }
-
- /**
- * Parse the tree and populate the trace defined in the constructor.
- *
- * @throws ParseException
- * If there was a problem parsing the metadata
- */
- public void generate() throws ParseException {
- parseRoot(fTree);
- }
-
- /**
- * Parse a partial tree and populate the trace defined in the constructor.
- * Does not check for a "trace" block as there is only one in the trace and
- * thus
- *
- * @throws ParseException
- * If there was a problem parsing the metadata
- */
- public void generateFragment() throws ParseException {
- parseIncompleteRoot(fTree);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Sets a new tree to parse
- *
- * @param newTree
- * the new tree to parse
- */
- public void setTree(CommonTree newTree) {
- fTree = newTree;
- }
-
- /**
- * Parse the root node.
- *
- * @param root
- * A ROOT node.
- * @throws ParseException
- */
- private void parseRoot(CommonTree root) throws ParseException {
-
- List<CommonTree> children = root.getChildren();
-
- CommonTree traceNode = null;
- boolean hasStreams = false;
- List<CommonTree> events = new ArrayList<>();
-
- /* Create a new declaration scope with no parent. */
- pushScope();
-
- for (CommonTree child : children) {
- final int type = child.getType();
- switch (type) {
- case CTFParser.DECLARATION:
- parseRootDeclaration(child);
- break;
- case CTFParser.TRACE:
- if (traceNode != null) {
- throw new ParseException("Only one trace block is allowed"); //$NON-NLS-1$
- }
- traceNode = child;
- parseTrace(traceNode);
- break;
- case CTFParser.STREAM:
- parseStream(child);
- hasStreams = true;
- break;
- case CTFParser.EVENT:
- events.add(child);
- break;
- case CTFParser.CLOCK:
- parseClock(child);
- break;
- case CTFParser.ENV:
- parseEnvironment(child);
- break;
- case CTFParser.CALLSITE:
- parseCallsite(child);
- break;
- default:
- throw childTypeError(child);
- }
- }
- if (traceNode == null) {
- throw new ParseException("Missing trace block"); //$NON-NLS-1$
- }
- parseEvents(events, hasStreams);
- popScope();
- fHasBeenParsed = true;
- }
-
- private void parseEvents(List<CommonTree> events, boolean hasStreams) throws ParseException {
- if (!hasStreams && !events.isEmpty()) {
- /* Add an empty stream that will have a null id */
- fTrace.addStream(new CTFStream(fTrace));
- }
- for (CommonTree event : events) {
- parseEvent(event);
- }
- }
-
- private void parseIncompleteRoot(CommonTree root) throws ParseException {
- if (!fHasBeenParsed) {
- throw new ParseException("You need to run generate first"); //$NON-NLS-1$
- }
- List<CommonTree> children = root.getChildren();
- List<CommonTree> events = new ArrayList<>();
- /* Create a new declaration scope with no parent. */
- pushScope();
-
- for (CommonTree child : children) {
- final int type = child.getType();
- switch (type) {
- case CTFParser.DECLARATION:
- parseRootDeclaration(child);
- break;
- case CTFParser.TRACE:
- throw new ParseException("Trace block defined here, please use generate and not generateFragment to parse this fragment"); //$NON-NLS-1$
- case CTFParser.STREAM:
- parseStream(child);
- break;
- case CTFParser.EVENT:
- events.add(child);
- break;
- case CTFParser.CLOCK:
- parseClock(child);
- break;
- case CTFParser.ENV:
- parseEnvironment(child);
- break;
- case CTFParser.CALLSITE:
- parseCallsite(child);
- break;
- default:
- throw childTypeError(child);
- }
- }
- parseEvents(events, !Iterables.isEmpty(fTrace.getStreams()));
- popScope();
- }
-
- private void parseCallsite(CommonTree callsite) {
-
- List<CommonTree> children = callsite.getChildren();
- String name = null;
- String funcName = null;
- long lineNumber = -1;
- long ip = -1;
- String fileName = null;
-
- for (CommonTree child : children) {
- String left;
- /* this is a regex to find the leading and trailing quotes */
- final String regex = "^\"|\"$"; //$NON-NLS-1$
- /*
- * this is to replace the previous quotes with nothing...
- * effectively deleting them
- */
- final String nullString = EMPTY_STRING;
- left = child.getChild(0).getChild(0).getChild(0).getText();
- if (left.equals(NAME)) {
- name = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
- } else if (left.equals(FUNC)) {
- funcName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
- } else if (left.equals(IP)) {
- ip = Long.decode(child.getChild(1).getChild(0).getChild(0).getText());
- } else if (left.equals(FILE)) {
- fileName = child.getChild(1).getChild(0).getChild(0).getText().replaceAll(regex, nullString);
- } else if (left.equals(LINE)) {
- lineNumber = Long.parseLong(child.getChild(1).getChild(0).getChild(0).getText());
- }
- }
- fTrace.addCallsite(name, funcName, ip, fileName, lineNumber);
- }
-
- private void parseEnvironment(CommonTree environment) {
- List<CommonTree> children = environment.getChildren();
- for (CommonTree child : children) {
- String left;
- String right;
- left = child.getChild(0).getChild(0).getChild(0).getText();
- right = child.getChild(1).getChild(0).getChild(0).getText();
- fTrace.addEnvironmentVar(left, right);
- }
- }
-
- private void parseClock(CommonTree clock) throws ParseException {
- List<CommonTree> children = clock.getChildren();
- CTFClock ctfClock = new CTFClock();
- for (CommonTree child : children) {
- final String key = child.getChild(0).getChild(0).getChild(0).getText();
- final CommonTree value = (CommonTree) child.getChild(1).getChild(0).getChild(0);
- final int type = value.getType();
- final String text = value.getText();
- switch (type) {
- case CTFParser.INTEGER:
- case CTFParser.DECIMAL_LITERAL:
- /*
- * Not a pretty hack, this is to make sure that there is no
- * number overflow due to 63 bit integers. The offset should
- * only really be an issue in the year 2262. the tracer in C/ASM
- * can write an offset in an unsigned 64 bit long. In java, the
- * last bit, being set to 1 will be read as a negative number,
- * but since it is too big a positive it will throw an
- * exception. this will happen in 2^63 ns from 1970. Therefore
- * 293 years from 1970
- */
- Long numValue;
- try {
- numValue = Long.parseLong(text);
- } catch (NumberFormatException e) {
- throw new ParseException("Number conversion issue with " + text, e); //$NON-NLS-1$
- }
- ctfClock.addAttribute(key, numValue);
- break;
- default:
- ctfClock.addAttribute(key, text);
- }
-
- }
- String nameValue = ctfClock.getName();
- fTrace.addClock(nameValue, ctfClock);
- }
-
- private void parseTrace(CommonTree traceNode) throws ParseException {
-
- List<CommonTree> children = traceNode.getChildren();
- if (children == null) {
- throw new ParseException("Trace block is empty"); //$NON-NLS-1$
- }
-
- pushScope();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPEALIAS:
- parseTypealias(child);
- break;
- case CTFParser.TYPEDEF:
- parseTypedef(child);
- break;
- case CTFParser.CTF_EXPRESSION_TYPE:
- case CTFParser.CTF_EXPRESSION_VAL:
- parseTraceDeclaration(child);
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- /*
- * If trace byte order was not specified and not using packet based
- * metadata
- */
- if (fTrace.getByteOrder() == null) {
- throw new ParseException("Trace byte order not set"); //$NON-NLS-1$
- }
-
- popScope();
- }
-
- private void parseTraceDeclaration(CommonTree traceDecl)
- throws ParseException {
-
- /* There should be a left and right */
-
- CommonTree leftNode = (CommonTree) traceDecl.getChild(0);
- CommonTree rightNode = (CommonTree) traceDecl.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
- }
-
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(MetadataStrings.MAJOR)) {
- if (fTrace.majorIsSet()) {
- throw new ParseException("major is already set"); //$NON-NLS-1$
- }
-
- fTrace.setMajor(getMajorOrMinor(rightNode));
- } else if (left.equals(MetadataStrings.MINOR)) {
- if (fTrace.minorIsSet()) {
- throw new ParseException("minor is already set"); //$NON-NLS-1$
- }
-
- fTrace.setMinor(getMajorOrMinor(rightNode));
- } else if (left.equals(MetadataStrings.UUID_STRING)) {
- UUID uuid = getUUID(rightNode);
-
- /*
- * If uuid was already set by a metadata packet, compare it to see
- * if it matches
- */
- if (fTrace.uuidIsSet()) {
- if (fTrace.getUUID().compareTo(uuid) != 0) {
- throw new ParseException("UUID mismatch. Packet says " //$NON-NLS-1$
- + fTrace.getUUID() + " but metadata says " + uuid); //$NON-NLS-1$
- }
- } else {
- fTrace.setUUID(uuid);
- }
-
- } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
- ByteOrder byteOrder = getByteOrder(rightNode);
-
- /*
- * If byte order was already set by a metadata packet, compare it to
- * see if it matches
- */
- if (fTrace.getByteOrder() != null) {
- if (fTrace.getByteOrder() != byteOrder) {
- throw new ParseException(
- "Endianness mismatch. Magic number says " //$NON-NLS-1$
- + fTrace.getByteOrder()
- + " but metadata says " + byteOrder); //$NON-NLS-1$
- }
- } else {
- fTrace.setByteOrder(byteOrder);
- final DeclarationScope parentScope = fScope.getParentScope();
-
- for (String type : parentScope.getTypeNames()) {
- IDeclaration d = parentScope.lookupType(type);
- if (d instanceof IntegerDeclaration) {
- addByteOrder(byteOrder, parentScope, type, (IntegerDeclaration) d);
- } else if (d instanceof StructDeclaration) {
- setAlign(parentScope, (StructDeclaration) d, byteOrder);
- }
- }
- }
- } else if (left.equals(MetadataStrings.PACKET_HEADER)) {
- if (fTrace.packetHeaderIsSet()) {
- throw new ParseException("packet.header already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("packet.header expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration packetHeaderDecl = parseTypeSpecifierList(
- typeSpecifier, null);
-
- if (!(packetHeaderDecl instanceof StructDeclaration)) {
- throw new ParseException("packet.header expects a struct"); //$NON-NLS-1$
- }
-
- fTrace.setPacketHeader((StructDeclaration) packetHeaderDecl);
- } else {
- Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownTraceAttributeWarning + " " + left); //$NON-NLS-1$
- }
- }
-
- private static void addByteOrder(ByteOrder byteOrder,
- final DeclarationScope parentScope, String name,
- IntegerDeclaration decl) throws ParseException {
-
- if (decl.getByteOrder() != byteOrder) {
- IntegerDeclaration newI;
- newI = IntegerDeclaration.createDeclaration(decl.getLength(), decl.isSigned(),
- decl.getBase(), byteOrder, decl.getEncoding(),
- decl.getClock(), decl.getAlignment());
- parentScope.replaceType(name, newI);
- }
- }
-
- private void setAlign(DeclarationScope parentScope, StructDeclaration sd,
- ByteOrder byteOrder) throws ParseException {
-
- for (String s : sd.getFieldsList()) {
- IDeclaration d = sd.getField(s);
-
- if (d instanceof StructDeclaration) {
- setAlign(parentScope, (StructDeclaration) d, byteOrder);
-
- } else if (d instanceof VariantDeclaration) {
- setAlign(parentScope, (VariantDeclaration) d, byteOrder);
- } else if (d instanceof IntegerDeclaration) {
- IntegerDeclaration decl = (IntegerDeclaration) d;
- if (decl.getByteOrder() != byteOrder) {
- IntegerDeclaration newI;
- newI = IntegerDeclaration.createDeclaration(decl.getLength(),
- decl.isSigned(), decl.getBase(), byteOrder,
- decl.getEncoding(), decl.getClock(),
- decl.getAlignment());
- sd.getFields().put(s, newI);
- }
- }
- }
- }
-
- private void setAlign(DeclarationScope parentScope, VariantDeclaration vd,
- ByteOrder byteOrder) throws ParseException {
-
- for (String s : vd.getFields().keySet()) {
- IDeclaration d = vd.getFields().get(s);
-
- if (d instanceof StructDeclaration) {
- setAlign(parentScope, (StructDeclaration) d, byteOrder);
-
- } else if (d instanceof IntegerDeclaration) {
- IntegerDeclaration decl = (IntegerDeclaration) d;
- IntegerDeclaration newI;
- newI = IntegerDeclaration.createDeclaration(decl.getLength(),
- decl.isSigned(), decl.getBase(), byteOrder,
- decl.getEncoding(), decl.getClock(),
- decl.getAlignment());
- vd.getFields().put(s, newI);
- }
- }
- }
-
- private void parseStream(CommonTree streamNode) throws ParseException {
-
- CTFStream stream = new CTFStream(fTrace);
-
- List<CommonTree> children = streamNode.getChildren();
- if (children == null) {
- throw new ParseException("Empty stream block"); //$NON-NLS-1$
- }
-
- pushScope();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPEALIAS:
- parseTypealias(child);
- break;
- case CTFParser.TYPEDEF:
- parseTypedef(child);
- break;
- case CTFParser.CTF_EXPRESSION_TYPE:
- case CTFParser.CTF_EXPRESSION_VAL:
- parseStreamDeclaration(child, stream);
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- if (stream.isIdSet() &&
- (!fTrace.packetHeaderIsSet() || !fTrace.getPacketHeader().hasField(MetadataStrings.STREAM_ID))) {
- throw new ParseException("Stream has an ID, but there is no stream_id field in packet header."); //$NON-NLS-1$
- }
-
- fTrace.addStream(stream);
-
- popScope();
- }
-
- private void parseStreamDeclaration(CommonTree streamDecl, CTFStream stream)
- throws ParseException {
-
- /* There should be a left and right */
-
- CommonTree leftNode = (CommonTree) streamDecl.getChild(0);
- CommonTree rightNode = (CommonTree) streamDecl.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
- }
-
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(MetadataStrings.ID)) {
- if (stream.isIdSet()) {
- throw new ParseException("stream id already defined"); //$NON-NLS-1$
- }
-
- long streamID = getStreamID(rightNode);
-
- stream.setId(streamID);
- } else if (left.equals(MetadataStrings.EVENT_HEADER)) {
- if (stream.isEventHeaderSet()) {
- throw new ParseException("event.header already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("event.header expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration eventHeaderDecl = parseTypeSpecifierList(
- typeSpecifier, null);
-
- if (eventHeaderDecl instanceof StructDeclaration) {
- stream.setEventHeader((StructDeclaration) eventHeaderDecl);
- } else if (eventHeaderDecl instanceof IEventHeaderDeclaration) {
- stream.setEventHeader((IEventHeaderDeclaration) eventHeaderDecl);
- } else {
- throw new ParseException("event.header expects a struct"); //$NON-NLS-1$
- }
-
- } else if (left.equals(MetadataStrings.EVENT_CONTEXT)) {
- if (stream.isEventContextSet()) {
- throw new ParseException("event.context already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("event.context expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration eventContextDecl = parseTypeSpecifierList(
- typeSpecifier, null);
-
- if (!(eventContextDecl instanceof StructDeclaration)) {
- throw new ParseException("event.context expects a struct"); //$NON-NLS-1$
- }
-
- stream.setEventContext((StructDeclaration) eventContextDecl);
- } else if (left.equals(MetadataStrings.PACKET_CONTEXT)) {
- if (stream.isPacketContextSet()) {
- throw new ParseException("packet.context already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("packet.context expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration packetContextDecl = parseTypeSpecifierList(
- typeSpecifier, null);
-
- if (!(packetContextDecl instanceof StructDeclaration)) {
- throw new ParseException("packet.context expects a struct"); //$NON-NLS-1$
- }
-
- stream.setPacketContext((StructDeclaration) packetContextDecl);
- } else {
- Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownStreamAttributeWarning + " " + left); //$NON-NLS-1$
- }
- }
-
- private void parseEvent(CommonTree eventNode) throws ParseException {
-
- List<CommonTree> children = eventNode.getChildren();
- if (children == null) {
- throw new ParseException("Empty event block"); //$NON-NLS-1$
- }
-
- EventDeclaration event = new EventDeclaration();
-
- pushScope();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPEALIAS:
- parseTypealias(child);
- break;
- case CTFParser.TYPEDEF:
- parseTypedef(child);
- break;
- case CTFParser.CTF_EXPRESSION_TYPE:
- case CTFParser.CTF_EXPRESSION_VAL:
- parseEventDeclaration(child, event);
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- if (!event.nameIsSet()) {
- throw new ParseException("Event name not set"); //$NON-NLS-1$
- }
-
- /*
- * If the event did not specify a stream, then the trace must be single
- * stream
- */
- if (!event.streamIsSet()) {
- if (fTrace.nbStreams() > 1) {
- throw new ParseException("Event without stream_id with more than one stream"); //$NON-NLS-1$
- }
-
- /*
- * If the event did not specify a stream, the only existing stream
- * must not have an id. Note: That behavior could be changed, it
- * could be possible to just get the only existing stream, whatever
- * is its id.
- */
- CTFStream stream = fTrace.getStream(null);
-
- if (stream != null) {
- event.setStream(stream);
- } else {
- throw new ParseException("Event without stream_id, but there is no stream without id"); //$NON-NLS-1$
- }
- }
-
- /*
- * Add the event to the stream.
- */
- event.getStream().addEvent(event);
-
- popScope();
- }
-
- private void parseEventDeclaration(CommonTree eventDecl,
- EventDeclaration event) throws ParseException {
-
- /* There should be a left and right */
-
- CommonTree leftNode = (CommonTree) eventDecl.getChild(0);
- CommonTree rightNode = (CommonTree) eventDecl.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of CTF assignment must be a string"); //$NON-NLS-1$
- }
-
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(MetadataStrings.NAME2)) {
- if (event.nameIsSet()) {
- throw new ParseException("name already defined"); //$NON-NLS-1$
- }
-
- String name = getEventName(rightNode);
-
- event.setName(name);
- } else if (left.equals(MetadataStrings.ID)) {
- if (event.idIsSet()) {
- throw new ParseException("id already defined"); //$NON-NLS-1$
- }
-
- long id = getEventID(rightNode);
- if (id > Integer.MAX_VALUE) {
- throw new ParseException("id is greater than int.maxvalue, unsupported. id : " + id); //$NON-NLS-1$
- }
- if (id < 0) {
- throw new ParseException("negative id, unsupported. id : " + id); //$NON-NLS-1$
- }
- event.setId((int) id);
- } else if (left.equals(MetadataStrings.STREAM_ID)) {
- if (event.streamIsSet()) {
- throw new ParseException("stream id already defined"); //$NON-NLS-1$
- }
-
- long streamId = getStreamID(rightNode);
-
- CTFStream stream = fTrace.getStream(streamId);
-
- if (stream == null) {
- throw new ParseException("Stream " + streamId + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- event.setStream(stream);
- } else if (left.equals(MetadataStrings.CONTEXT)) {
- if (event.contextIsSet()) {
- throw new ParseException("context already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("context expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration contextDecl = parseTypeSpecifierList(typeSpecifier,
- null);
-
- if (!(contextDecl instanceof StructDeclaration)) {
- throw new ParseException("context expects a struct"); //$NON-NLS-1$
- }
-
- event.setContext((StructDeclaration) contextDecl);
- } else if (left.equals(MetadataStrings.FIELDS_STRING)) {
- if (event.fieldsIsSet()) {
- throw new ParseException("fields already defined"); //$NON-NLS-1$
- }
-
- CommonTree typeSpecifier = (CommonTree) rightNode.getChild(0);
-
- if (typeSpecifier.getType() != CTFParser.TYPE_SPECIFIER_LIST) {
- throw new ParseException("fields expects a type specifier"); //$NON-NLS-1$
- }
-
- IDeclaration fieldsDecl;
- fieldsDecl = parseTypeSpecifierList(typeSpecifier, null);
-
- if (!(fieldsDecl instanceof StructDeclaration)) {
- throw new ParseException("fields expects a struct"); //$NON-NLS-1$
- }
- /*
- * The underscores in the event names. These underscores were added
- * by the LTTng tracer.
- */
- final StructDeclaration fields = (StructDeclaration) fieldsDecl;
- event.setFields(fields);
- } else if (left.equals(MetadataStrings.LOGLEVEL2)) {
- long logLevel = parseUnaryInteger((CommonTree) rightNode.getChild(0));
- event.setLogLevel(logLevel);
- } else {
- /* Custom event attribute, we'll add it to the attributes map */
- String right = parseUnaryString((CommonTree) rightNode.getChild(0));
- event.setCustomAttribute(left, right);
- }
- }
-
- /**
- * Parses a declaration at the root level.
- *
- * @param declaration
- * The declaration subtree.
- * @throws ParseException
- */
- private void parseRootDeclaration(CommonTree declaration)
- throws ParseException {
-
- List<CommonTree> children = declaration.getChildren();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPEDEF:
- parseTypedef(child);
- break;
- case CTFParser.TYPEALIAS:
- parseTypealias(child);
- break;
- case CTFParser.TYPE_SPECIFIER_LIST:
- parseTypeSpecifierList(child, null);
- break;
- default:
- throw childTypeError(child);
- }
- }
- }
-
- /**
- * Parses a typealias node. It parses the target, the alias, and registers
- * the type in the current scope.
- *
- * @param typealias
- * A TYPEALIAS node.
- * @throws ParseException
- */
- private void parseTypealias(CommonTree typealias) throws ParseException {
-
- List<CommonTree> children = typealias.getChildren();
-
- CommonTree target = null;
- CommonTree alias = null;
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPEALIAS_TARGET:
- target = child;
- break;
- case CTFParser.TYPEALIAS_ALIAS:
- alias = child;
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- IDeclaration targetDeclaration = parseTypealiasTarget(target);
-
- if ((targetDeclaration instanceof VariantDeclaration)
- && ((VariantDeclaration) targetDeclaration).isTagged()) {
- throw new ParseException("Typealias of untagged variant is not permitted"); //$NON-NLS-1$
- }
-
- String aliasString = parseTypealiasAlias(alias);
-
- getCurrentScope().registerType(aliasString, targetDeclaration);
- }
-
- /**
- * Parses the target part of a typealias and gets the corresponding
- * declaration.
- *
- * @param target
- * A TYPEALIAS_TARGET node.
- * @return The corresponding declaration.
- * @throws ParseException
- */
- private IDeclaration parseTypealiasTarget(CommonTree target)
- throws ParseException {
-
- List<CommonTree> children = target.getChildren();
-
- CommonTree typeSpecifierList = null;
- CommonTree typeDeclaratorList = null;
- CommonTree typeDeclarator = null;
- StringBuilder identifierSB = new StringBuilder();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPE_SPECIFIER_LIST:
- typeSpecifierList = child;
- break;
- case CTFParser.TYPE_DECLARATOR_LIST:
- typeDeclaratorList = child;
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- if (typeDeclaratorList != null) {
- /*
- * Only allow one declarator
- *
- * eg: "typealias uint8_t *, ** := puint8_t;" is not permitted,
- * otherwise the new type puint8_t would maps to two different
- * types.
- */
- if (typeDeclaratorList.getChildCount() != 1) {
- throw new ParseException("Only one type declarator is allowed in the typealias target"); //$NON-NLS-1$
- }
-
- typeDeclarator = (CommonTree) typeDeclaratorList.getChild(0);
- }
-
- /* Parse the target type and get the declaration */
- IDeclaration targetDeclaration = parseTypeDeclarator(typeDeclarator,
- typeSpecifierList, identifierSB);
-
- /*
- * We don't allow identifier in the target
- *
- * eg: "typealias uint8_t* hello := puint8_t;", the "hello" is not
- * permitted
- */
- if (identifierSB.length() > 0) {
- throw new ParseException("Identifier (" + identifierSB.toString() //$NON-NLS-1$
- + ") not expected in the typealias target"); //$NON-NLS-1$
- }
-
- return targetDeclaration;
- }
-
- /**
- * Parses the alias part of a typealias. It parses the underlying specifier
- * list and declarator and creates the string representation that will be
- * used to register the type.
- *
- * @param alias
- * A TYPEALIAS_ALIAS node.
- * @return The string representation of the alias.
- * @throws ParseException
- */
- private static String parseTypealiasAlias(CommonTree alias)
- throws ParseException {
-
- List<CommonTree> children = alias.getChildren();
-
- CommonTree typeSpecifierList = null;
- CommonTree typeDeclaratorList = null;
- CommonTree typeDeclarator = null;
- List<CommonTree> pointers = new LinkedList<>();
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.TYPE_SPECIFIER_LIST:
- typeSpecifierList = child;
- break;
- case CTFParser.TYPE_DECLARATOR_LIST:
- typeDeclaratorList = child;
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- /* If there is a type declarator list, extract the pointers */
- if (typeDeclaratorList != null) {
- /*
- * Only allow one declarator
- *
- * eg: "typealias uint8_t := puint8_t *, **;" is not permitted.
- */
- if (typeDeclaratorList.getChildCount() != 1) {
- throw new ParseException("Only one type declarator is allowed in the typealias alias"); //$NON-NLS-1$
- }
-
- typeDeclarator = (CommonTree) typeDeclaratorList.getChild(0);
-
- List<CommonTree> typeDeclaratorChildren = typeDeclarator.getChildren();
-
- for (CommonTree child : typeDeclaratorChildren) {
- switch (child.getType()) {
- case CTFParser.POINTER:
- pointers.add(child);
- break;
- case CTFParser.IDENTIFIER:
- throw new ParseException("Identifier (" + child.getText() //$NON-NLS-1$
- + ") not expected in the typealias target"); //$NON-NLS-1$
- default:
- throw childTypeError(child);
- }
- }
- }
-
- return createTypeDeclarationString(typeSpecifierList, pointers);
- }
-
- /**
- * Parses a typedef node. This creates and registers a new declaration for
- * each declarator found in the typedef.
- *
- * @param typedef
- * A TYPEDEF node.
- * @throws ParseException
- * If there is an error creating the declaration.
- */
- private void parseTypedef(CommonTree typedef) throws ParseException {
-
- CommonTree typeDeclaratorListNode = (CommonTree) typedef.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
-
- CommonTree typeSpecifierListNode = (CommonTree) typedef.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
-
- List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
-
- for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
- StringBuilder identifierSB = new StringBuilder();
-
- IDeclaration typeDeclaration = parseTypeDeclarator(
- typeDeclaratorNode, typeSpecifierListNode, identifierSB);
-
- if ((typeDeclaration instanceof VariantDeclaration)
- && ((VariantDeclaration) typeDeclaration).isTagged()) {
- throw new ParseException("Typealias of untagged variant is not permitted"); //$NON-NLS-1$
- }
-
- getCurrentScope().registerType(identifierSB.toString(),
- typeDeclaration);
- }
- }
-
- /**
- * Parses a pair type declarator / type specifier list and returns the
- * corresponding declaration. If it is present, it also writes the
- * identifier of the declarator in the given {@link StringBuilder}.
- *
- * @param typeDeclarator
- * A TYPE_DECLARATOR node.
- * @param typeSpecifierList
- * A TYPE_SPECIFIER_LIST node.
- * @param identifierSB
- * A StringBuilder that will receive the identifier found in the
- * declarator.
- * @return The corresponding declaration.
- * @throws ParseException
- * If there is an error finding or creating the declaration.
- */
- private IDeclaration parseTypeDeclarator(CommonTree typeDeclarator,
- CommonTree typeSpecifierList, StringBuilder identifierSB)
- throws ParseException {
-
- IDeclaration declaration = null;
- List<CommonTree> children = null;
- List<CommonTree> pointers = new LinkedList<>();
- List<CommonTree> lengths = new LinkedList<>();
- CommonTree identifier = null;
-
- /* Separate the tokens by type */
- if (typeDeclarator != null) {
- children = typeDeclarator.getChildren();
- for (CommonTree child : children) {
-
- switch (child.getType()) {
- case CTFParser.POINTER:
- pointers.add(child);
- break;
- case CTFParser.IDENTIFIER:
- identifier = child;
- break;
- case CTFParser.LENGTH:
- lengths.add(child);
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- }
-
- /*
- * Parse the type specifier list, which is the "base" type. For example,
- * it would be int in int a[3][len].
- */
- declaration = parseTypeSpecifierList(typeSpecifierList, pointers);
-
- /*
- * Each length subscript means that we must create a nested array or
- * sequence. For example, int a[3][len] means that we have an array of 3
- * (sequences of length 'len' of (int)).
- */
- if (!lengths.isEmpty()) {
- /* We begin at the end */
- Collections.reverse(lengths);
-
- for (CommonTree length : lengths) {
- /*
- * By looking at the first expression, we can determine whether
- * it is an array or a sequence.
- */
- List<CommonTree> lengthChildren = length.getChildren();
-
- CommonTree first = lengthChildren.get(0);
- if (isUnaryInteger(first)) {
- /* Array */
- int arrayLength = (int) parseUnaryInteger(first);
-
- if (arrayLength < 1) {
- throw new ParseException("Array length is negative"); //$NON-NLS-1$
- }
-
- /* Create the array declaration. */
- declaration = new ArrayDeclaration(arrayLength, declaration);
- } else if (isAnyUnaryString(first)) {
- /* Sequence */
- String lengthName = concatenateUnaryStrings(lengthChildren);
-
- /* check that lengthName was declared */
- if (isSignedIntegerField(lengthName)) {
- throw new ParseException("Sequence declared with length that is not an unsigned integer"); //$NON-NLS-1$
- }
- /* Create the sequence declaration. */
- declaration = new SequenceDeclaration(lengthName,
- declaration);
- } else {
- throw childTypeError(first);
- }
- }
- }
-
- if (identifier != null) {
- identifierSB.append(identifier.getText());
- }
-
- return declaration;
- }
-
- private boolean isSignedIntegerField(String lengthName) throws ParseException {
- IDeclaration decl = getCurrentScope().lookupIdentifierRecursive(lengthName);
- if (decl instanceof IntegerDeclaration) {
- return ((IntegerDeclaration) decl).isSigned();
- }
- throw new ParseException("Is not an integer: " + lengthName); //$NON-NLS-1$
-
- }
-
- /**
- * Parses a type specifier list and returns the corresponding declaration.
- *
- * @param typeSpecifierList
- * A TYPE_SPECIFIER_LIST node.
- * @param pointerList
- * A list of POINTER nodes that apply to the specified type.
- * @return The corresponding declaration.
- * @throws ParseException
- * If the type has not been defined or if there is an error
- * creating the declaration.
- */
- private IDeclaration parseTypeSpecifierList(CommonTree typeSpecifierList,
- List<CommonTree> pointerList) throws ParseException {
- IDeclaration declaration = null;
-
- /*
- * By looking at the first element of the type specifier list, we can
- * determine which type it belongs to.
- */
- CommonTree firstChild = (CommonTree) typeSpecifierList.getChild(0);
-
- switch (firstChild.getType()) {
- case CTFParser.FLOATING_POINT:
- declaration = parseFloat(firstChild);
- break;
- case CTFParser.INTEGER:
- declaration = parseInteger(firstChild);
- break;
- case CTFParser.STRING:
- declaration = parseString(firstChild);
- break;
- case CTFParser.STRUCT:
- declaration = parseStruct(firstChild);
- StructDeclaration structDeclaration = (StructDeclaration) declaration;
- IDeclaration idEnumDecl = structDeclaration.getFields().get("id"); //$NON-NLS-1$
- if (idEnumDecl instanceof EnumDeclaration) {
- EnumDeclaration enumDeclaration = (EnumDeclaration) idEnumDecl;
- ByteOrder bo = enumDeclaration.getContainerType().getByteOrder();
- if (EventHeaderCompactDeclaration.getEventHeader(bo).isCompactEventHeader(structDeclaration)) {
- declaration = EventHeaderCompactDeclaration.getEventHeader(bo);
- } else if (EventHeaderLargeDeclaration.getEventHeader(bo).isLargeEventHeader(structDeclaration)) {
- declaration = EventHeaderLargeDeclaration.getEventHeader(bo);
- }
- }
- break;
- case CTFParser.VARIANT:
- declaration = parseVariant(firstChild);
- break;
- case CTFParser.ENUM:
- declaration = parseEnum(firstChild);
- break;
- case CTFParser.IDENTIFIER:
- case CTFParser.FLOATTOK:
- case CTFParser.INTTOK:
- case CTFParser.LONGTOK:
- case CTFParser.SHORTTOK:
- case CTFParser.SIGNEDTOK:
- case CTFParser.UNSIGNEDTOK:
- case CTFParser.CHARTOK:
- case CTFParser.DOUBLETOK:
- case CTFParser.VOIDTOK:
- case CTFParser.BOOLTOK:
- case CTFParser.COMPLEXTOK:
- case CTFParser.IMAGINARYTOK:
- declaration = parseTypeDeclaration(typeSpecifierList, pointerList);
- break;
- default:
- throw childTypeError(firstChild);
- }
-
- return declaration;
- }
-
- private IDeclaration parseFloat(CommonTree floatingPoint)
- throws ParseException {
-
- List<CommonTree> children = floatingPoint.getChildren();
-
- /*
- * If the integer has no attributes, then it is missing the size
- * attribute which is required
- */
- if (children == null) {
- throw new ParseException("float: missing size attribute"); //$NON-NLS-1$
- }
-
- /* The return value */
- FloatDeclaration floatDeclaration = null;
- ByteOrder byteOrder = fTrace.getByteOrder();
- long alignment = 0;
-
- int exponent = DEFAULT_FLOAT_EXPONENT;
- int mantissa = DEFAULT_FLOAT_MANTISSA;
-
- /* Iterate on all integer children */
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.CTF_EXPRESSION_VAL:
- /*
- * An assignment expression must have 2 children, left and right
- */
-
- CommonTree leftNode = (CommonTree) child.getChild(0);
- CommonTree rightNode = (CommonTree) child.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
- }
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(MetadataStrings.EXP_DIG)) {
- exponent = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
- } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
- byteOrder = getByteOrder(rightNode);
- } else if (left.equals(MetadataStrings.MANT_DIG)) {
- mantissa = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
- } else if (left.equals(MetadataStrings.ALIGN)) {
- alignment = getAlignment(rightNode);
- } else {
- throw new ParseException("Float: unknown attribute " + left); //$NON-NLS-1$
- }
-
- break;
- default:
- throw childTypeError(child);
- }
- }
- int size = mantissa + exponent;
- if (size == 0) {
- throw new ParseException("Float missing size attribute"); //$NON-NLS-1$
- }
-
- if (alignment == 0) {
- alignment = ((size % DEFAULT_ALIGNMENT) == 0) ? 1 : DEFAULT_ALIGNMENT;
- }
-
- floatDeclaration = new FloatDeclaration(exponent, mantissa, byteOrder, alignment);
-
- return floatDeclaration;
-
- }
-
- /**
- * Parses a type specifier list as a user-declared type.
- *
- * @param typeSpecifierList
- * A TYPE_SPECIFIER_LIST node containing a user-declared type.
- * @param pointerList
- * A list of POINTER nodes that apply to the type specified in
- * typeSpecifierList.
- * @return The corresponding declaration.
- * @throws ParseException
- * If the type does not exist (has not been found).
- */
- private IDeclaration parseTypeDeclaration(CommonTree typeSpecifierList,
- List<CommonTree> pointerList) throws ParseException {
- /* Create the string representation of the type declaration */
- String typeStringRepresentation = createTypeDeclarationString(
- typeSpecifierList, pointerList);
-
- /* Use the string representation to search the type in the current scope */
- IDeclaration decl = getCurrentScope().lookupTypeRecursive(
- typeStringRepresentation);
-
- if (decl == null) {
- throw new ParseException("Type " + typeStringRepresentation //$NON-NLS-1$
- + " has not been defined."); //$NON-NLS-1$
- }
-
- return decl;
- }
-
- /**
- * Parses an integer declaration node.
- *
- * @param integer
- * An INTEGER node.
- * @return The corresponding integer declaration.
- * @throws ParseException
- */
- private IntegerDeclaration parseInteger(CommonTree integer)
- throws ParseException {
-
- List<CommonTree> children = integer.getChildren();
-
- /*
- * If the integer has no attributes, then it is missing the size
- * attribute which is required
- */
- if (children == null) {
- throw new ParseException("integer: missing size attribute"); //$NON-NLS-1$
- }
-
- /* The return value */
- IntegerDeclaration integerDeclaration = null;
- boolean signed = false;
- ByteOrder byteOrder = fTrace.getByteOrder();
- long size = 0;
- long alignment = 0;
- int base = DEFAULT_INT_BASE;
- @NonNull
- String clock = EMPTY_STRING;
-
- Encoding encoding = Encoding.NONE;
-
- /* Iterate on all integer children */
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.CTF_EXPRESSION_VAL:
- /*
- * An assignment expression must have 2 children, left and right
- */
-
- CommonTree leftNode = (CommonTree) child.getChild(0);
- CommonTree rightNode = (CommonTree) child.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
- }
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(SIGNED)) {
- signed = getSigned(rightNode);
- } else if (left.equals(MetadataStrings.BYTE_ORDER)) {
- byteOrder = getByteOrder(rightNode);
- } else if (left.equals(SIZE)) {
- size = getSize(rightNode);
- } else if (left.equals(MetadataStrings.ALIGN)) {
- alignment = getAlignment(rightNode);
- } else if (left.equals(BASE)) {
- base = getBase(rightNode);
- } else if (left.equals(ENCODING)) {
- encoding = getEncoding(rightNode);
- } else if (left.equals(MAP)) {
- clock = getClock(rightNode);
- } else {
- Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownIntegerAttributeWarning + " " + left); //$NON-NLS-1$
- }
-
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- if (size <= 0) {
- throw new ParseException("Invalid size attribute in Integer: " + size); //$NON-NLS-1$
- }
-
- if (alignment == 0) {
- alignment = ((size % DEFAULT_ALIGNMENT) == 0) ? 1 : DEFAULT_ALIGNMENT;
- }
-
- integerDeclaration = IntegerDeclaration.createDeclaration((int) size, signed, base,
- byteOrder, encoding, clock, alignment);
-
- return integerDeclaration;
- }
-
- @NonNull
- private static String getClock(CommonTree rightNode) {
- String clock = rightNode.getChild(1).getChild(0).getChild(0).getText();
- return clock == null ? EMPTY_STRING : clock;
- }
-
- private static StringDeclaration parseString(CommonTree string)
- throws ParseException {
-
- List<CommonTree> children = string.getChildren();
- StringDeclaration stringDeclaration = null;
-
- if (children == null) {
- stringDeclaration = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- } else {
- Encoding encoding = Encoding.UTF8;
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.CTF_EXPRESSION_VAL:
- /*
- * An assignment expression must have 2 children, left and
- * right
- */
-
- CommonTree leftNode = (CommonTree) child.getChild(0);
- CommonTree rightNode = (CommonTree) child.getChild(1);
-
- List<CommonTree> leftStrings = leftNode.getChildren();
-
- if (!isAnyUnaryString(leftStrings.get(0))) {
- throw new ParseException("Left side of ctf expression must be a string"); //$NON-NLS-1$
- }
- String left = concatenateUnaryStrings(leftStrings);
-
- if (left.equals(ENCODING)) {
- encoding = getEncoding(rightNode);
- } else {
- throw new ParseException("String: unknown attribute " //$NON-NLS-1$
- + left);
- }
-
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- stringDeclaration = StringDeclaration.getStringDeclaration(encoding);
- }
-
- return stringDeclaration;
- }
-
- /**
- * Parses a struct declaration and returns the corresponding declaration.
- *
- * @param struct
- * An STRUCT node.
- * @return The corresponding struct declaration.
- * @throws ParseException
- */
- private StructDeclaration parseStruct(CommonTree struct)
- throws ParseException {
-
- List<CommonTree> children = struct.getChildren();
-
- /* The return value */
- StructDeclaration structDeclaration = null;
-
- /* Name */
- String structName = null;
- boolean hasName = false;
-
- /* Body */
- CommonTree structBody = null;
- boolean hasBody = false;
-
- /* Align */
- long structAlign = 0;
-
- /* Loop on all children and identify what we have to work with. */
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.STRUCT_NAME: {
- hasName = true;
-
- CommonTree structNameIdentifier = (CommonTree) child.getChild(0);
-
- structName = structNameIdentifier.getText();
-
- break;
- }
- case CTFParser.STRUCT_BODY: {
- hasBody = true;
-
- structBody = child;
-
- break;
- }
- case CTFParser.ALIGN: {
- CommonTree structAlignExpression = (CommonTree) child.getChild(0);
-
- structAlign = getAlignment(structAlignExpression);
-
- break;
- }
- default:
- throw childTypeError(child);
- }
- }
-
- /*
- * If a struct has just a body and no name (just like the song,
- * "A Struct With No Name" by America (sorry for that...)), it's a
- * definition of a new type, so we create the type declaration and
- * return it. We can't add it to the declaration scope since there is no
- * name, but that's what we want because it won't be possible to use it
- * again to declare another field.
- *
- * If it has just a name, we look it up in the declaration scope and
- * return the associated declaration. If it is not found in the
- * declaration scope, it means that a struct with that name has not been
- * declared, which is an error.
- *
- * If it has both, then we create the type declaration and register it
- * to the current scope.
- *
- * If it has none, then what are we doing here ?
- */
- if (hasBody) {
- /*
- * If struct has a name, check if already defined in the current
- * scope.
- */
- if (hasName && (getCurrentScope().lookupStruct(structName) != null)) {
- throw new ParseException("struct " + structName //$NON-NLS-1$
- + " already defined."); //$NON-NLS-1$
- }
- /* Create the declaration */
- structDeclaration = new StructDeclaration(structAlign);
-
- /* Parse the body */
- parseStructBody(structBody, structDeclaration);
-
- /* If struct has name, add it to the current scope. */
- if (hasName) {
- getCurrentScope().registerStruct(structName, structDeclaration);
- }
- } else /* !hasBody */{
- if (hasName) {
- /* Name and !body */
-
- /* Lookup the name in the current scope. */
- structDeclaration = getCurrentScope().lookupStructRecursive(structName);
-
- /*
- * If not found, it means that a struct with such name has not
- * been defined
- */
- if (structDeclaration == null) {
- throw new ParseException("struct " + structName //$NON-NLS-1$
- + " is not defined"); //$NON-NLS-1$
- }
- } else {
- /* !Name and !body */
-
- /* We can't do anything with that. */
- throw new ParseException("struct with no name and no body"); //$NON-NLS-1$
- }
- }
- return StructDeclarationFlattener.tryFlattenStruct(structDeclaration);
- }
-
- /**
- * Parses a struct body, adding the fields to specified structure
- * declaration.
- *
- * @param structBody
- * A STRUCT_BODY node.
- * @param structDeclaration
- * The struct declaration.
- * @throws ParseException
- */
- private void parseStructBody(CommonTree structBody,
- StructDeclaration structDeclaration) throws ParseException {
-
- List<CommonTree> structDeclarations = structBody.getChildren();
-
- /*
- * If structDeclaration is null, structBody has no children and the
- * struct body is empty.
- */
- if (structDeclarations != null) {
- pushScope();
-
- for (CommonTree declarationNode : structDeclarations) {
- switch (declarationNode.getType()) {
- case CTFParser.TYPEALIAS:
- parseTypealias(declarationNode);
- break;
- case CTFParser.TYPEDEF:
- parseTypedef(declarationNode);
- break;
- case CTFParser.SV_DECLARATION:
- parseStructDeclaration(declarationNode, structDeclaration);
- break;
- default:
- throw childTypeError(declarationNode);
- }
- }
- popScope();
- }
- }
-
- /**
- * Parses a declaration found in a struct.
- *
- * @param declaration
- * A SV_DECLARATION node.
- * @param struct
- * A struct declaration. (I know, little name clash here...)
- * @throws ParseException
- */
- private void parseStructDeclaration(CommonTree declaration,
- StructDeclaration struct) throws ParseException {
-
- /* Get the type specifier list node */
- CommonTree typeSpecifierListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
-
- /* Get the type declarator list node */
- CommonTree typeDeclaratorListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
-
- /* Get the type declarator list */
- List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
-
- /*
- * For each type declarator, parse the declaration and add a field to
- * the struct
- */
- for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
-
- StringBuilder identifierSB = new StringBuilder();
-
- IDeclaration decl = parseTypeDeclarator(typeDeclaratorNode,
- typeSpecifierListNode, identifierSB);
- String fieldName = identifierSB.toString();
- getCurrentScope().registerIdentifier(fieldName, decl);
-
- if (struct.hasField(fieldName)) {
- throw new ParseException("struct: duplicate field " //$NON-NLS-1$
- + fieldName);
- }
-
- struct.addField(fieldName, decl);
-
- }
- }
-
- /**
- * Parses an enum declaration and returns the corresponding declaration.
- *
- * @param theEnum
- * An ENUM node.
- * @return The corresponding enum declaration.
- * @throws ParseException
- */
- private EnumDeclaration parseEnum(CommonTree theEnum) throws ParseException {
-
- List<CommonTree> children = theEnum.getChildren();
-
- /* The return value */
- EnumDeclaration enumDeclaration = null;
-
- /* Name */
- String enumName = null;
-
- /* Body */
- CommonTree enumBody = null;
-
- /* Container type */
- IntegerDeclaration containerTypeDeclaration = null;
-
- /* Loop on all children and identify what we have to work with. */
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.ENUM_NAME: {
- CommonTree enumNameIdentifier = (CommonTree) child.getChild(0);
- enumName = enumNameIdentifier.getText();
- break;
- }
- case CTFParser.ENUM_BODY: {
- enumBody = child;
- break;
- }
- case CTFParser.ENUM_CONTAINER_TYPE: {
- containerTypeDeclaration = parseEnumContainerType(child);
- break;
- }
- default:
- throw childTypeError(child);
- }
- }
-
- /*
- * If the container type has not been defined explicitly, we assume it
- * is "int".
- */
- if (containerTypeDeclaration == null) {
- IDeclaration enumDecl;
- /*
- * it could be because the enum was already declared.
- */
- if (enumName != null) {
- enumDecl = getCurrentScope().lookupEnumRecursive(enumName);
- if (enumDecl != null) {
- return (EnumDeclaration) enumDecl;
- }
- }
-
- IDeclaration decl = getCurrentScope().lookupTypeRecursive("int"); //$NON-NLS-1$
-
- if (decl == null) {
- throw new ParseException("enum container type implicit and type int not defined"); //$NON-NLS-1$
- } else if (!(decl instanceof IntegerDeclaration)) {
- throw new ParseException("enum container type implicit and type int not an integer"); //$NON-NLS-1$
- }
-
- containerTypeDeclaration = (IntegerDeclaration) decl;
- }
-
- /*
- * If it has a body, it's a new declaration, otherwise it's a reference
- * to an existing declaration. Same logic as struct.
- */
- if (enumBody != null) {
- /*
- * If enum has a name, check if already defined in the current
- * scope.
- */
- if ((enumName != null)
- && (getCurrentScope().lookupEnum(enumName) != null)) {
- throw new ParseException("enum " + enumName //$NON-NLS-1$
- + " already defined"); //$NON-NLS-1$
- }
-
- /* Create the declaration */
- enumDeclaration = new EnumDeclaration(containerTypeDeclaration);
-
- /* Parse the body */
- parseEnumBody(enumBody, enumDeclaration);
-
- /* If the enum has name, add it to the current scope. */
- if (enumName != null) {
- getCurrentScope().registerEnum(enumName, enumDeclaration);
- }
- } else {
- if (enumName != null) {
- /* Name and !body */
-
- /* Lookup the name in the current scope. */
- enumDeclaration = getCurrentScope().lookupEnumRecursive(enumName);
-
- /*
- * If not found, it means that an enum with such name has not
- * been defined
- */
- if (enumDeclaration == null) {
- throw new ParseException("enum " + enumName //$NON-NLS-1$
- + " is not defined"); //$NON-NLS-1$
- }
- } else {
- /* !Name and !body */
- throw new ParseException("enum with no name and no body"); //$NON-NLS-1$
- }
- }
-
- return enumDeclaration;
-
- }
-
- /**
- * Parses an enum body, adding the enumerators to the specified enum
- * declaration.
- *
- * @param enumBody
- * An ENUM_BODY node.
- * @param enumDeclaration
- * The enum declaration.
- * @throws ParseException
- */
- private void parseEnumBody(CommonTree enumBody,
- EnumDeclaration enumDeclaration) throws ParseException {
-
- List<CommonTree> enumerators = enumBody.getChildren();
- /* enum body can't be empty (unlike struct). */
-
- pushScope();
-
- /*
- * Start at -1, so that if the first enumrator has no explicit value, it
- * will choose 0
- */
- long lastHigh = -1;
-
- for (CommonTree enumerator : enumerators) {
- lastHigh = parseEnumEnumerator(enumerator, enumDeclaration,
- lastHigh);
- }
-
- popScope();
-
- }
-
- /**
- * Parses an enumerator node and adds an enumerator declaration to an
- * enumeration declaration.
- *
- * The high value of the range of the last enumerator is needed in case the
- * current enumerator does not specify its value.
- *
- * @param enumerator
- * An ENUM_ENUMERATOR node.
- * @param enumDeclaration
- * en enumeration declaration to which will be added the
- * enumerator.
- * @param lastHigh
- * The high value of the range of the last enumerator
- * @return The high value of the value range of the current enumerator.
- * @throws ParseException
- */
- private static long parseEnumEnumerator(CommonTree enumerator,
- EnumDeclaration enumDeclaration, long lastHigh)
- throws ParseException {
-
- List<CommonTree> children = enumerator.getChildren();
-
- long low = 0, high = 0;
- boolean valueSpecified = false;
- String label = null;
-
- for (CommonTree child : children) {
- if (isAnyUnaryString(child)) {
- label = parseUnaryString(child);
- } else if (child.getType() == CTFParser.ENUM_VALUE) {
-
- valueSpecified = true;
-
- low = parseUnaryInteger((CommonTree) child.getChild(0));
- high = low;
- } else if (child.getType() == CTFParser.ENUM_VALUE_RANGE) {
-
- valueSpecified = true;
-
- low = parseUnaryInteger((CommonTree) child.getChild(0));
- high = parseUnaryInteger((CommonTree) child.getChild(1));
- } else {
- throw childTypeError(child);
- }
- }
-
- if (!valueSpecified) {
- low = lastHigh + 1;
- high = low;
- }
-
- if (low > high) {
- throw new ParseException("enum low value greater than high value"); //$NON-NLS-1$
- }
-
- if (!enumDeclaration.add(low, high, label)) {
- throw new ParseException("enum declarator values overlap."); //$NON-NLS-1$
- }
-
- if (valueSpecified && (BigInteger.valueOf(low).compareTo(enumDeclaration.getContainerType().getMinValue()) == -1 ||
- BigInteger.valueOf(high).compareTo(enumDeclaration.getContainerType().getMaxValue()) == 1)) {
- throw new ParseException("enum value is not in range"); //$NON-NLS-1$
- }
-
- return high;
- }
-
- /**
- * Parses an enum container type node and returns the corresponding integer
- * type.
- *
- * @param enumContainerType
- * An ENUM_CONTAINER_TYPE node.
- * @return An integer declaration corresponding to the container type.
- * @throws ParseException
- * If the type does not parse correctly or if it is not an
- * integer type.
- */
- private IntegerDeclaration parseEnumContainerType(
- CommonTree enumContainerType) throws ParseException {
-
- /* Get the child, which should be a type specifier list */
- CommonTree typeSpecifierList = (CommonTree) enumContainerType.getChild(0);
-
- /* Parse it and get the corresponding declaration */
- IDeclaration decl = parseTypeSpecifierList(typeSpecifierList, null);
-
- /* If is is an integer, return it, else throw an error */
- if (decl instanceof IntegerDeclaration) {
- return (IntegerDeclaration) decl;
- }
- throw new ParseException("enum container type must be an integer"); //$NON-NLS-1$
- }
-
- private VariantDeclaration parseVariant(CommonTree variant)
- throws ParseException {
-
- List<CommonTree> children = variant.getChildren();
- VariantDeclaration variantDeclaration = null;
-
- boolean hasName = false;
- String variantName = null;
-
- boolean hasBody = false;
- CommonTree variantBody = null;
-
- boolean hasTag = false;
- String variantTag = null;
-
- for (CommonTree child : children) {
- switch (child.getType()) {
- case CTFParser.VARIANT_NAME:
-
- hasName = true;
-
- CommonTree variantNameIdentifier = (CommonTree) child.getChild(0);
-
- variantName = variantNameIdentifier.getText();
-
- break;
- case CTFParser.VARIANT_TAG:
-
- hasTag = true;
-
- CommonTree variantTagIdentifier = (CommonTree) child.getChild(0);
-
- variantTag = variantTagIdentifier.getText();
-
- break;
- case CTFParser.VARIANT_BODY:
-
- hasBody = true;
-
- variantBody = child;
-
- break;
- default:
- throw childTypeError(child);
- }
- }
-
- if (hasBody) {
- /*
- * If variant has a name, check if already defined in the current
- * scope.
- */
- if (hasName
- && (getCurrentScope().lookupVariant(variantName) != null)) {
- throw new ParseException("variant " + variantName //$NON-NLS-1$
- + " already defined."); //$NON-NLS-1$
- }
-
- /* Create the declaration */
- variantDeclaration = new VariantDeclaration();
-
- /* Parse the body */
- parseVariantBody(variantBody, variantDeclaration);
-
- /* If variant has name, add it to the current scope. */
- if (hasName) {
- getCurrentScope().registerVariant(variantName,
- variantDeclaration);
- }
- } else /* !hasBody */{
- if (hasName) {
- /* Name and !body */
-
- /* Lookup the name in the current scope. */
- variantDeclaration = getCurrentScope().lookupVariantRecursive(
- variantName);
-
- /*
- * If not found, it means that a struct with such name has not
- * been defined
- */
- if (variantDeclaration == null) {
- throw new ParseException("variant " + variantName //$NON-NLS-1$
- + " is not defined"); //$NON-NLS-1$
- }
- } else {
- /* !Name and !body */
-
- /* We can't do anything with that. */
- throw new ParseException("variant with no name and no body"); //$NON-NLS-1$
- }
- }
-
- if (hasTag) {
- variantDeclaration.setTag(variantTag);
-
- IDeclaration decl = getCurrentScope().lookupIdentifierRecursive(variantTag);
- if (decl == null) {
- throw new ParseException("Variant tag not found: " + variantTag); //$NON-NLS-1$
- }
- if (!(decl instanceof EnumDeclaration)) {
- throw new ParseException("Variant tag must be an enum: " + variantTag); //$NON-NLS-1$
- }
- EnumDeclaration tagDecl = (EnumDeclaration) decl;
- Set<String> intersection = new HashSet<>(tagDecl.getLabels());
- intersection.retainAll(variantDeclaration.getFields().keySet());
- if (intersection.isEmpty()) {
- throw new ParseException("Variant contains no values of the tag, impossible to use: " + variantName); //$NON-NLS-1$
- }
- }
-
- return variantDeclaration;
- }
-
- private void parseVariantBody(CommonTree variantBody,
- VariantDeclaration variantDeclaration) throws ParseException {
-
- List<CommonTree> variantDeclarations = variantBody.getChildren();
-
- pushScope();
-
- for (CommonTree declarationNode : variantDeclarations) {
- switch (declarationNode.getType()) {
- case CTFParser.TYPEALIAS:
- parseTypealias(declarationNode);
- break;
- case CTFParser.TYPEDEF:
- parseTypedef(declarationNode);
- break;
- case CTFParser.SV_DECLARATION:
- parseVariantDeclaration(declarationNode, variantDeclaration);
- break;
- default:
- throw childTypeError(declarationNode);
- }
- }
-
- popScope();
- }
-
- private void parseVariantDeclaration(CommonTree declaration,
- VariantDeclaration variant) throws ParseException {
-
- /* Get the type specifier list node */
- CommonTree typeSpecifierListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_SPECIFIER_LIST);
-
- /* Get the type declarator list node */
- CommonTree typeDeclaratorListNode = (CommonTree) declaration.getFirstChildWithType(CTFParser.TYPE_DECLARATOR_LIST);
-
- /* Get the type declarator list */
- List<CommonTree> typeDeclaratorList = typeDeclaratorListNode.getChildren();
-
- /*
- * For each type declarator, parse the declaration and add a field to
- * the variant
- */
- for (CommonTree typeDeclaratorNode : typeDeclaratorList) {
-
- StringBuilder identifierSB = new StringBuilder();
-
- IDeclaration decl = parseTypeDeclarator(typeDeclaratorNode,
- typeSpecifierListNode, identifierSB);
-
- String name = identifierSB.toString();
-
- if (variant.hasField(name)) {
- throw new ParseException("variant: duplicate field " //$NON-NLS-1$
- + name);
- }
-
- getCurrentScope().registerIdentifier(name, decl);
-
- variant.addField(name, decl);
- }
- }
-
- /**
- * Creates the string representation of a type declaration (type specifier
- * list + pointers).
- *
- * @param typeSpecifierList
- * A TYPE_SPECIFIER_LIST node.
- * @param pointers
- * A list of POINTER nodes.
- * @return The string representation.
- * @throws ParseException
- */
- private static String createTypeDeclarationString(
- CommonTree typeSpecifierList, List<CommonTree> pointers)
- throws ParseException {
- StringBuilder sb = new StringBuilder();
-
- createTypeSpecifierListString(typeSpecifierList, sb);
- createPointerListString(pointers, sb);
-
- return sb.toString();
- }
-
- /**
- * Creates the string representation of a list of type specifiers.
- *
- * @param typeSpecifierList
- * A TYPE_SPECIFIER_LIST node.
- * @param sb
- * A StringBuilder to which will be appended the string.
- * @throws ParseException
- */
- private static void createTypeSpecifierListString(
- CommonTree typeSpecifierList, StringBuilder sb)
- throws ParseException {
-
- List<CommonTree> children = typeSpecifierList.getChildren();
-
- boolean firstItem = true;
-
- for (CommonTree child : children) {
- if (!firstItem) {
- sb.append(' ');
-
- }
-
- firstItem = false;
-
- /* Append the string that represents this type specifier. */
- createTypeSpecifierString(child, sb);
- }
- }
-
- /**
- * Creates the string representation of a type specifier.
- *
- * @param typeSpecifier
- * A TYPE_SPECIFIER node.
- * @param sb
- * A StringBuilder to which will be appended the string.
- * @throws ParseException
- */
- private static void createTypeSpecifierString(CommonTree typeSpecifier,
- StringBuilder sb) throws ParseException {
- switch (typeSpecifier.getType()) {
- case CTFParser.FLOATTOK:
- case CTFParser.INTTOK:
- case CTFParser.LONGTOK:
- case CTFParser.SHORTTOK:
- case CTFParser.SIGNEDTOK:
- case CTFParser.UNSIGNEDTOK:
- case CTFParser.CHARTOK:
- case CTFParser.DOUBLETOK:
- case CTFParser.VOIDTOK:
- case CTFParser.BOOLTOK:
- case CTFParser.COMPLEXTOK:
- case CTFParser.IMAGINARYTOK:
- case CTFParser.CONSTTOK:
- case CTFParser.IDENTIFIER:
- sb.append(typeSpecifier.getText());
- break;
- case CTFParser.STRUCT: {
- CommonTree structName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.STRUCT_NAME);
- if (structName == null) {
- throw new ParseException("nameless struct found in createTypeSpecifierString"); //$NON-NLS-1$
- }
-
- CommonTree structNameIdentifier = (CommonTree) structName.getChild(0);
-
- sb.append(structNameIdentifier.getText());
- break;
- }
- case CTFParser.VARIANT: {
- CommonTree variantName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.VARIANT_NAME);
- if (variantName == null) {
- throw new ParseException("nameless variant found in createTypeSpecifierString"); //$NON-NLS-1$
- }
-
- CommonTree variantNameIdentifier = (CommonTree) variantName.getChild(0);
-
- sb.append(variantNameIdentifier.getText());
- break;
- }
- case CTFParser.ENUM: {
- CommonTree enumName = (CommonTree) typeSpecifier.getFirstChildWithType(CTFParser.ENUM_NAME);
- if (enumName == null) {
- throw new ParseException("nameless enum found in createTypeSpecifierString"); //$NON-NLS-1$
- }
-
- CommonTree enumNameIdentifier = (CommonTree) enumName.getChild(0);
-
- sb.append(enumNameIdentifier.getText());
- break;
- }
- case CTFParser.FLOATING_POINT:
- case CTFParser.INTEGER:
- case CTFParser.STRING:
- throw new ParseException("CTF type found in createTypeSpecifierString"); //$NON-NLS-1$
- default:
- throw childTypeError(typeSpecifier);
- }
- }
-
- /**
- * Creates the string representation of a list of pointers.
- *
- * @param pointerList
- * A list of pointer nodes. If pointerList is null, this function
- * does nothing.
- * @param sb
- * A stringbuilder to which will be appended the string.
- */
- private static void createPointerListString(List<CommonTree> pointerList,
- StringBuilder sb) {
- if (pointerList == null) {
- return;
- }
-
- for (CommonTree pointer : pointerList) {
-
- sb.append(" *"); //$NON-NLS-1$
- if (pointer.getChildCount() > 0) {
-
- sb.append(" const"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * @param node
- * The node to check.
- * @return True if the given node is an unary string.
- */
- private static boolean isUnaryString(CommonTree node) {
- return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING));
- }
-
- /**
- * @param node
- * The node to check.
- * @return True if the given node is any type of unary string (no quotes,
- * quotes, etc).
- */
- private static boolean isAnyUnaryString(CommonTree node) {
- return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING) || (node.getType() == CTFParser.UNARY_EXPRESSION_STRING_QUOTES));
- }
-
- /**
- * @param node
- * The node to check.
- * @return True if the given node is an unary integer.
- */
- private static boolean isUnaryInteger(CommonTree node) {
- return ((node.getType() == CTFParser.UNARY_EXPRESSION_DEC) ||
- (node.getType() == CTFParser.UNARY_EXPRESSION_HEX) || (node.getType() == CTFParser.UNARY_EXPRESSION_OCT));
- }
-
- /**
- * Parses a unary string node and return the string value.
- *
- * @param unaryString
- * The unary string node to parse (type UNARY_EXPRESSION_STRING
- * or UNARY_EXPRESSION_STRING_QUOTES).
- * @return The string value.
- */
- /*
- * It would be really nice to remove the quotes earlier, such as in the
- * parser.
- */
- private static String parseUnaryString(CommonTree unaryString) {
-
- CommonTree value = (CommonTree) unaryString.getChild(0);
- String strval = value.getText();
-
- /* Remove quotes */
- if (unaryString.getType() == CTFParser.UNARY_EXPRESSION_STRING_QUOTES) {
- strval = strval.substring(1, strval.length() - 1);
- }
-
- return strval;
- }
-
- /**
- * Parses an unary integer (dec, hex or oct).
- *
- * @param unaryInteger
- * An unary integer node.
- * @return The integer value.
- * @throws ParseException
- * on an invalid integer format ("bob" for example)
- */
- private static long parseUnaryInteger(CommonTree unaryInteger) throws ParseException {
-
- List<CommonTree> children = unaryInteger.getChildren();
- CommonTree value = children.get(0);
- String strval = value.getText();
-
- long intval;
- try {
- intval = Long.decode(strval);
- } catch (NumberFormatException e) {
- throw new ParseException("Invalid integer format: " + strval, e); //$NON-NLS-1$
- }
-
- /* The rest of children are sign */
- if ((children.size() % 2) == 0) {
- return -intval;
- }
- return intval;
- }
-
- private static long getMajorOrMinor(CommonTree rightNode)
- throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryInteger(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
- }
-
- long m = parseUnaryInteger(firstChild);
-
- if (m < 0) {
- throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
- }
-
- return m;
- }
- throw new ParseException("Invalid value for major/minor"); //$NON-NLS-1$
- }
-
- private static UUID getUUID(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isAnyUnaryString(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("Invalid value for UUID"); //$NON-NLS-1$
- }
-
- String uuidstr = parseUnaryString(firstChild);
-
- try {
- return UUID.fromString(uuidstr);
- } catch (IllegalArgumentException e) {
- throw new ParseException("Invalid format for UUID", e); //$NON-NLS-1$
- }
- }
- throw new ParseException("Invalid value for UUID"); //$NON-NLS-1$
- }
-
- /**
- * Gets the value of a "signed" integer attribute.
- *
- * @param rightNode
- * A CTF_RIGHT node.
- * @return The "signed" value as a boolean.
- * @throws ParseException
- */
- private static boolean getSigned(CommonTree rightNode)
- throws ParseException {
-
- boolean ret = false;
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryString(firstChild)) {
- String strval = concatenateUnaryStrings(rightNode.getChildren());
-
- if (strval.equals(MetadataStrings.TRUE)
- || strval.equals(MetadataStrings.TRUE2)) {
- ret = true;
- } else if (strval.equals(MetadataStrings.FALSE)
- || strval.equals(MetadataStrings.FALSE2)) {
- ret = false;
- } else {
- throw new ParseException("Invalid boolean value " //$NON-NLS-1$
- + firstChild.getChild(0).getText());
- }
- } else if (isUnaryInteger(firstChild)) {
- /* Happens if the value is something like "1234.hello" */
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("Invalid boolean value"); //$NON-NLS-1$
- }
-
- long intval = parseUnaryInteger(firstChild);
-
- if (intval == 1) {
- ret = true;
- } else if (intval == 0) {
- ret = false;
- } else {
- throw new ParseException("Invalid boolean value " //$NON-NLS-1$
- + firstChild.getChild(0).getText());
- }
- } else {
- throw new ParseException();
- }
-
- return ret;
- }
-
- /**
- * Gets the value of a "byte_order" integer attribute.
- *
- * @param rightNode
- * A CTF_RIGHT node.
- * @return The "byte_order" value.
- * @throws ParseException
- */
- private ByteOrder getByteOrder(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryString(firstChild)) {
- String strval = concatenateUnaryStrings(rightNode.getChildren());
-
- if (strval.equals(MetadataStrings.LE)) {
- return ByteOrder.LITTLE_ENDIAN;
- } else if (strval.equals(MetadataStrings.BE)
- || strval.equals(MetadataStrings.NETWORK)) {
- return ByteOrder.BIG_ENDIAN;
- } else if (strval.equals(MetadataStrings.NATIVE)) {
- return fTrace.getByteOrder();
- } else {
- throw new ParseException("Invalid value for byte order"); //$NON-NLS-1$
- }
- }
- throw new ParseException("Invalid value for byte order"); //$NON-NLS-1$
- }
-
- /**
- * Determines if the given value is a valid alignment value.
- *
- * @param alignment
- * The value to check.
- * @return True if it is valid.
- */
- private static boolean isValidAlignment(long alignment) {
- return !((alignment <= 0) || ((alignment & (alignment - 1)) != 0));
- }
-
- /**
- * Gets the value of a "size" integer attribute.
- *
- * @param rightNode
- * A CTF_RIGHT node.
- * @return The "size" value.
- * @throws ParseException
- */
- private static long getSize(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryInteger(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("Invalid value for size"); //$NON-NLS-1$
- }
-
- long size = parseUnaryInteger(firstChild);
-
- if (size < 1) {
- throw new ParseException("Invalid value for size"); //$NON-NLS-1$
- }
-
- return size;
- }
- throw new ParseException("Invalid value for size"); //$NON-NLS-1$
- }
-
- /**
- * Gets the value of a "align" integer or struct attribute.
- *
- * @param node
- * A CTF_RIGHT node or directly an unary integer.
- * @return The align value.
- * @throws ParseException
- */
- private static long getAlignment(CommonTree node) throws ParseException {
-
- /*
- * If a CTF_RIGHT node was passed, call getAlignment with the first
- * child
- */
- if (node.getType() == CTFParser.CTF_RIGHT) {
- if (node.getChildCount() > 1) {
- throw new ParseException("Invalid alignment value"); //$NON-NLS-1$
- }
-
- return getAlignment((CommonTree) node.getChild(0));
- } else if (isUnaryInteger(node)) {
- long alignment = parseUnaryInteger(node);
-
- if (!isValidAlignment(alignment)) {
- throw new ParseException("Invalid value for alignment : " //$NON-NLS-1$
- + alignment);
- }
-
- return alignment;
- }
- throw new ParseException("Invalid value for alignment"); //$NON-NLS-1$
- }
-
- /**
- * Gets the value of a "base" integer attribute.
- *
- * @param rightNode
- * An CTF_RIGHT node.
- * @return The "base" value.
- * @throws ParseException
- */
- private static int getBase(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryInteger(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("invalid base value"); //$NON-NLS-1$
- }
-
- long intval = parseUnaryInteger(firstChild);
- if ((intval == INTEGER_BASE_2) || (intval == INTEGER_BASE_8) || (intval == INTEGER_BASE_10)
- || (intval == INTEGER_BASE_16)) {
- return (int) intval;
- }
- throw new ParseException("Invalid value for base"); //$NON-NLS-1$
- } else if (isUnaryString(firstChild)) {
- switch (concatenateUnaryStrings(rightNode.getChildren())) {
- case MetadataStrings.DECIMAL:
- case MetadataStrings.DEC:
- case MetadataStrings.DEC_CTE:
- case MetadataStrings.INT_MOD:
- case MetadataStrings.UNSIGNED_CTE:
- return INTEGER_BASE_10;
- case MetadataStrings.HEXADECIMAL:
- case MetadataStrings.HEX:
- case MetadataStrings.X:
- case MetadataStrings.X2:
- case MetadataStrings.POINTER:
- return INTEGER_BASE_16;
- case MetadataStrings.OCT:
- case MetadataStrings.OCTAL:
- case MetadataStrings.OCTAL_CTE:
- return INTEGER_BASE_8;
- case MetadataStrings.BIN:
- case MetadataStrings.BINARY:
- return INTEGER_BASE_2;
- default:
- throw new ParseException("Invalid value for base"); //$NON-NLS-1$
- }
- } else {
- throw new ParseException("invalid value for base"); //$NON-NLS-1$
- }
- }
-
- /**
- * Gets the value of an "encoding" integer attribute.
- *
- * @param rightNode
- * A CTF_RIGHT node.
- * @return The "encoding" value.
- * @throws ParseException
- */
- @NonNull
- private static Encoding getEncoding(CommonTree rightNode)
- throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryString(firstChild)) {
- String strval = concatenateUnaryStrings(rightNode.getChildren());
-
- if (strval.equals(MetadataStrings.UTF8)) {
- return Encoding.UTF8;
- } else if (strval.equals(MetadataStrings.ASCII)) {
- return Encoding.ASCII;
- } else if (strval.equals(MetadataStrings.NONE)) {
- return Encoding.NONE;
- } else {
- throw new ParseException("Invalid value for encoding"); //$NON-NLS-1$
- }
- }
- throw new ParseException("Invalid value for encoding"); //$NON-NLS-1$
- }
-
- private static long getStreamID(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryInteger(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("invalid value for stream id"); //$NON-NLS-1$
- }
-
- long intval = parseUnaryInteger(firstChild);
-
- return intval;
- }
- throw new ParseException("invalid value for stream id"); //$NON-NLS-1$
- }
-
- private static String getEventName(CommonTree rightNode)
- throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isAnyUnaryString(firstChild)) {
- String str = concatenateUnaryStrings(rightNode.getChildren());
-
- return str;
- }
- throw new ParseException("invalid value for event name"); //$NON-NLS-1$
- }
-
- private static long getEventID(CommonTree rightNode) throws ParseException {
-
- CommonTree firstChild = (CommonTree) rightNode.getChild(0);
-
- if (isUnaryInteger(firstChild)) {
- if (rightNode.getChildCount() > 1) {
- throw new ParseException("invalid value for event id"); //$NON-NLS-1$
- }
-
- long intval = parseUnaryInteger(firstChild);
- if (intval > Integer.MAX_VALUE) {
- throw new ParseException("Event id larger than int.maxvalue, something is amiss"); //$NON-NLS-1$
- }
- return intval;
- }
- throw new ParseException("invalid value for event id"); //$NON-NLS-1$
- }
-
- /**
- * Concatenates a list of unary strings separated by arrows (->) or dots.
- *
- * @param strings
- * A list, first element being an unary string, subsequent
- * elements being ARROW or DOT nodes with unary strings as child.
- * @return The string representation of the unary string chain.
- */
- private static String concatenateUnaryStrings(List<CommonTree> strings) {
-
- StringBuilder sb = new StringBuilder();
-
- CommonTree first = strings.get(0);
- sb.append(parseUnaryString(first));
-
- boolean isFirst = true;
-
- for (CommonTree ref : strings) {
- if (isFirst) {
- isFirst = false;
- continue;
- }
-
- CommonTree id = (CommonTree) ref.getChild(0);
-
- if (ref.getType() == CTFParser.ARROW) {
- sb.append("->"); //$NON-NLS-1$
- } else { /* DOT */
- sb.append('.');
- }
-
- sb.append(parseUnaryString(id));
- }
-
- return sb.toString();
- }
-
- /**
- * Throws a ParseException stating that the parent-child relation between
- * the given node and its parent is not valid. It means that the shape of
- * the AST is unexpected.
- *
- * @param child
- * The invalid child node.
- * @return ParseException with details
- */
- private static ParseException childTypeError(CommonTree child) {
- CommonTree parent = (CommonTree) child.getParent();
- String error = "Parent " + CTFParser.tokenNames[parent.getType()] //$NON-NLS-1$
- + " can't have a child of type " //$NON-NLS-1$
- + CTFParser.tokenNames[child.getType()] + "."; //$NON-NLS-1$
-
- return new ParseException(error);
- }
-
- // ------------------------------------------------------------------------
- // Scope management
- // ------------------------------------------------------------------------
-
- /**
- * Adds a new declaration scope on the top of the scope stack.
- */
- private void pushScope() {
- fScope = new DeclarationScope(fScope);
- }
-
- /**
- * Removes the top declaration scope from the scope stack.
- */
- private void popScope() {
- fScope = fScope.getParentScope();
- }
-
- /**
- * Returns the current declaration scope.
- *
- * @return The current declaration scope.
- */
- private DeclarationScope getCurrentScope() {
- return fScope;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Marc-Andre Laperle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
-
-import org.eclipse.osgi.util.NLS;
-
-@SuppressWarnings("javadoc")
-public final class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.ctf.core.event.metadata.messages"; //$NON-NLS-1$
-
- public static String IOStructGen_UnknownTraceAttributeWarning;
- public static String IOStructGen_UnknownStreamAttributeWarning;
- public static String IOStructGen_UnknownIntegerAttributeWarning;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata;
-
-/**
- * Strings generated from the TSDL grammar. Note that they are static final so
- * they get quarked. See CTF specs for more details
- *
- * @author Matthew Khouzam and All
- */
-@SuppressWarnings("nls")
-public interface MetadataStrings {
-
- /** None */
-
- String NONE = "none";
- /** Ascii */
- String ASCII = "ASCII";
- /** UTF8 */
- String UTF8 = "UTF8";
- /** b (for binary like b11010010 */
- String BIN = "b";
- /** Binary */
- String BINARY = "binary";
- /** Octal like o177 */
- String OCTAL_CTE = "o";
- /** Octal like oct177 */
- String OCT = "oct";
- /** Octal like octal177 */
- String OCTAL = "octal";
- /** Pointer (memory address for all the hardcore Java gurus out there)*/
- String POINTER = "p";
- /** X for hex */
- String X2 = "X";
- /** x for hex */
- String X = "x";
- /** hex */
- String HEX = "hex";
- /** Hexadecimal */
- String HEXADECIMAL = "hexadecimal";
- /** unsigned like in 10000ul */
- String UNSIGNED_CTE = "u";
- /** Decimal */
- String DEC_CTE = "d";
- /** Integer like 1000i */
- String INT_MOD = "i";
- /** Decimal */
- String DEC = "dec";
- /** Decimal */
- String DECIMAL = "decimal";
- /** native for byteorders*/
- String NATIVE = "native";
- /** network for byteorders*/
- String NETWORK = "network";
- /** Big endian */
- String BE = "be";
- /** Little endian */
- String LE = "le";
- /** Alignment of a field */
- String ALIGN = "align";
- /** Mantissa digits */
- String MANT_DIG = "mant_dig";
- /** Exponent digits */
- String EXP_DIG = "exp_dig";
- /** Loglevel */
- String LOGLEVEL2 = "loglevel";
- /** Name */
- String NAME2 = "name";
- /** Event context */
- String EVENT_CONTEXT = "event.context";
- /** Fields */
- String FIELDS_STRING = "fields";
- /** context */
- String CONTEXT = "context";
- /** Stream ID */
- String STREAM_ID = "stream_id";
- /** Packet context */
- String PACKET_CONTEXT = "packet.context";
- /** ID */
- String ID = "id";
- /** Packet Header */
- String PACKET_HEADER = "packet.header";
- /** Event Header */
- String EVENT_HEADER = "event.header";
- /** Byte order */
- String BYTE_ORDER = "byte_order";
- /** UUID */
- String UUID_STRING = "uuid";
- /** False */
- String FALSE2 = "FALSE";
- /** False */
- String FALSE = "false";
- /** True */
- String TRUE2 = "TRUE";
- /** True */
- String TRUE = "true";
- /** Minor (Version)*/
- String MINOR = "minor";
- /** Major (Version)*/
- String MAJOR = "major";
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- * Matthew Khouzam - Addition to have more descriptive errors
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;
-
-import java.lang.reflect.Field;
-
-import org.antlr.runtime.MismatchedTokenException;
-import org.antlr.runtime.RecognitionException;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.parser.CTFLexer;
-
-/**
- * CTF Reader exception but dealing with Antlr-specific parsing problems.
- *
- * It is separated from the main {@link CTFException} - and is not part of the
- * API - to isolate the Antlr-specific classes and avoid pushing that dependency
- * to the users of this plugin.
- *
- * @author Matthew Khouzam
- */
-public class CtfAntlrException extends CTFException {
-
- private static final long serialVersionUID = -7078624493350073777L;
-
- private final int fErrorLine;
- private final String fFile;
- private String fExpectingName = ""; //$NON-NLS-1$
- private int fExpectedValue = -1;
- private String fActualName = ""; //$NON-NLS-1$
- private int fActualValue = -1;
-
- private final int fCharPositionInLine;
-
- /**
- * Re-throw the exception but read its data
- *
- * @param e
- * the previous recognition exception (Antlr specific)
- */
- public CtfAntlrException(MismatchedTokenException e) {
- super(e);
- fErrorLine = e.line;
- fCharPositionInLine = e.charPositionInLine;
- fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
- parseMismatchedException(e);
- }
-
- /**
- * Re-throw the exception but read its data
- *
- * @param e
- * the previous recognition exception (Antlr specific)
- */
- public CtfAntlrException(RecognitionException e) {
- super(e);
- fErrorLine = e.line;
- fCharPositionInLine = e.charPositionInLine;
- fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
- }
-
- /**
- * Re-throw the exception but read its data
- *
- * @param e
- * the previous rewrite exception (Antlr specific)
- */
- public CtfAntlrException(Exception e) {
- super(e);
- fErrorLine = -1;
- fCharPositionInLine = -1;
- fFile = "metadata"; //$NON-NLS-1$ // we're in CTF, the only thing using antlr is metadata
- }
-
- private void parseMismatchedException(MismatchedTokenException m) {
- // Iterate through the tokens that are hidden in the CTFLexer
- // They are private static final int fields.
- for (Field f : CTFLexer.class.getDeclaredFields()) {
- f.setAccessible(true);
- String name;
- int value;
- try {
- name = f.getName();
- final boolean isInt = (f.getType().isPrimitive());
- if (isInt) {
- value = ((Integer) f.get(null)).intValue();
- if (value == m.expecting) {
- this.fExpectingName = name;
- this.fExpectedValue = value;
- }
- if (value == m.c) {
- this.fActualName = name;
- this.fActualValue = value;
- }
- }
- } catch (NullPointerException e1) {
- // Pokemon, gotta catch em all!
- // actually useful since f may not have a
- // value
- } catch (IllegalArgumentException e1) {
- // Catch these exceptions (reflexion)
- } catch (IllegalAccessException e1) {
- // Catch these exceptions (reflexion)
- }
- if (!this.fExpectingName.isEmpty() && !this.fActualName.isEmpty()) {
- return;
- }
- }
- }
-
- @Override
- public String getMessage() {
- final String message = super.getMessage();
- if (fErrorLine == -1) {
- return message;
- }
- String expected = "" + this.fExpectedValue; //$NON-NLS-1$
- String actual = "" + this.fActualValue; //$NON-NLS-1$
- String newMessage = message.replaceAll(expected, this.fExpectingName);
- newMessage = newMessage.replaceAll(actual, this.fActualName);
- return newMessage + " at " + fFile + ":" + fErrorLine + ":" + fCharPositionInLine; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions;
-
-
-/**
- * <b><u>ParseException</u></b>
- */
-public class ParseException extends Exception {
-
- private static final long serialVersionUID = 7901917601459652080L;
-
- /**
- * Empty constructor
- */
- public ParseException() {
- super();
- }
-
- /**
- * Constructor
- *
- * @param message to be sent to logs
- */
- public ParseException(String message) {
- super(message);
- }
-
- /**
- * Copy constructor
- * @param e the exception to throw
- */
- public ParseException(Exception e) {
- super(e);
- }
-
- /**
- * Constructs a new exception with the specified detail message and
- * cause. <p>Note that the detail message associated with
- * {@code cause} is <i>not</i> automatically incorporated in
- * this exception's detail message.
- *
- * @param message the detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method).
- * @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
- * permitted, and indicates that the cause is nonexistent or
- * unknown.)
- */
- public ParseException(String message, Exception cause) {
- super(message, cause);
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Marc-Andre Laperle - Initial API and implementation
-# Alexandre Montplaisir - Added strings from DeclarationScope
-###############################################################################
-
-#IOStructGen
-IOStructGen_UnknownTraceAttributeWarning=Unknown trace attribute:
-IOStructGen_UnknownStreamAttributeWarning=Unknown stream attribute:
-IOStructGen_UnknownIntegerAttributeWarning=Unknown integer attribute:
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-
-/**
- * A CTF array declaration
- *
- * Arrays are fixed-length. Their length is declared in the type declaration
- * within the meta-data. They contain an array of "inner type" elements, which
- * can refer to any type not containing the type of the array being declared (no
- * circular dependency). The length is the number of elements in an array.
- *
- * @author Matthew Khouzam
- */
-public final class ArrayDeclaration extends CompoundDeclaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final int fLength;
- private final IDeclaration fElemType;
-
- /**
- * <pre>
- * Cache where we can pre-generate the children names
- * Key: parent name
- * Value: children names
- * ex: field → {field[0], field[1], … field[n]}
- * </pre>
- *
- * TODO: investigate performance
- */
- private final transient ArrayListMultimap<String, String> fChildrenNames = ArrayListMultimap.create();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param length
- * how many elements in the array
- * @param elemType
- * what type of element is in the array
- */
- public ArrayDeclaration(int length, IDeclaration elemType) {
- fLength = length;
- fElemType = elemType;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public IDeclaration getElementType() {
- return fElemType;
- }
-
- /**
- * Get the length of the array
- *
- * @return the length of the array
- */
- public int getLength() {
- return fLength;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public AbstractArrayDefinition createDefinition(@Nullable IDefinitionScope definitionScope,
- @NonNull String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- if (isAlignedBytes()) {
- byte[] data = new byte[fLength];
- if (input.getByteBuffer().remaining() < fLength) {
- throw new CTFException("Buffer underflow"); //$NON-NLS-1$
- }
- input.get(data);
-
- return new ByteArrayDefinition(this, definitionScope, fieldName, data);
- }
- @NonNull List<Definition> definitions = read(input, definitionScope, fieldName);
- return new ArrayDefinition(this, definitionScope, fieldName, definitions);
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
- }
-
- private @NonNull List<Definition> read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFException {
- Builder<Definition> definitions = new ImmutableList.Builder<>();
- if (!fChildrenNames.containsKey(fieldName)) {
- for (int i = 0; i < fLength; i++) {
- fChildrenNames.put(fieldName, fieldName + '[' + i + ']');
- }
- }
- List<String> elemNames = fChildrenNames.get(fieldName);
- for (int i = 0; i < fLength; i++) {
- String name = elemNames.get(i);
- if (name == null) {
- throw new IllegalStateException();
- }
- definitions.add(fElemType.createDefinition(definitionScope, name, input));
- }
- return checkNotNull(definitions.build());
- }
-
- @Override
- public int getMaximumSize() {
- long val = (long) fLength * fElemType.getMaximumSize();
- return (int) Math.min(Integer.MAX_VALUE, val);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + fElemType.hashCode();
- result = prime * result + fLength;
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ArrayDeclaration other = (ArrayDeclaration) obj;
- if (!fElemType.equals(other.fElemType)) {
- return false;
- }
- if (fLength != other.fLength) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ArrayDeclaration other = (ArrayDeclaration) obj;
- if (!fElemType.isBinaryEquivalent(other.fElemType)) {
- return false;
- }
- if (fLength != other.fLength) {
- return false;
- }
- return true;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A CTF array definition
- *
- * Arrays are fixed-length. Their length is declared in the type declaration
- * within the meta-data. They contain an array of "inner type" elements, which
- * can refer to any type not containing the type of the array being declared (no
- * circular dependency). The length is the number of elements in an array.
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class ArrayDefinition extends AbstractArrayDefinition {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final List<Definition> fDefinitions;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param declaration
- * the parent declaration
- * @param definitionScope
- * the parent scope
- * @param fieldName
- * the field name
- * @param definitions
- * the content of the array
- */
- public ArrayDefinition(CompoundDeclaration declaration,
- @Nullable IDefinitionScope definitionScope,
- String fieldName,
- List<Definition> definitions) {
- super(declaration, definitionScope, fieldName);
- fDefinitions = checkNotNull(ImmutableList.copyOf(definitions));
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public List<Definition> getDefinitions() {
- return fDefinitions;
- }
-
- @Override
- public int getLength() {
- return fDefinitions.size();
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public String toString() {
- StringBuilder b = new StringBuilder();
- b.append('[');
- Joiner joiner = Joiner.on(", ").skipNulls(); //$NON-NLS-1$
- b.append(joiner.join(fDefinitions));
- b.append(']');
- return checkNotNull(b.toString());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-
-/**
- * A fixed length string definition
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class ByteArrayDefinition extends AbstractArrayDefinition {
-
- private final byte[] fContent;
- private transient @Nullable List<Definition> fDefs;
-
- /**
- * An fixed length string declaration, it's created by sequence or array
- * defintions
- *
- * @param declaration
- * the declaration
- * @param definitionScope
- * the definition scope
- * @param fieldName
- * the field name
- * @param content
- * the string content
- */
- public ByteArrayDefinition(CompoundDeclaration declaration,
- @Nullable IDefinitionScope definitionScope,
- String fieldName,
- byte[] content) {
- super(declaration, definitionScope, fieldName);
- fContent = content;
-
- }
-
- @Override
- public int getLength() {
- return fContent.length;
- }
-
- @Override
- public synchronized List<Definition> getDefinitions() {
- List<Definition> defs = fDefs;
- if (defs == null) {
- ImmutableList.Builder<Definition> builder = new ImmutableList.Builder<>();
- for (int i = 0; i < fContent.length; i++) {
- IntegerDeclaration charDecl = IntegerDeclaration.UINT_8_DECL;
- String fieldName = getFieldName() + '[' + i + ']';
- byte fieldValue = fContent[i];
- builder.add(new IntegerDefinition(charDecl, getDefinitionScope(), fieldName, fieldValue));
- }
- fDefs = NonNullUtils.checkNotNull(builder.build());
- return fDefs;
- }
-
- return defs;
- }
-
- @Override
- public String toString() {
- if (((CompoundDeclaration) getDeclaration()).isString()) {
- /*
- * the string is a byte array and may contain more than the string
- * plus a null char, this will truncate it back to a null char
- */
- int pos = -1;
- for (int i = 0; i < fContent.length; i++) {
- if (fContent[i] == 0) {
- pos = i;
- break;
- }
- }
- byte[] bytes = (pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent;
- return new String(bytes);
- }
- StringBuilder b = new StringBuilder();
- b.append('[');
- Joiner.on(", ").appendTo(b, Arrays.asList(fContent)); //$NON-NLS-1$
- b.append(']');
- return checkNotNull(b.toString());
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.common.collect.Multimap;
-
-/**
- * A CTF sequence declaration.
- *
- * An array where the size is fixed but declared in the trace, unlike array
- * where it is declared with a literal
- *
- * @author Matthew Khouzam
- */
-public class SequenceDeclaration extends CompoundDeclaration {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final IDeclaration fElemType;
- private final String fLengthName;
- private final transient Multimap<String, String> fPaths = ArrayListMultimap.create();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param lengthName
- * the name of the field describing the length
- * @param elemType
- * The element type
- */
- public SequenceDeclaration(@Nullable String lengthName, IDeclaration elemType) {
- fElemType = elemType;
- fLengthName = lengthName;
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- @Override
- public IDeclaration getElementType() {
- return fElemType;
- }
-
- /**
- * Gets the name of the length field
- *
- * @return the name of the length field
- */
- public String getLengthName() {
- return fLengthName;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public AbstractArrayDefinition createDefinition(
- @Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
- IDefinition lenDef = null;
-
- if (definitionScope != null) {
- lenDef = definitionScope.lookupDefinition(getLengthName());
- }
-
- if (lenDef == null) {
- throw new CTFException("Sequence length field not found"); //$NON-NLS-1$
- }
-
- if (!(lenDef instanceof IntegerDefinition)) {
- throw new CTFException("Sequence length field not integer"); //$NON-NLS-1$
- }
-
- IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef;
-
- if (lengthDefinition.getDeclaration().isSigned()) {
- throw new CTFException("Sequence length must not be signed"); //$NON-NLS-1$
- }
-
- long length = lengthDefinition.getValue();
- if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) {
- throw new CTFException("Sequence length too long " + length); //$NON-NLS-1$
- }
-
- if (isAlignedBytes()) {
- // Don't create "useless" definitions
- byte[] data = new byte[(int) length];
- input.get(data);
- return new ByteArrayDefinition(this, definitionScope, fieldName, data);
- }
- Collection<String> collection = fPaths.get(fieldName);
- while (collection.size() < length) {
- fPaths.put(fieldName, fieldName + '[' + collection.size() + ']');
- }
- List<String> paths = (List<String>) fPaths.get(fieldName);
- Builder<Definition> definitions = new ImmutableList.Builder<>();
- for (int i = 0; i < length; i++) {
- /* We should not have inserted any null values */
- String elemName = checkNotNull(paths.get(i));
- definitions.add(fElemType.createDefinition(definitionScope, elemName, input));
- }
- List<Definition> list = checkNotNull(definitions.build());
- return new ArrayDefinition(this, definitionScope, fieldName, list);
- }
-
- @Override
- public String toString() {
- /* Only used for debugging */
- return "[declaration] sequence[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
- }
-
- @Override
- public int getMaximumSize() {
- return Integer.MAX_VALUE;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + fElemType.hashCode();
- result = prime * result + fLengthName.hashCode();
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- SequenceDeclaration other = (SequenceDeclaration) obj;
- if (!fElemType.equals(other.fElemType)) {
- return false;
- }
- if (!fLengthName.equals(other.fLengthName)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- SequenceDeclaration other = (SequenceDeclaration) obj;
- if (!fElemType.isBinaryEquivalent(other.fElemType)) {
- return false;
- }
- if (!fLengthName.equals(other.fLengthName)) {
- return false;
- }
- return true;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.ISimpleDatatypeDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-
-/**
- * A fixed size struct declaration is a declaration of a structure that has no
- * variant or sequence fields. This will accelerate reading of the trace.
- *
- * @author Matthew Khouzam
- */
-public final class StructDeclarationFlattener {
-
- private StructDeclarationFlattener() {}
-
- /**
- * Flatten a {@link StructDeclaration}, if it can be (which means if it
- * contains only fixed-size elements).
- *
- * This does not modify the declaration passed in parameter, you need to use
- * the return value.
- *
- * @param sd
- * The initial StructDeclaration
- * @return The flattened struct. Or if it couldn't be flattened, the 'sd'
- * struct itself
- */
- public static @NonNull StructDeclaration tryFlattenStruct(@NonNull StructDeclaration sd) {
- if (canBeFlattened(sd)) {
- return newFlattenedStruct(sd);
- }
- return sd;
- }
-
- /**
- * Check if this struct is fixed size
- *
- * @param sd
- * the struct
- * @return if the struct is of fixed size
- */
- private static boolean canBeFlattened(@NonNull StructDeclaration sd) {
- for (String field : sd.getFieldsList()) {
- IDeclaration dec = sd.getField(field);
- if (!isFixedSize(dec)) {
- return false;
- }
- }
- return true;
- }
-
- private static boolean isFixedSize(IDeclaration dec) {
- if (dec instanceof ISimpleDatatypeDeclaration) {
- return true;
- }
- if (dec instanceof ArrayDeclaration) {
- return isFixedSize(((ArrayDeclaration) dec).getElementType());
- }
- if (dec instanceof StructDeclaration) {
- StructDeclaration sDec = ((StructDeclaration) dec);
- return canBeFlattened(sDec);
- }
- return false;
- }
-
- private static @NonNull StructDeclaration newFlattenedStruct(@NonNull StructDeclaration sd) {
- StructDeclaration flatStruct = new StructDeclaration(sd.getAlignment());
- for (String name : sd.getFieldsList()) {
- depthFirstAdd(name, flatStruct, sd.getField(name));
- }
- return flatStruct;
- }
-
- private static void depthFirstAdd(String path, StructDeclaration flatStruct, IDeclaration dec) {
- if (dec instanceof ISimpleDatatypeDeclaration) {
- flatStruct.addField(path, dec);
- } else if (dec instanceof ArrayDeclaration) {
- ArrayDeclaration ad = (ArrayDeclaration) dec;
- int lastIndexOf = path.lastIndexOf('.');
- String name = (lastIndexOf > 0) ? path.substring(lastIndexOf) : path;
- if (ad.isAlignedBytes()) {
- flatStruct.addField(path, dec);
- } else {
- for (int i = 0; i < ad.getLength(); i++) {
- depthFirstAdd(path + '.' + name + '[' + i + ']', flatStruct, ad.getElementType());
- }
- }
- } else if (dec instanceof StructDeclaration) {
- StructDeclaration sDec = ((StructDeclaration) dec);
- for (String name : sDec.getFieldsList()) {
- depthFirstAdd(path + '.' + name, flatStruct, sDec.getField(name));
- }
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
-
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-
-/**
- * An event header declaration is a declaration of a structure defined in the
- * CTF spec examples section 6.1.1 . It is used in LTTng traces. This will
- * accelerate reading of the trace.
- *
- * Reminder
- *
- * <pre>
- * struct event_header_compact {
- * enum : uint5_t { compact = 0 ... 30, extended = 31 } id;
- * variant <id> {
- * struct {
- * uint27_clock_monotonic_t timestamp;
- * } compact;
- * struct {
- * uint32_t id;
- * uint64_clock_monotonic_t timestamp;
- * } extended;
- * } v;
- * } align(8);
- * </pre>
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class EventHeaderCompactDeclaration extends Declaration implements IEventHeaderDeclaration {
-
- private static final int BASE_10 = 10;
- /**
- * The id is 5 bits
- */
- private static final int COMPACT_ID = 5;
- private static final int EXTENDED_VALUE = (1 << COMPACT_ID) - 1;
- /**
- * Full sized id is 32 bits
- */
- private static final int ID_SIZE = 32;
- /**
- * Full sized timestamp is 64 bits
- */
- private static final int FULL_TS = 64;
- /**
- * Compact timestamp is 27 bits,
- */
- private static final int COMPACT_TS = 27;
- /**
- * Clock identifier
- */
- private static final String CLOCK = ""; //$NON-NLS-1$
- /**
- * Maximum size = largest this header can be
- */
- private static final int MAX_SIZE = 104;
- /**
- * Byte aligned
- */
- private static final int ALIGN_ON_1 = 1;
- private static final int ALIGN_ON_8 = 8;
-
- private final ByteOrder fByteOrder;
- private final List<StructDeclaration> fReferenceStructs = new ArrayList<>();
-
- /**
- * Big-Endian Large Event Header
- */
- private static final EventHeaderCompactDeclaration EVENT_HEADER_BIG_ENDIAN = new EventHeaderCompactDeclaration(nullCheck(ByteOrder.BIG_ENDIAN));
-
- /**
- * Little-Endian Large Event Header
- */
- private static final EventHeaderCompactDeclaration EVENT_HEADER_LITTLE_ENDIAN = new EventHeaderCompactDeclaration(nullCheck(ByteOrder.LITTLE_ENDIAN));
-
- /**
- * Event Header Declaration
- *
- * @param byteOrder
- * the byteorder
- */
- private EventHeaderCompactDeclaration(ByteOrder byteOrder) {
- fByteOrder = byteOrder;
- populateReferences();
- }
-
- private void populateReferences() {
- if (!fReferenceStructs.isEmpty()) {
- return;
- }
- StructDeclaration ref = new StructDeclaration(ALIGN_ON_8);
- EnumDeclaration id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
- id.add(0, EXTENDED_VALUE - 1, COMPACT);
- id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
- ref.addField(ID, id);
- VariantDeclaration v = new VariantDeclaration();
- StructDeclaration compact = new StructDeclaration(ALIGN_ON_1);
- compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
- StructDeclaration extended = new StructDeclaration(ALIGN_ON_8);
- extended.addField(ID, IntegerDeclaration.createDeclaration(ID_SIZE, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- v.addField(COMPACT, compact);
- v.addField(EXTENDED, extended);
- ref.addField(VARIANT_NAME, v);
- fReferenceStructs.add(ref);
- }
-
- /**
- * Gets an {@link EventHeaderCompactDeclaration} of a given ByteOrder
- *
- * @param byteOrder
- * the byte order
- * @return the header declaration
- */
- public static EventHeaderCompactDeclaration getEventHeader(@Nullable ByteOrder byteOrder) {
- if (byteOrder == ByteOrder.BIG_ENDIAN) {
- return EVENT_HEADER_BIG_ENDIAN;
- }
- return EVENT_HEADER_LITTLE_ENDIAN;
- }
-
- @Override
- public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- ByteOrder bo = input.getByteOrder();
- input.setByteOrder(fByteOrder);
- int enumId = (int) input.get(COMPACT_ID, false);
- if (enumId != EXTENDED_VALUE) {
- long timestamp2 = input.get(COMPACT_TS, false);
- input.setByteOrder(bo);
- return new EventHeaderDefinition(this, enumId, timestamp2, COMPACT_TS);
- }
- // needed since we read 5 bits
- input.position(input.position() + 3);
- long id = input.get(ID_SIZE, false);
- if (id > Integer.MAX_VALUE) {
- throw new CTFException("ID " + id + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
- long timestampLong = input.get(FULL_TS, false);
- input.setByteOrder(bo);
- return new EventHeaderDefinition(this, (int) id, timestampLong, FULL_TS);
-
- }
-
- @Override
- public long getAlignment() {
- return ALIGN_ON_8;
- }
-
- @Override
- public int getMaximumSize() {
- return MAX_SIZE;
- }
-
- /**
- * Check if a given struct declaration is an event header
- *
- * @param declaration
- * the declaration
- * @return true if the struct is a compact event header
- */
- public boolean isCompactEventHeader(@Nullable StructDeclaration declaration) {
- if (declaration == null) {
- return false;
- }
- for (IDeclaration ref : fReferenceStructs) {
- if (ref.isBinaryEquivalent(declaration)) {
- return true;
- }
- }
- return false;
- }
-
- private static ByteOrder nullCheck(@Nullable ByteOrder bo) {
- if (bo == null) {
- throw new IllegalStateException("Could not create byteorder"); //$NON-NLS-1$
- }
- return bo;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (fByteOrder.equals(ByteOrder.BIG_ENDIAN) ? 4321 : 1234);
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EventHeaderCompactDeclaration other = (EventHeaderCompactDeclaration) obj;
- if (!fByteOrder.equals(other.fByteOrder)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
- for (StructDeclaration referenceStruct : fReferenceStructs) {
- if (referenceStruct.isBinaryEquivalent(other)) {
- return true;
- }
- }
- return false;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * An event header definition, as shown in the example of the CTF spec examples
- * section 6.1.1
- *
- * @author Matthew Khouzam
- */
-public final class EventHeaderDefinition extends Definition implements ICompositeDefinition {
-
- private static final List<String> FIELD_NAMES = ImmutableList.of(
- IEventHeaderDeclaration.ID,
- IEventHeaderDeclaration.TIMESTAMP
- );
-
- private final int fId;
- private final long fTimestamp;
- private final int fTimestampLength;
-
- /**
- * Event header defintion
- *
- * @param id
- * the event id
- * @param timestamp
- * the timestamp
- * @param eventHeaderDecl
- * The declaration of this defintion
- * @param timestampLength
- * the number of bits valid in the timestamp
- */
- public EventHeaderDefinition(@NonNull Declaration eventHeaderDecl, int id, long timestamp, int timestampLength) {
- super(eventHeaderDecl, null, ILexicalScope.EVENT_HEADER.getPath(), ILexicalScope.EVENT_HEADER);
- fId = id;
- fTimestamp = timestamp;
- fTimestampLength = timestampLength;
- }
-
- /**
- * Gets the timestamp declaration
- *
- * @return the timestamp declaration
- */
- public int getTimestampLength() {
- return fTimestampLength;
- }
-
- /**
- * Get the event id
- *
- * @return the event id
- */
- public int getId() {
- return fId;
- }
-
- /**
- * Get the timestamp
- *
- * @return the timestamp
- */
- public long getTimestamp() {
- return fTimestamp;
- }
-
- @Override
- public Definition getDefinition(String fieldName) {
- if (fieldName.equals(IEventHeaderDeclaration.ID)) {
- return new IntegerDefinition(IntegerDeclaration.INT_32B_DECL, null, IEventHeaderDeclaration.ID, getId());
- } else if (fieldName.equals(IEventHeaderDeclaration.TIMESTAMP)) {
- return new IntegerDefinition(IntegerDeclaration.INT_64B_DECL, null, IEventHeaderDeclaration.TIMESTAMP, getTimestamp());
- }
- return null;
- }
-
- @Override
- public List<String> getFieldNames() {
- return FIELD_NAMES;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.event.types.composite;
-
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope;
-import org.eclipse.tracecompass.ctf.core.event.types.Declaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-
-/**
- * An event header declaration is a declaration of a structure defined in the
- * CTF spec examples section 6.1.1 . It is used in LTTng traces. This will
- * accelerate reading of the trace.
- *
- * Reminder
- *
- * <pre>
- * struct event_header_large {
- * enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;
- * variant <id> {
- * struct {
- * uint32_clock_monotonic_t timestamp;
- * } compact;
- * struct {
- * uint32_t id;
- * uint64_clock_monotonic_t timestamp;
- * } extended;
- * } v;
- * } align(8);
- * </pre>
- *
- * @author Matthew Khouzam
- */
-@NonNullByDefault
-public final class EventHeaderLargeDeclaration extends Declaration implements IEventHeaderDeclaration {
-
- private static final int ALIGN_ON_1 = 1;
- private static final int BASE_10 = 10;
- /**
- * The id is 16 bits
- */
- private static final int COMPACT_ID = 16;
- private static final int EXTENDED_VALUE = (1 << COMPACT_ID) - 1;
- /**
- * Full sized timestamp is 64 bits
- */
- private static final int FULL_TS = 64;
- /**
- * Compact timestamp is 32 bits,
- */
- private static final int COMPACT_TS = 32;
- /**
- * Clock mapping
- */
- private static final String CLOCK = ""; //$NON-NLS-1$
- private static final String CLOCK_MONOTONIC = "clock_monotonic"; //$NON-NLS-1$
- /**
- * Maximum size = largest this header can be
- */
- private static final int MAX_SIZE = 112;
- /**
- * Byte aligned
- */
- private static final int ALIGN_ON_8 = 8;
-
- private final ByteOrder fByteOrder;
- private final List<StructDeclaration> fReferenceStructs = new ArrayList<>();
-
- /**
- * Big-Endian Large Event Header
- */
- private static final EventHeaderLargeDeclaration EVENT_HEADER_BIG_ENDIAN = new EventHeaderLargeDeclaration(nullCheck(ByteOrder.BIG_ENDIAN));
-
- /**
- * Little-Endian Large Event Header
- */
- private static final EventHeaderLargeDeclaration EVENT_HEADER_LITTLE_ENDIAN = new EventHeaderLargeDeclaration(nullCheck(ByteOrder.LITTLE_ENDIAN));
-
- /**
- * Event Header Declaration
- *
- * @param byteOrder
- * the byteorder
- */
- private EventHeaderLargeDeclaration(ByteOrder byteOrder) {
- fByteOrder = byteOrder;
- populateReferences();
- }
-
- private void populateReferences() {
- if (!fReferenceStructs.isEmpty()) {
- return;
- }
- StructDeclaration ref = new StructDeclaration(ALIGN_ON_8);
- EnumDeclaration id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_1));
- id.add(0, EXTENDED_VALUE - 1, COMPACT);
- id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
- ref.addField(ID, id);
- VariantDeclaration v = new VariantDeclaration();
- StructDeclaration compact = new StructDeclaration(1);
- compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- StructDeclaration extended = new StructDeclaration(1);
- extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- v.addField(COMPACT, compact);
- v.addField(EXTENDED, extended);
- ref.addField(VARIANT_NAME, v);
- fReferenceStructs.add(ref);
- ref = new StructDeclaration(ALIGN_ON_8);
- id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- id.add(0, EXTENDED_VALUE - 1, COMPACT);
- id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
- ref.addField(ID, id);
- v = new VariantDeclaration();
- compact = new StructDeclaration(ALIGN_ON_1);
- compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended = new StructDeclaration(ALIGN_ON_1);
- extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK_MONOTONIC, ALIGN_ON_8));
- v.addField(COMPACT, compact);
- v.addField(EXTENDED, extended);
- ref.addField(VARIANT_NAME, v);
- fReferenceStructs.add(ref);
- ref = new StructDeclaration(ALIGN_ON_8);
- id = new EnumDeclaration(IntegerDeclaration.createDeclaration(COMPACT_ID, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, COMPACT_ID));
- id.add(0, EXTENDED_VALUE - 1, COMPACT);
- id.add(EXTENDED_VALUE, EXTENDED_VALUE, EXTENDED);
- ref.addField(ID, id);
- v = new VariantDeclaration();
- compact = new StructDeclaration(ALIGN_ON_1);
- compact.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended = new StructDeclaration(ALIGN_ON_1);
- extended.addField(ID, IntegerDeclaration.createDeclaration(COMPACT_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK, ALIGN_ON_8));
- extended.addField(TIMESTAMP, IntegerDeclaration.createDeclaration(FULL_TS, false, BASE_10, fByteOrder, Encoding.NONE, CLOCK_MONOTONIC, ALIGN_ON_8));
- v.addField(COMPACT, compact);
- v.addField(EXTENDED, extended);
- ref.addField(VARIANT_NAME, v);
- fReferenceStructs.add(ref);
- }
-
- /**
- * Gets an {@link EventHeaderLargeDeclaration} of a given ByteOrder
- *
- * @param byteOrder
- * the byte order
- * @return the header declaration
- */
- public static EventHeaderLargeDeclaration getEventHeader(@Nullable ByteOrder byteOrder) {
- if (byteOrder == ByteOrder.BIG_ENDIAN) {
- return EVENT_HEADER_BIG_ENDIAN;
- }
- return EVENT_HEADER_LITTLE_ENDIAN;
- }
-
- @Override
- public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException {
- alignRead(input);
- ByteOrder bo = input.getByteOrder();
- input.setByteOrder(fByteOrder);
- int first = (int) input.get(COMPACT_ID, false);
- long second = input.get(COMPACT_TS, false);
- if (first != EXTENDED_VALUE) {
- input.setByteOrder(bo);
- return new EventHeaderDefinition(this, first, second, COMPACT_TS);
- }
- long timestampLong = input.get(FULL_TS, false);
- input.setByteOrder(bo);
- if (second > Integer.MAX_VALUE) {
- throw new CTFException("ID " + second + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
- return new EventHeaderDefinition(this, (int) second, timestampLong, FULL_TS);
- }
-
- @Override
- public long getAlignment() {
- return ALIGN_ON_8;
- }
-
- @Override
- public int getMaximumSize() {
- return MAX_SIZE;
- }
-
- /**
- * Check if a given struct declaration is an event header
- *
- * @param declaration
- * the declaration
- * @return true if the event is a large event header
- */
- public boolean isLargeEventHeader(@Nullable StructDeclaration declaration) {
- if (declaration == null) {
- return false;
- }
- for (IDeclaration ref : fReferenceStructs) {
- if (ref.isBinaryEquivalent(declaration)) {
- return true;
- }
- }
- return false;
- }
-
- private static ByteOrder nullCheck(@Nullable ByteOrder bo) {
- if (bo == null) {
- throw new IllegalStateException("Could not create byteorder"); //$NON-NLS-1$
- }
- return bo;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (fByteOrder.equals(ByteOrder.BIG_ENDIAN) ? 4321 : 1234);
- return result;
- }
-
- @Override
- public boolean equals(@Nullable Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- EventHeaderLargeDeclaration other = (EventHeaderLargeDeclaration) obj;
- if (!fByteOrder.equals(other.fByteOrder)) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean isBinaryEquivalent(@Nullable IDeclaration other) {
- for (StructDeclaration referenceStruct : fReferenceStructs) {
- if (referenceStruct.isBinaryEquivalent(other)) {
- return true;
- }
- }
- return false;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- * Contributors: Etienne Bergeron <etienne.bergeron@gmail.com>
- * Contributors: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.trace;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.TreeSet;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
-
-/**
- * <b><u>StreamInputPacketIndex</u></b>
- * <p>
- * This is a data structure containing entries, you may append to this and read
- * it. It is not thread safe.
- */
-public class StreamInputPacketIndex {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * Entries of the index. They are sorted by increasing begin timestamp.
- * index builder.
- */
- private final List<ICTFPacketDescriptor> fEntries = new ArrayList<>();
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Returns the number of elements in this data structure. If this data
- * structure contains more than {@code Integer.MAX_VALUE} elements, returns
- * {@code Integer.MAX_VALUE}.
- *
- * @return the number of elements in this data structure
- */
- public int size() {
- return fEntries.size();
- }
-
- /**
- * Returns {@code true} if this data structure contains no elements.
- *
- * @return {@code true} if this data structure contains no elements
- */
- public boolean isEmpty() {
- return fEntries.isEmpty();
- }
-
- /**
- * Adds a collection of entries to the index, the entries must be sorted.
- *
- * @param preParsedIndex
- * the pre-parsed index file
- *
- * @throws CTFException
- * If there was a problem reading the entry
- */
- public void appendAll(Collection<ICTFPacketDescriptor> preParsedIndex)
- throws CTFException {
- for (ICTFPacketDescriptor sipie : preParsedIndex) {
- append(checkNotNull(sipie));
- }
- }
-
- /**
- * Appends the specified element to the end of this data structure
- *
- * @param entry
- * element to be appended to this index, cannot be null
- * @return {@code true} (as specified by {@link Collection#add})
- * @throws CTFException
- * If there was a problem reading the entry
- */
- public boolean append(@NonNull ICTFPacketDescriptor entry)
- throws CTFException {
-
- /* Validate consistent entry. */
- if (entry.getTimestampBegin() > entry.getTimestampEnd()) {
- throw new CTFException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$
- }
-
- /*
- * Validate entries are inserted in monotonic increasing timestamp
- * order.
- */
- if (!fEntries.isEmpty() && (entry.getTimestampBegin() < lastElement().getTimestampBegin())) {
- throw new CTFException("Packets begin timestamp decreasing"); //$NON-NLS-1$
- }
-
- fEntries.add(entry);
- return true;
- }
-
- /**
- * Returns the first PacketIndexEntry that could include the timestamp, that
- * is the last packet with a begin timestamp smaller than the given
- * timestamp.
- *
- * @param timestamp
- * The timestamp to look for.
- * @return The StreamInputPacketEntry that corresponds to the packet that
- * includes the given timestamp.
- */
- public ListIterator<ICTFPacketDescriptor> search(final long timestamp) {
- /*
- * Start with min and max covering all the elements.
- */
- int max = fEntries.size() - 1;
- int min = 0;
-
- int guessI;
- ICTFPacketDescriptor guessEntry = null;
-
- /*
- * If the index is empty, return the iterator at the very beginning.
- */
- if (isEmpty()) {
- return fEntries.listIterator();
- }
-
- if (timestamp < 0) {
- throw new IllegalArgumentException("timestamp is negative"); //$NON-NLS-1$
- }
-
- /* Binary search */
- for (;;) {
- /*
- * Guess in the middle of min and max.
- */
- guessI = min + ((max - min) / 2);
- guessEntry = fEntries.get(guessI);
-
- /*
- * If we reached the point where we focus on a single packet, our
- * search is done.
- */
- if (min == max) {
- break;
- }
-
- if (timestamp <= guessEntry.getTimestampEnd()) {
- /*
- * If the timestamp is lower or equal to the end of the guess
- * packet, then the guess packet becomes the new inclusive max.
- */
- max = guessI;
- } else {
- /*
- * If the timestamp is greater than the end of the guess packet,
- * then the new inclusive min is the packet after the guess
- * packet.
- */
- min = guessI + 1;
- }
- }
-
- return fEntries.listIterator(guessI);
- }
-
- /**
- * Get the last element of the index
- *
- * @return the last element in the index
- */
- public ICTFPacketDescriptor lastElement() {
- return fEntries.get(fEntries.size() - 1);
- }
-
- /**
- * Returns the element at the specified position in this data structure.
- *
- * @param index
- * index of the element to return
- * @return the element at the specified position in this data structure
- * @throws IndexOutOfBoundsException
- * if the index is out of range (
- * {@code index < 0 || index >= size()})
- */
- public ICTFPacketDescriptor getElement(int index) {
- return fEntries.get(index);
- }
-
- /**
- * Returns the index of the first occurrence of the specified element in
- * this data structure, or -1 if this data structure does not contain the
- * element. More formally, returns the lowest index {@code i} such that, for
- * an entry {@code o}, {@code (o==null ? get(i)==null : o.equals(get(i)))},
- * or {@code -1} if there is no such index. This will work in log(n) time
- * since the data structure contains elements in a non-repeating increasing
- * manner.
- *
- * @param element
- * element to search for
- * @return the index of the first occurrence of the specified element in
- * this data structure, or -1 if this data structure does not
- * contain the element
- * @throws ClassCastException
- * if the type of the specified element is incompatible with
- * this data structure (<a
- * href="Collection.html#optional-restrictions">optional</a>)
- * @throws NullPointerException
- * if the specified element is null and this data structure does
- * not permit null elements (<a
- * href="Collection.html#optional-restrictions">optional</a>)
- */
- public int indexOf(ICTFPacketDescriptor element) {
- int indexOf = -1;
- if (element != null) {
- indexOf = Collections.binarySearch(fEntries, element, new MonotonicComparator());
- }
- return (indexOf < 0) ? -1 : indexOf;
- }
-
- /**
- * Ordering comparator for entering entries into a data structure sorted by
- * timestamp.
- */
- private static class MonotonicComparator implements Comparator<ICTFPacketDescriptor>, Serializable {
- /**
- * For {@link Serializable}, that way if we migrate to a {@link TreeSet}
- * the comparator is serializable too.
- */
- private static final long serialVersionUID = -5693064068367242076L;
-
- @Override
- public int compare(ICTFPacketDescriptor left, ICTFPacketDescriptor right) {
- if (left.getTimestampBegin() > right.getTimestampBegin()) {
- return 1;
- }
- if (left.getTimestampBegin() < right.getTimestampBegin()) {
- return -1;
- }
- if (left.getTimestampEnd() > right.getTimestampEnd()) {
- return 1;
- }
- if (left.getTimestampEnd() < right.getTimestampEnd()) {
- return -1;
- }
- return 0;
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.trace;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.ICTFPacketDescriptor;
-
-/**
- * <b><u>StreamInputPacketIndexEntry</u></b>
- * <p>
- * Represents an entry in the index of event packets.
- */
-public class StreamInputPacketIndexEntry implements ICTFPacketDescriptor {
-
- private static final int UNKNOWN = -1;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * Position of the start of the packet header in the file, in bits
- */
- private final long fOffsetBits;
-
- /**
- * Position of the start of the packet header in the file, in bytes
- */
- private final long fOffsetBytes;
-
- /**
- * Packet size, in bits
- */
- private final long fPacketSizeBits;
-
- /**
- * Content size, in bits
- */
- private final long fContentSizeBits;
-
- /**
- * Begin timestamp
- */
- private final long fTimestampBegin;
-
- /**
- * End timestamp
- */
- private final long fTimestampEnd;
-
- /**
- * How many lost events are there?
- */
- private final long fLostEvents;
-
- /**
- * Which target is being traced
- */
- private final String fTarget;
- private final long fTargetID;
-
- /**
- * Attributes of this index entry
- */
- private final Map<String, Object> fAttributes = new HashMap<>();
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructs an index entry.
- *
- * @param dataOffsetBits
- * offset in the file for the start of data in bits
- * @param fileSizeBytes
- * number of bytes in a file
- */
-
- public StreamInputPacketIndexEntry(long dataOffsetBits, long fileSizeBytes) {
- fContentSizeBits = (fileSizeBytes * Byte.SIZE);
- fPacketSizeBits = (fileSizeBytes * Byte.SIZE);
- fOffsetBits = dataOffsetBits;
- fOffsetBytes = dataOffsetBits / Byte.SIZE;
- fLostEvents = 0;
- fTarget = ""; //$NON-NLS-1$
- fTargetID = 0;
- fTimestampBegin = Long.MIN_VALUE;
- fTimestampEnd = Long.MAX_VALUE;
- }
-
- /**
- * full Constructor
- *
- * @param dataOffsetBits
- * offset in the file for the start of data in bits
- * @param streamPacketContextDef
- * packet context
- * @param fileSizeBytes
- * number of bytes in a file
- * @param lostSoFar
- * number of lost events so far
- */
- public StreamInputPacketIndexEntry(long dataOffsetBits, StructDefinition streamPacketContextDef, long fileSizeBytes, long lostSoFar) {
- for (String field : streamPacketContextDef.getDeclaration().getFieldsList()) {
- IDefinition id = streamPacketContextDef.lookupDefinition(field);
- if (id instanceof IntegerDefinition) {
- fAttributes.put(field, ((IntegerDefinition) id).getValue());
- } else if (id instanceof FloatDefinition) {
- fAttributes.put(field, ((FloatDefinition) id).getValue());
- } else if (id instanceof EnumDefinition) {
- fAttributes.put(field, ((EnumDefinition) id).getValue());
- } else if (id instanceof StringDefinition) {
- fAttributes.put(field, ((StringDefinition) id).getValue());
- }
- }
-
- Long contentSize = (Long) fAttributes.get(CTFStrings.CONTENT_SIZE);
- Long packetSize = (Long) fAttributes.get(CTFStrings.PACKET_SIZE);
- Long tsBegin = (Long) fAttributes.get(CTFStrings.TIMESTAMP_BEGIN);
- Long tsEnd = (Long) fAttributes.get(CTFStrings.TIMESTAMP_END);
- String device = (String) fAttributes.get(CTFStrings.DEVICE);
- // LTTng Specific
- Long cpuId = (Long) fAttributes.get(CTFStrings.CPU_ID);
- Long lostEvents = (Long) fAttributes.get(CTFStrings.EVENTS_DISCARDED);
-
- /* Read the content size in bits */
- if (contentSize != null) {
- fContentSizeBits = (contentSize.longValue());
- } else if (packetSize != null) {
- fContentSizeBits = (packetSize.longValue());
- } else {
- fContentSizeBits = (fileSizeBytes * Byte.SIZE);
- }
-
- /* Read the packet size in bits */
- if (packetSize != null) {
- fPacketSizeBits = (packetSize.longValue());
- } else if (this.getContentSizeBits() != 0) {
- fPacketSizeBits = fContentSizeBits;
- } else {
- fPacketSizeBits = (fileSizeBytes * Byte.SIZE);
- }
-
- /* Read the begin timestamp */
- if (tsBegin != null) {
- fTimestampBegin = (tsBegin.longValue());
- } else {
- fTimestampBegin = Long.MIN_VALUE;
- }
-
- /* Read the end timestamp */
- if (tsEnd != null) {
- // check if tsEnd == unsigned long max value
- if (tsEnd == -1) {
- tsEnd = Long.MAX_VALUE;
- }
- fTimestampEnd = (tsEnd.longValue());
- } else {
- fTimestampEnd = Long.MAX_VALUE;
- }
-
- if (device != null) {
- fTarget = device;
- fTargetID = Integer.parseInt(device.replaceAll("[\\D]", "")); //$NON-NLS-1$ //$NON-NLS-2$ // slow
- } else if (cpuId != null) {
- fTarget = ("CPU" + cpuId.toString()); //$NON-NLS-1$
- fTargetID = cpuId;
- } else {
- fTarget = null;
- fTargetID = UNKNOWN;
- }
-
- if (lostEvents != null) {
- fLostEvents = (lostEvents - lostSoFar);
- } else {
- fLostEvents = 0;
- }
-
- fOffsetBits = dataOffsetBits;
- fOffsetBytes = dataOffsetBits / Byte.SIZE;
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- @Override
- public boolean includes(long ts) {
- return (ts >= fTimestampBegin) && (ts <= fTimestampEnd);
- }
-
- @Override
- public String toString() {
- return "StreamInputPacketIndexEntry [offsetBits=" + fOffsetBits //$NON-NLS-1$
- + ", timestampBegin=" + fTimestampBegin + ", timestampEnd=" //$NON-NLS-1$ //$NON-NLS-2$
- + fTimestampEnd + "]"; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // Getters and Setters
- // ------------------------------------------------------------------------
-
- @Override
- public long getOffsetBits() {
- return fOffsetBits;
- }
-
- @Override
- public long getPacketSizeBits() {
- return fPacketSizeBits;
- }
-
- @Override
- public long getContentSizeBits() {
- return fContentSizeBits;
- }
-
- @Override
- public long getTimestampBegin() {
- return fTimestampBegin;
- }
-
- @Override
- public long getTimestampEnd() {
- return fTimestampEnd;
- }
-
- @Override
- public long getLostEvents() {
- return fLostEvents;
- }
-
- /**
- * Add an attribute to this index entry
- *
- * @param field
- * The name of the attribute
- * @param value
- * The value to insert
- */
- public void addAttribute(String field, Object value) {
- fAttributes.put(field, value);
- }
-
- @Override
- public Object lookupAttribute(String field) {
- return fAttributes.get(field);
- }
-
- @Override
- public String getTarget() {
- return fTarget;
- }
-
- @Override
- public long getTargetId() {
- return fTargetID;
- }
-
- @Override
- public long getOffsetBytes() {
- return fOffsetBytes;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.trace;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-
-/**
- * <b><u>StreamInputReaderTimestampComparator</u></b>
- * <p>
- * Compares two StreamInputReader by their timestamp (smaller comes before).
- */
-public class StreamInputReaderTimestampComparator implements
- Comparator<CTFStreamInputReader>, Serializable {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- private static final long serialVersionUID = 1066434959451875045L;
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * @throws NullPointerException
- * If any {@link CTFStreamInputReader} parameter is null, of if any
- * of them does not contain a current event.
- */
- @Override
- public int compare(CTFStreamInputReader a, CTFStreamInputReader b) {
- EventDefinition event_a = a.getCurrentEvent();
- EventDefinition event_b = b.getCurrentEvent();
-
- long ta = event_a.getTimestamp();
- long tb = event_b.getTimestamp();
- return Utils.unsignedCompare(ta, tb);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal 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: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.ctf.core.trace;
-
-import java.util.UUID;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-
-/**
- * Various utilities.
- *
- * @version 1.0
- * @author Matthew Khouzam
- * @author Simon Marchi
- */
-public final class Utils {
-
- private Utils() {
- }
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * CTF magic number. (sort of looks like CTF CTF CT)
- */
- public static final int CTF_MAGIC = 0xC1FC1FC1;
-
- /**
- * TSDL magic number. (sort of looks like TSDL LSDT)
- */
- public static final int TSDL_MAGIC = 0x75D11D57;
-
- /**
- * TSDL magic number length in bytes.
- */
- public static final int TSDL_MAGIC_LEN = 4;
-
- /**
- * Directory separator on the current platform.
- */
- public static final String SEPARATOR = System.getProperty("file.separator"); //$NON-NLS-1$
-
- /**
- * Length in bytes of a UUID value.
- */
- public static final int UUID_LEN = 16;
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Performs an unsigned long comparison on two unsigned long numbers.
- *
- * <strong> As Java does not support unsigned types and arithmetic,
- * parameters are received encoded as a signed long (two-complement) but the
- * operation is an unsigned comparator.</strong>
- *
- * @param left
- * Left operand of the comparator.
- * @param right
- * Right operand of the comparator.
- * @return -1 if left < right, 1 if left > right, 0 if left == right.
- */
- public static int unsignedCompare(long left, long right) {
- /*
- * This method assumes that the arithmetic overflow on signed integer
- * wrap on a circular domain (modulo arithmetic in two-complement),
- * which is the defined behavior in Java.
- *
- * This idea is to rotate the domain by the length of the negative
- * space, and then use the signed operator.
- */
- final long a = left + Long.MIN_VALUE;
- final long b = right + Long.MIN_VALUE;
- if (a < b) {
- return -1;
- } else if (a > b) {
- return 1;
- }
- return 0;
- }
-
- /**
- * Gets a UUID from an array defintion
- *
- * @param uuidDef
- * the array defintions, must contain integer bytes
- * @return the UUID
- * @throws CTFException
- * if the definition contains less than 16 elements
- */
- public static UUID getUUIDfromDefinition(AbstractArrayDefinition uuidDef) throws CTFException {
- byte[] uuidArray = new byte[UUID_LEN];
- IDeclaration declaration = uuidDef.getDeclaration();
- if (!(declaration instanceof CompoundDeclaration)) {
- throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
- }
- CompoundDeclaration uuidDec = (CompoundDeclaration) declaration;
-
- IDeclaration uuidElem = uuidDec.getElementType();
- if (!(uuidElem instanceof IntegerDeclaration)) {
- throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
- }
- IntegerDeclaration intUuidElem = (IntegerDeclaration) uuidElem;
- if (!intUuidElem.isUnsignedByte()) {
- throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$
- }
- return getUUID(uuidDef, uuidArray);
- }
-
- private static UUID getUUID(AbstractArrayDefinition uuidDef, byte[] uuidArray) throws CTFException {
- for (int i = 0; i < uuidArray.length; i++) {
- IntegerDefinition uuidByteDef = (IntegerDefinition) uuidDef.getDefinitions().get(i);
- if (uuidByteDef == null) {
- throw new CTFException("UUID incomplete, only " + i + " bytes available"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- uuidArray[i] = (byte) uuidByteDef.getValue();
- }
-
- UUID uuid = Utils.makeUUID(uuidArray);
- return uuid;
- }
-
- /**
- * Creates a UUID object from an array of 16 bytes.
- *
- * @param bytes
- * Array of 16 bytes.
- * @return A UUID object.
- */
- public static UUID makeUUID(byte bytes[]) {
- long high = 0;
- long low = 0;
-
- assert (bytes.length == Utils.UUID_LEN);
-
- final int bitsPerByte = Byte.SIZE;
- int bitMask = (1 << bitsPerByte) - 1;
- for (int i = 0; i < bitsPerByte; i++) {
- low = (low << bitsPerByte) | (bytes[i + bitsPerByte] & bitMask);
- high = (high << bitsPerByte) | (bytes[i] & bitMask);
- }
-
- UUID uuid = new UUID(high, low);
-
- return uuid;
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.ctf.parser.tests</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=2
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.ctf.parser.tests;singleton:=true
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.junit;bundle-version="4.0.0",
- org.eclipse.core.runtime,
- org.eclipse.tracecompass.ctf.parser
-Export-Package: org.eclipse.tracecompass.ctf.parser.tests
-Import-Package: org.antlr.runtime;version="3.2.0",
- org.antlr.runtime.tree;version="3.2.0"
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2015 Ericsson
-#
-# 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:
-# Etienne Bergeron - Initial API and implementation
-###############################################################################
-
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- about.html
-src.includes = about.html
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Etienne Bergeron - Initial API and implementation
-###############################################################################
-
-#Properties file for org.eclipse.tracecompass.ctf.parser.tests
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = Trace Compass CTF Parser Tests Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2013 Ericsson
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.tracecompass.ctf.parser.tests</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <name>Trace Compass CTF Parser Tests Plug-in</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <testSuite>org.eclipse.tracecompass.ctf.parser.tests</testSuite>
- <testClass>org.eclipse.tracecompass.ctf.parser.tests.AllCtfParserTests</testClass>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <product>org.eclipse.platform.ide</product>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Etienne Bergeron - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Master test suite for CTF parser.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfLexerTest.class,
- CtfParserTest.class
-})
-
-public class AllCtfParserTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Etienne Bergeron
- *
- * 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:
- * Etienne Bergeron - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser.tests;
-
-import static org.junit.Assert.fail;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.Token;
-import org.eclipse.tracecompass.ctf.parser.CTFLexer;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * This test validates the CTF-Lexer implementation.
- *
- * The test splits a string into tokens with the compiled lexer and
- * validates the sequences of tokens produced by comparing their type
- * and content.
- *
- * @author Etienne Bergeron
- */
-public class CtfLexerTest {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final List<Token> tokens = new LinkedList<>();
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- private void tokenize(String content) {
- CharStream cs = new ANTLRStringStream(content);
- CTFLexer lexer = new CTFLexer(cs);
-
- tokens.clear();
- for (;;) {
- Token token = lexer.nextToken();
- if (token == Token.EOF_TOKEN) {
- return;
- }
- tokens.add(token);
- }
- }
-
- private void checkToken(int type, String content) {
- Token token = tokens.remove(0);
- if (token.getType() != type) {
- fail("Invalid type [value " + token.getType()
- + " but expect " + type + "]."
- + " Fail to tokenize:" + content);
- } else if (token.getText().compareTo(content) != 0) {
- fail("Invalid content [value " + token.getText()
- + " but expect " + content + "].");
- }
- }
-
- private void checkSingle(int type, String content) {
- tokenize(content);
- checkToken(type, content);
- }
-
- // ------------------------------------------------------------------------
- // Test cases
- // ------------------------------------------------------------------------
-
- /**
- * Validate the parsing of keywords
- */
- @Test
- public void testKeywords() {
- checkSingle(CTFLexer.ALIGNTOK, "align");
- checkSingle(CTFLexer.CONSTTOK, "const");
- checkSingle(CTFLexer.CHARTOK, "char");
- checkSingle(CTFLexer.DOUBLETOK, "double");
- checkSingle(CTFLexer.ENUMTOK, "enum");
- checkSingle(CTFLexer.EVENTTOK, "event");
- checkSingle(CTFLexer.FLOATINGPOINTTOK, "floating_point");
- checkSingle(CTFLexer.FLOATTOK, "float");
- checkSingle(CTFLexer.INTEGERTOK, "integer");
- checkSingle(CTFLexer.INTTOK, "int");
- checkSingle(CTFLexer.LONGTOK, "long");
- checkSingle(CTFLexer.SHORTTOK, "short");
- checkSingle(CTFLexer.SIGNEDTOK, "signed");
- checkSingle(CTFLexer.STREAMTOK, "stream");
- checkSingle(CTFLexer.STRINGTOK, "string");
- checkSingle(CTFLexer.STRUCTTOK, "struct");
- checkSingle(CTFLexer.TRACETOK, "trace");
- checkSingle(CTFLexer.TYPEALIASTOK, "typealias");
- checkSingle(CTFLexer.TYPEDEFTOK, "typedef");
- checkSingle(CTFLexer.UNSIGNEDTOK, "unsigned");
- checkSingle(CTFLexer.VARIANTTOK, "variant");
- checkSingle(CTFLexer.VOIDTOK, "void");
- checkSingle(CTFLexer.BOOLTOK, "_Bool");
- checkSingle(CTFLexer.COMPLEXTOK, "_Complex");
- checkSingle(CTFLexer.IMAGINARYTOK, "_Imaginary");
- checkSingle(CTFLexer.ENVTOK, "env");
- checkSingle(CTFLexer.CLOCKTOK, "clock");
- checkSingle(CTFLexer.CALLSITETOK, "callsite");
- checkSingle(CTFLexer.NANNUMBERTOK, "NaN");
- checkSingle(CTFLexer.INFINITYTOK, "+inf");
- checkSingle(CTFLexer.NINFINITYTOK, "-inf");
- }
-
- /**
- * Validate the parsing of symbols
- */
- @Test
- public void testSymbols() {
- tokenize(" , : ... ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.SEPARATOR, ",");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COLON, ":");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.ELIPSES, "...");
- checkToken(CTFLexer.WS, " ");
-
- tokenize(" = := = ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.ASSIGNMENT, "=");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.TYPE_ASSIGNMENT, ":=");
- checkToken(CTFLexer.WS, " ");
-
- tokenize(" <<>> ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.LT, "<");
- checkToken(CTFLexer.LT, "<");
- checkToken(CTFLexer.GT, ">");
- checkToken(CTFLexer.GT, ">");
- checkToken(CTFLexer.WS, " ");
-
- tokenize(" ({[]}) ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.LPAREN, "(");
- checkToken(CTFLexer.LCURL, "{");
- checkToken(CTFLexer.OPENBRAC, "[");
- checkToken(CTFLexer.CLOSEBRAC, "]");
- checkToken(CTFLexer.RCURL, "}");
- checkToken(CTFLexer.RPAREN, ")");
- checkToken(CTFLexer.WS, " ");
-
- tokenize(";;");
- checkToken(CTFLexer.TERM, ";");
- checkToken(CTFLexer.TERM, ";");
-
- tokenize(" ++ -- ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.SIGN, "+");
- checkToken(CTFLexer.SIGN, "+");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.SIGN, "-");
- checkToken(CTFLexer.SIGN, "-");
- checkToken(CTFLexer.WS, " ");
-
- tokenize("-> .*.");
- checkToken(CTFLexer.ARROW, "->");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.DOT, ".");
- checkToken(CTFLexer.POINTER, "*");
- checkToken(CTFLexer.DOT, ".");
- }
-
- /**
- * Validate the parsing of literals
- */
- @Test
- public void testLiterals() {
- tokenize("01 02 010");
- checkToken(CTFLexer.OCTAL_LITERAL, "01");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.OCTAL_LITERAL, "02");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.OCTAL_LITERAL, "010");
-
- tokenize("1 2 10 1024 ");
- checkToken(CTFLexer.DECIMAL_LITERAL, "1");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.DECIMAL_LITERAL, "2");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.DECIMAL_LITERAL, "10");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.DECIMAL_LITERAL, "1024");
- checkToken(CTFLexer.WS, " ");
-
- tokenize("0x01 0x02 0x0F0");
- checkToken(CTFLexer.HEX_LITERAL, "0x01");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.HEX_LITERAL, "0x02");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.HEX_LITERAL, "0x0F0");
- }
-
- /**
- * Validate the parsing of literals with hexa prefix
- */
- @Test
- public void testLiteralPrefixes() {
- checkSingle(CTFLexer.HEX_LITERAL, "0x1");
- checkSingle(CTFLexer.HEX_LITERAL, "0X1");
- }
-
- /**
- * Validate the parsing of literals with type suffix
- */
- @Test
- public void testLiteralSuffixes() {
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0l");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0L");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0ll");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0LL");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0ul");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0uL");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0ull");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0uLL");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0Ul");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0UL");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0Ull");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0ULL");
- }
-
- /**
- * Validate the accepted characters in literals.
- */
- @Test
- public void testLiteralDigits() {
- checkSingle(CTFLexer.OCTAL_LITERAL, "001234567");
-
- checkSingle(CTFLexer.DECIMAL_LITERAL, "123456");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "987654");
-
- checkSingle(CTFLexer.HEX_LITERAL, "0x012345");
- checkSingle(CTFLexer.HEX_LITERAL, "0x678990");
- checkSingle(CTFLexer.HEX_LITERAL, "0xABCDEF");
- checkSingle(CTFLexer.HEX_LITERAL, "0xabcdef");
- }
-
- /**
- * Validate zero literal to be the right token.
- */
- @Test
- public void testLiteralZero() {
- checkSingle(CTFLexer.OCTAL_LITERAL, "00");
- checkSingle(CTFLexer.DECIMAL_LITERAL, "0");
- checkSingle(CTFLexer.HEX_LITERAL, "0x0");
- }
-
- /**
- * Validate character literals
- */
- @Test
- public void testCharLiteral() {
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'x'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\''");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "' '");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "L'1'");
- }
-
- /**
- * Validate escaped character literals
- */
- @Test
- public void testEscapeCharLiteral() {
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\a'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\b'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\f'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\n'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\r'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\t'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\v'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\''");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\\"'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\\\'");
-
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\001'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\01'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\1'");
-
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x1A'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x1a'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\xa'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\\x0'");
-
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\uABCD'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\u0123'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\u012345678'");
- checkSingle(CTFLexer.CHARACTER_LITERAL, "'\uFEDCBA987'");
- }
-
- /**
- * Validate string literals
- */
- @Test
- public void testStringLiteral() {
- checkSingle(CTFLexer.STRING_LITERAL, "\"\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"x\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\\"\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\" \"");
- checkSingle(CTFLexer.STRING_LITERAL, "L\"1\"");
-
- checkSingle(CTFLexer.STRING_LITERAL, "\"This is \\n a multiline\\r\\n\"");
- checkSingle(CTFLexer.STRING_LITERAL, "L\"This is \\n a multiline\\r\\n\"");
- }
-
- /**
- * Validate string literals with escape sequence
- */
- @Test
- public void testEscapeStringLiteral() {
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\a\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\b\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\f\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\n\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\r\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\t\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\v\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\'\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\\"\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\\\\"");
-
- checkSingle(CTFLexer.STRING_LITERAL, "\"\001\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\01\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\1\"");
-
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\x1A\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\x1a\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\xa\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\\x0\"");
-
- checkSingle(CTFLexer.STRING_LITERAL, "\"\uABCD\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\u0123\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\u012345678\"");
- checkSingle(CTFLexer.STRING_LITERAL, "\"\uFEDCBA987\"");
- }
-
- /**
- * Validate spaces parsing
- */
- @Test
- public void testWhitespaces() {
- tokenize(" \r\t\n\u000C ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.WS, "\r");
- checkToken(CTFLexer.WS, "\t");
- checkToken(CTFLexer.WS, "\n");
- checkToken(CTFLexer.WS, "\u000C");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate comments parsing
- */
- @Test
- public void testComment() {
- tokenize(" /* test */ ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COMMENT, "/* test */");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate complex nested comments parsing
- */
- @Test
- public void testNestedComment() {
- tokenize(" /* /* */ ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COMMENT, "/* /* */");
- checkToken(CTFLexer.WS, " ");
-
- tokenize(" /* /* * ** / */ ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COMMENT, "/* /* * ** / */");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate multi-lines comments
- */
- @Test
- public void testMultiLineComment() {
- tokenize(" /*\ntest\n*/ ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COMMENT, "/*\ntest\n*/");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate single line comments
- */
- @Test
- public void testLineComment() {
- tokenize(" // asdad\r\n ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.LINE_COMMENT, "// asdad\r\n");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate incomplete comments parsing
- */
- @Ignore("Lexer must be fixed first")
- @Test
- public void testLineCommentWithEOF() {
- tokenize("//");
- checkToken(CTFLexer.LINE_COMMENT, "//");
- }
-
- /**
- * Validate parsing of mixed kind of comments
- */
- @Test
- public void testMixedComment() {
- tokenize(" // /*\n");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.LINE_COMMENT, "// /*\n");
-
- tokenize(" /*\n//\n*/ ");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.COMMENT, "/*\n//\n*/");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate parsing identifiers
- */
- @Test
- public void testIdentifier() {
- tokenize("_ a a1 B ");
- checkToken(CTFLexer.IDENTIFIER, "_");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.IDENTIFIER, "a");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.IDENTIFIER, "a1");
- checkToken(CTFLexer.WS, " ");
- checkToken(CTFLexer.IDENTIFIER, "B");
- checkToken(CTFLexer.WS, " ");
- }
-
- /**
- * Validate accepted characters within an identifier
- */
- @Test
- public void testIdentifierLetters() {
- checkSingle(CTFLexer.IDENTIFIER, "ABCDEFGHI");
- checkSingle(CTFLexer.IDENTIFIER, "JKLMNOPQR");
- checkSingle(CTFLexer.IDENTIFIER, "STUVWXYZ");
- checkSingle(CTFLexer.IDENTIFIER, "abcdefghi");
- checkSingle(CTFLexer.IDENTIFIER, "jklmnopqr");
- checkSingle(CTFLexer.IDENTIFIER, "stuvwxyz");
- checkSingle(CTFLexer.IDENTIFIER, "_0123456789");
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Etienne Bergeron
- *
- * 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:
- * Etienne Bergeron - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CharStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.RecognitionException;
-import org.antlr.runtime.tree.CommonTree;
-import org.eclipse.tracecompass.ctf.parser.CTFLexer;
-import org.eclipse.tracecompass.ctf.parser.CTFParser;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * This test validates the CTF-Parser implementation.
- *
- * The goal of these tests is to validate syntactic rules and not the
- * CTF semantic. Each test parses a string with a given rule of the
- * compiled parser and validates the resulting tree by using match rules.
- *
- * @author Etienne Bergeron
- */
-public class CtfParserTest {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private CTFParser parser;
-
- // ------------------------------------------------------------------------
- // Matches - Helper class and functions to match a parsed tree.
- // ------------------------------------------------------------------------
-
- private class TreeMatcher {
- int fType;
- String fText;
- TreeMatcher[] fChild;
-
- TreeMatcher(int type, String text, TreeMatcher child[]) {
- fType = type;
- fText = text;
- fChild = child;
- }
-
- void matches(CommonTree tree) {
- if (fType == -1) {
- return;
- }
- if (tree.getType() != fType) {
- fail("Type mismatch!" +
- " expected:" + fType +
- " actual:" + tree.getType());
- }
-
- if (fText != null) {
- if (tree.getText().compareTo(fText) != 0) {
- fail("Text mismatch!" +
- " expected:" + fText +
- " actual:" + tree.getText());
- }
- }
-
- if (fChild != null) {
- int size = fChild.length;
- if (tree.getChildren() == null) {
- if (size != 0) {
- fail("Invalid children!"
- + "Expect: " + size + "child");
- }
- } else {
- if (tree.getChildren().size() != size) {
- fail("Invalid number of childs!"
- + " expected:" + size
- + " actual:" + tree.getChildren().size());
- }
-
- for (int i = 0; i < size; ++i) {
- fChild[i].matches((CommonTree) tree.getChild(i));
- }
- }
- }
- }
- }
-
- void Matches(TreeMatcher matcher, CommonTree tree) {
- if (tree == null) {
- fail("Parsing failed!");
- }
- matcher.matches(tree);
- }
-
- TreeMatcher All() {
- return new TreeMatcher(-1, null, null);
- }
-
- TreeMatcher Node(int type, TreeMatcher... child) {
- return new TreeMatcher(type, null, child);
- }
-
- TreeMatcher Node(int type, String text, TreeMatcher... child) {
- return new TreeMatcher(type, text, child);
- }
-
- TreeMatcher List(TreeMatcher... child) {
- return new TreeMatcher(0, null, child);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- private void setInput(String content) {
- CharStream cs = new ANTLRStringStream(content);
- CTFLexer lexer = new CTFLexer(cs);
- CommonTokenStream tokens = new CommonTokenStream(lexer);
- parser = new CTFParser(tokens, false);
- }
-
- private CommonTree primaryExpression(String content) {
- try {
- setInput(content);
- return parser.primaryExpression().getTree();
- } catch (RecognitionException e) {
- return null;
- }
- }
-
- private CommonTree unaryExpression(String content) {
- try {
- setInput(content);
- return parser.unaryExpression().getTree();
- } catch (RecognitionException e) {
- return null;
- }
- }
-
- private CommonTree declaration(String content) {
- try {
- setInput(content);
- return parser.declaration().getTree();
- } catch (RecognitionException e) {
- return null;
- }
- }
-
- // ------------------------------------------------------------------------
- // Test cases
- // ------------------------------------------------------------------------
-
-
- /**
- * Validate that parsing of an empty expression is invalid.
- */
- @Test
- public void testPrimaryExpression() {
- CommonTree tree_empty = primaryExpression("");
- assertEquals(null, tree_empty);
- }
-
- /**
- * Validate parsing of literals through a primary expression
- */
- @Test
- public void testIntegerLiteralPrimaryExpression() {
- Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "123")),
- primaryExpression("123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_HEX,
- Node(CTFParser.HEX_LITERAL, "0x123")),
- primaryExpression("0x123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_OCT,
- Node(CTFParser.OCTAL_LITERAL, "0123")),
- primaryExpression("0123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "123"),
- Node(CTFParser.SIGN, "-")),
- primaryExpression("-123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "123"),
- Node(CTFParser.SIGN, "-")),
- primaryExpression(" - 123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "123"),
- Node(CTFParser.SIGN, "-"),
- Node(CTFParser.SIGN, "-"),
- Node(CTFParser.SIGN, "+")),
- primaryExpression(" - - + 123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_HEX,
- Node(CTFParser.HEX_LITERAL, "0x123"),
- Node(CTFParser.SIGN, "+"),
- Node(CTFParser.SIGN, "-")),
- primaryExpression("+ - 0x123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_OCT,
- Node(CTFParser.OCTAL_LITERAL, "0123"),
- Node(CTFParser.SIGN, "+"),
- Node(CTFParser.SIGN, "-")),
- primaryExpression("+ - 0123"));
- }
-
- /**
- * Validate parsing of a character literals through a primary expression
- */
- @Test
- public void testCharacterLiteralPrimaryExpression() {
- Matches(Node(CTFParser.CHARACTER_LITERAL, "'a'"),
- primaryExpression("'a'"));
-
- Matches(Node(CTFParser.CHARACTER_LITERAL, "'\\n'"),
- primaryExpression("'\\n'"));
- }
-
- /**
- * Validate parsing of a string literals through a primary expression
- */
- @Test
- public void testStringLiteralPrimaryExpression() {
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
- Node(CTFParser.STRING_LITERAL, "\"aaa\"")),
- primaryExpression("\"aaa\""));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
- Node(CTFParser.STRING_LITERAL, "L\"aaa\"")),
- primaryExpression("L\"aaa\""));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
- Node(CTFParser.STRING_LITERAL, "\"aaa\\n\"")),
- primaryExpression("\"aaa\\n\""));
- }
-
- /**
- * Validate parsing of keywords through a primary expression
- */
- @Test
- public void testKeywordPrimaryExpression() {
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.SIGNEDTOK, "signed")),
- primaryExpression("signed"));
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.ALIGNTOK, "align")),
- primaryExpression("align"));
- }
-
- /**
- * Validate parsing of identifiers through a primary expression
- */
- @Test
- public void testIdentifierPrimaryExpression() {
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- primaryExpression("x"));
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "_123")),
- primaryExpression("_123"));
- }
-
- /**
- * Validate that parsing of an empty unary expression is invalid.
- */
- @Test
- public void testUnaryExpression() {
- CommonTree tree_empty = unaryExpression("");
- assertEquals(null, tree_empty);
- }
-
- /**
- * Validate parsing primary expression through an unary expression
- */
- @Test
- public void testSimpleUnaryExpression() {
- Matches(Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "123")),
- unaryExpression("123"));
-
- Matches(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- unaryExpression("x"));
- }
-
- /**
- * Validate parsing array through an unary expression
- */
- @Test
- public void testArrayUnaryExpression() {
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"))),
- unaryExpression("x[1]"));
-
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "n"))),
- unaryExpression("x[n]"));
-
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "n")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"))),
- unaryExpression("x[n][1]"));
-
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "n")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"),
- Node(CTFParser.SIGN, "+"))),
- unaryExpression("x[n][+1]"));
- }
-
- /**
- * Validate parsing array with keywords through an unary expression
- */
- @Test
- public void testSpecialArrayUnaryExpression() {
- // Added for CTF-v1.8
- Matches(List(Node(CTFParser.TRACE),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "n"))),
- unaryExpression("trace[n]"));
-
- Matches(List(Node(CTFParser.CLOCK),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "n")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"))),
- unaryExpression("clock[n][1]"));
- }
-
- /**
- * Validate parsing member expression through an unary expression
- */
- @Test
- public void testMemberUnaryExpression() {
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.DOT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "y")))),
- unaryExpression("x.y"));
-
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.DOT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "y"))),
- Node(CTFParser.DOT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "z")))),
- unaryExpression("x.y.z"));
- }
-
- /**
- * Validate parsing pointer expression through an unary expression
- */
- @Test
- public void testPointerUnaryExpression() {
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.ARROW,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "y")))),
- unaryExpression("x->y"));
-
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.ARROW,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "y"))),
- Node(CTFParser.ARROW,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "z")))),
- unaryExpression("x->y->z"));
- }
-
- /**
- * Validate complex expressions through an unary expression
- */
- @Test
- public void testMixedUnaryExpression() {
- Matches(List(Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "x")),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "2")),
- Node(CTFParser.ARROW,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "y"))),
- Node(CTFParser.DOT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "z"))),
- Node(CTFParser.OPENBRAC),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"))),
- unaryExpression("x[2]->y.z[1]"));
- }
-
- /**
- * Validate that parsing of an empty declaration is invalid.
- */
- @Test
- public void testDeclaration() {
- CommonTree tree_empty = declaration("");
- assertEquals(null, tree_empty);
- }
-
- /**
- * Validate parsing of integer declaration
- */
- @Test
- public void testIntegerTypeAliasDeclaration() {
- // TODO: replace the "all" match with a better tree matcher.
- Matches(All(),
- declaration("typealias integer { } := int;"));
- Matches(All(),
- declaration("typealias integer { signed=true; } := int;"));
- }
-
- /**
- * Validate parsing of floating declaration
- */
- @Test
- public void testFloatingTypeAliasDeclaration() {
- // TODO: replace the "all" match with a better tree matcher.
- Matches(All(),
- declaration("typealias floating_point { } := float;"));
- Matches(All(),
- declaration("typealias floating_point { align = 32; } := float;"));
- }
-
- /**
- * Validate parsing of typedef declaration
- */
- @Ignore("This need a fix to the grammar to support a dummy initial scope. ")
- @Test
- public void testTypedefDeclaration() {
- // TODO: replace the "all" match with a better tree matcher.
- Matches(All(),
- declaration("typedef dummy int;"));
- Matches(All(),
- declaration("typedef integer { } int;"));
- }
-
- /**
- * Validate parsing of an enum declaration
- */
- @Test
- public void testEnumDeclaration() {
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_NAME,
- Node(CTFParser.IDENTIFIER, "name")),
- Node(CTFParser.ENUM_BODY,
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "A"))))))),
- declaration("enum name { A };"));
-
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_NAME, All()),
- Node(CTFParser.ENUM_CONTAINER_TYPE,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.INTTOK))),
- Node(CTFParser.ENUM_BODY, All())))),
- declaration("enum name : int { A };"));
-
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_BODY, All())))),
- declaration("enum { A };"));
-
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_CONTAINER_TYPE,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.INTTOK))),
- Node(CTFParser.ENUM_BODY, All())))),
- declaration("enum : int { A };"));
- }
-
- /**
- * Validate parsing of an enumerator
- */
- @Ignore("The grammar needs to be fixed.")
- @Test
- public void testDeclaratorOfEnumDeclaration() {
- /* TODO: This test crash the parser. */
- Matches(All(),
- declaration("enum { };"));
-
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_BODY,
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "A"))),
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "B")),
- Node(CTFParser.ENUM_VALUE,
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "2")))),
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "C")),
- Node(CTFParser.ENUM_VALUE_RANGE,
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "3")),
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "5")))))))),
- declaration("enum { A, B=2, C=3...5 };"));
-
- Matches(Node(CTFParser.DECLARATION,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.ENUM,
- Node(CTFParser.ENUM_BODY,
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
- Node(CTFParser.STRING_LITERAL, "\"A\""))),
- Node(CTFParser.ENUM_ENUMERATOR,
- Node(CTFParser.UNARY_EXPRESSION_STRING_QUOTES,
- Node(CTFParser.STRING_LITERAL, "\"B\"")),
- All()))))),
- declaration("enum { \"A\", \"B\"=2 };"));
- }
-
- /**
- * Validate parsing of empty declaration
- */
- @Ignore("The grammar need to be fixed to support empty ctf-body.")
- @Test
- public void testEmptyDeclaration() {
- /* TODO: An exception is throw when building an common tree without
- * assignments in the ctf-body.
- */
- Matches(All(),
- declaration("env { };"));
- Matches(All(),
- declaration("trace { };"));
- Matches(All(),
- declaration("stream { };"));
- Matches(All(),
- declaration("event { };"));
- }
-
- /**
- * Validate parsing of an environment declaration
- */
- @Test
- public void testEnvDeclaration() {
- Matches(Node(CTFParser.ENV,
- Node(CTFParser.CTF_EXPRESSION_VAL,
- Node(CTFParser.CTF_LEFT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "pid"))),
- Node(CTFParser.CTF_RIGHT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "value"))))),
- declaration("env { pid = value; };"));
-
- Matches(Node(CTFParser.ENV,
- Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
- Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
- Node(CTFParser.CTF_EXPRESSION_VAL, All(), All())),
- declaration("env { pid = value; proc_name = \"name\"; x = y;};"));
- }
-
- /**
- * Validate parsing of a trace declaration
- */
- @Ignore("The grammar need to be fixed.")
- @Test
- public void testTraceDeclaration() {
- Matches(Node(CTFParser.TRACE,
- Node(CTFParser.CTF_EXPRESSION_VAL,
- Node(CTFParser.CTF_LEFT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "major"))),
- Node(CTFParser.CTF_RIGHT,
- Node(CTFParser.UNARY_EXPRESSION_DEC,
- Node(CTFParser.DECIMAL_LITERAL, "1"))))),
- declaration("trace { major = 1; };"));
-
- Matches(Node(CTFParser.TRACE,
- Node(CTFParser.CTF_EXPRESSION_TYPE,
- Node(CTFParser.CTF_LEFT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "packet")),
- Node(CTFParser.DOT,
- Node(CTFParser.UNARY_EXPRESSION_STRING,
- Node(CTFParser.IDENTIFIER, "header")))),
- Node(CTFParser.CTF_RIGHT,
- Node(CTFParser.TYPE_SPECIFIER_LIST,
- Node(CTFParser.STRUCT,
- Node(CTFParser.STRUCT_NAME,
- Node(CTFParser.IDENTIFIER, "dummy"))))))),
- declaration("trace { packet.header := struct dummy; };"));
-
- /* TODO: This test crash the parser. */
- Matches(Node(CTFParser.TRACE,
- All()),
- declaration("trace { typedef x y; };"));
-
- Matches(Node(CTFParser.TRACE,
- Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
- Node(CTFParser.CTF_EXPRESSION_VAL, All(), All()),
- Node(CTFParser.CTF_EXPRESSION_TYPE, All(), All())),
- declaration("trace { major = 1; minor = 1;"
- + "packet.header := struct dummy; };"));
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/antlr3"/>
- <classpathentry kind="src" path="target/generated-sources/antlr3"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.ctf.parser</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.deved.antlride.core.nature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=disabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.ctf.parser
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.tracecompass.ctf.parser;x-friends:="org.eclipse.tracecompass.ctf.core,org.eclipse.tracecompass.ctf.parser.tests"
-Import-Package: org.antlr.runtime;version="3.2.0",
- org.antlr.runtime.tree;version="3.2.0"
+++ /dev/null
-This file describes how to build the CTF Java parser files. They are stored in
-the git repository (to avoid additional compile-time dependencies), but if you
-do modify the .g files in src/, you should rebuild the resulting .java files and
-commit them.
-
-To rebuild the parser files, run Maven with the "ctf-grammar" profile, as such:
-$ mvn clean install -Pctf-grammar
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = src/main/antlr3,\
- target/generated-sources/antlr3
-output.. = bin/
-bin.includes = META-INF/,\
- plugin.properties,\
- about.html,\
- .
-jars.compile.order = .
-src.includes = about.html
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-#Properties file fororg.eclipse.tracecompass.ctf.parser
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = Trace Compass CTF Parser Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <name>Trace Compass CTF Parser Plug-in</name>
- <groupId>org.eclipse.tracecompass</groupId>
- <artifactId>org.eclipse.tracecompass.ctf.parser</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-source-plugin</artifactId>
- </plugin>
- <!-- Do not delete the existing .java parser files in target/ -->
- <plugin>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.6.1</version>
- <configuration>
- <excludeDefaultDirectories>true</excludeDefaultDirectories>
- <filesets>
- <fileset>
- <directory>target</directory>
- <followSymlinks>false</followSymlinks>
- <includes>
- <include>*/**</include>
- </includes>
- <excludes>
- <exclude>generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFLexer.java</exclude>
- <exclude>generated-sources/antlr3/org/eclipse/tracecompass/ctf/parser/CTFParser.java</exclude>
- </excludes>
- </fileset>
- </filesets>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <!-- Only rebuild the CTF grammar files if the ctf-grammar profile is active -->
- <profiles>
- <profile>
- <id>ctf-grammar</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr3-maven-plugin</artifactId>
- <version>3.5.2</version>
- <executions>
- <execution>
- <goals>
- <goal>antlr</goal>
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr-runtime</artifactId>
- <version>3.5.2</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
+++ /dev/null
-lexer grammar CTFLexer;
-
-options {
- language = Java;
-}
-
-@lexer::header {
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Etienne Bergeron - Update to Antlr 3.5 syntax
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser;
-}
-
-/*
- * Lexer tokens
- */
-
-/*
- * Keywords
- */
-ALIGNTOK : 'align' ;
-CONSTTOK : 'const' ;
-CHARTOK : 'char' ;
-DOUBLETOK : 'double' ;
-ENUMTOK : 'enum' ;
-EVENTTOK : 'event' ;
-FLOATINGPOINTTOK : 'floating_point' ;
-FLOATTOK : 'float' ;
-INTEGERTOK : 'integer' ;
-INTTOK : 'int' ;
-LONGTOK : 'long' ;
-SHORTTOK : 'short' ;
-SIGNEDTOK : 'signed' ;
-STREAMTOK : 'stream' ;
-STRINGTOK : 'string' ;
-STRUCTTOK : 'struct' ;
-TRACETOK : 'trace' ;
-TYPEALIASTOK : 'typealias' ;
-TYPEDEFTOK : 'typedef' ;
-UNSIGNEDTOK : 'unsigned' ;
-VARIANTTOK : 'variant' ;
-VOIDTOK : 'void' ;
-BOOLTOK : '_Bool' ;
-COMPLEXTOK : '_Complex' ;
-IMAGINARYTOK : '_Imaginary' ;
-ENVTOK : 'env' ;
-CLOCKTOK : 'clock' ;
-/*
- * Callsite tokens (CTF v1.9)
- */
-CALLSITETOK : 'callsite' ;
-
-
-/*
- * These tokens are not part of the CTF standard.
- * There are planned to be in CTF v1.9
- */
-NANNUMBERTOK : 'NaN' ;
-INFINITYTOK : '+inf' ;
-NINFINITYTOK : '-inf' ;
-
-/*
- * Symbols
- */
-SEPARATOR : ',' ;
-COLON : ':' ;
-ELIPSES : '...' ;
-ASSIGNMENT : '=' ;
-TYPE_ASSIGNMENT : ':=' ;
-LT : '<' ;
-GT : '>' ;
-OPENBRAC : '[' ;
-CLOSEBRAC : ']' ;
-LPAREN : '(' ;
-RPAREN : ')' ;
-LCURL : '{' ;
-RCURL : '}' ;
-TERM : ';' ;
-POINTER : '*' ;
-SIGN : '+' | '-' ;
-ARROW : '->' ;
-DOT : '.' ;
-fragment BACKSLASH : '\\' ;
-
-/* Helpers for integer literals */
-fragment DIGIT : '0'..'9' ;
-fragment OCT_DIGIT : '0'..'7' ;
-fragment OCT_PREFIX : '0' ;
-fragment NONZERO_DIGIT : '1'..'9' ;
-fragment HEX_DIGIT : DIGIT | ('a'..'f') | ('A'..'F') ;
-fragment HEX_PREFIX : '0' ('x' | 'X') ;
-
-/*
- * Integer literals
- */
-OCTAL_LITERAL : OCT_PREFIX (OCT_DIGIT)+ INTEGER_TYPES_SUFFIX? ;
-DECIMAL_LITERAL : DIGIT+ INTEGER_TYPES_SUFFIX? ;
-HEX_LITERAL : HEX_PREFIX HEX_DIGIT+ INTEGER_TYPES_SUFFIX? ;
-
-/**
- * Integer suffix for long, long long and unsigned.
- *
- * Matches all possible combination of L, LL and U.
- */
-fragment INTEGER_TYPES_SUFFIX
- : ('l' ('l')? | 'L' ('L')?) // l, ll
- | ('u' | 'U') // u
- | ('u' | 'U') ('l' ('l')? | 'L' ('L')?) // ul, ull
- | ('l' ('l')? | 'L' ('L')?) ('u'| 'U') // lu, llu
- ;
-
-/**
- * Escape sequences
- */
-fragment ESCAPE_SEQUENCE
- : BACKSLASH ('\'' | '"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' )
- | OCTAL_ESCAPE
- | UNICODE_ESCAPE
- | HEXADECIMAL_ESCAPE
- ;
-
-/**
- * Octal escape sequence
- */
-fragment OCTAL_ESCAPE
- : BACKSLASH ('0'..'3') ('0'..'7') ('0'..'7')
- | BACKSLASH ('0'..'7') ('0'..'7')
- | BACKSLASH ('0'..'7')
- ;
-
-/**
- * Hexadecimal escape sequence
- */
-fragment HEXADECIMAL_ESCAPE : BACKSLASH 'x' HEX_DIGIT+ ;
-
-/**
- * Unicode escape sequence
- */
-fragment UNICODE_ESCAPE
- : BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
- | BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
- ;
-
-
-/* Used in both character and string literal */
-fragment STRINGPREFIX : 'L';
-
-/*
- * Character literal
- */
-CHARACTER_LITERAL : STRINGPREFIX? SINGLEQUOTE CHAR_CONTENT+ SINGLEQUOTE ;
-fragment CHAR_CONTENT : (ESCAPE_SEQUENCE | ~(BACKSLASH | SINGLEQUOTE)) ;
-fragment SINGLEQUOTE : '\'';
-
-/*
- * String literal
- */
-STRING_LITERAL : STRINGPREFIX? DOUBLEQUOTE STRING_CONTENT* DOUBLEQUOTE ;
-fragment STRING_CONTENT : (ESCAPE_SEQUENCE | ~(BACKSLASH | DOUBLEQUOTE)) ;
-fragment DOUBLEQUOTE : '"' ;
-
-/**
- * Whitespaces
- */
-WS : (' ' | '\r' | '\t' | '\u000C' | '\n') { $channel = HIDDEN; } ;
-
-/**
- * Multiline comment
- */
-// About the greedy option: see page 100-101 of The Definitive ANTLR reference
-// COMMENT : '/*' ( options { greedy = false; } : . )* '*/' { $channel = HIDDEN; } ;
-COMMENT : COMMENT_OPEN .* COMMENT_CLOSE { $channel = HIDDEN; } ;
-fragment COMMENT_OPEN : '/*';
-fragment COMMENT_CLOSE : '*/';
-
-/**
- * Single line comment
- */
-LINE_COMMENT : '//' ~('\n')* '\n' { $channel = HIDDEN; } ;
-
-/**
- * Identifiers
- */
-IDENTIFIER : NONDIGIT (NONDIGIT | DIGIT)* ;
-fragment NONDIGIT : ('_') | ('A'..'Z') | ('a'..'z') ;
+++ /dev/null
-parser grammar CTFParser;
-
-options {
- language = Java;
- output = AST;
- ASTLabelType = CommonTree;
- tokenVocab = CTFLexer;
-}
-
-tokens {
- ROOT;
-
- EVENT;
- STREAM;
- TRACE;
- ENV;
- CLOCK;
- CALLSITE;
-
- DECLARATION;
- SV_DECLARATION;
- TYPE_SPECIFIER_LIST;
- TYPE_DECLARATOR_LIST;
- TYPE_DECLARATOR;
-
- STRUCT;
- STRUCT_NAME;
- STRUCT_BODY;
- ALIGN;
-
- CTF_EXPRESSION_TYPE;
- CTF_EXPRESSION_VAL;
- CTF_LEFT;
- CTF_RIGHT;
-
- UNARY_EXPRESSION_STRING;
- UNARY_EXPRESSION_STRING_QUOTES;
- UNARY_EXPRESSION_DEC;
- UNARY_EXPRESSION_HEX;
- UNARY_EXPRESSION_OCT;
- LENGTH;
-
- TYPEDEF;
-
- TYPEALIAS;
- TYPEALIAS_TARGET;
- TYPEALIAS_ALIAS;
-
- INTEGER;
- STRING;
- FLOATING_POINT;
-
- ENUM;
- ENUM_CONTAINER_TYPE;
- ENUM_ENUMERATOR;
- ENUM_NAME;
- ENUM_VALUE;
- ENUM_VALUE_RANGE;
- ENUM_BODY;
-
- VARIANT;
- VARIANT_NAME;
- VARIANT_TAG;
- VARIANT_BODY;
-
- DECLARATOR;
- LENGTH;
-}
-
-/*
- * Scope for the tracking of types.
- * For now we just track the names (it's a simple Set), but
- * later we will have to track the info about the target type.
- */
-scope Symbols {
- Set<String> types;
-}
-
-@header {
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Etienne Bergeron - Update to Antlr 3.5 syntax
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser;
-
-import java.util.Set;
-import java.util.HashSet;
-}
-
-@members {
- public CTFParser(TokenStream input, boolean verbose) {
- this(input);
- this.verbose = verbose;
- }
-
- /**
- * This method is overriden to disable automatic error recovery.
- * On a mismatched token, it simply re-throw an exception.
- */
- @Override
- protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
- throw new MismatchedTokenException(ttype, input);
- }
-
- /**
- * Checks if a given name has been defined has a type.
- * From: http://www.antlr.org/grammar/1153358328744/C.g
- *
- * @param name The name to check.
- * @return True if is is a type, false otherwise.
- */
- boolean isTypeName(String name) {
- for (int i = Symbols_stack.size() - 1; i >= 0; i--) {
- Symbols_scope scope = (Symbols_scope) Symbols_stack.get(i);
- if (scope.types.contains(name)) {
- return true;
- }
- }
- return false;
- }
-
- void addTypeName(String name) {
- $Symbols::types.add(name);
- if (verbose) {
- debug_print("New type: " + name);
- }
- }
-
- boolean _inTypedef = false;
-
- void typedefOn() {
- debug_print("typedefOn");
- _inTypedef = true;
- }
-
- void typedefOff() {
- debug_print("typedefOff");
- _inTypedef = false;
- }
-
- boolean inTypedef() {
- return _inTypedef;
- }
-
- boolean _inTypealiasAlias = false;
-
- void typealiasAliasOn() {
- debug_print("typealiasAliasOn");
- _inTypealiasAlias = true;
- }
-
- void typealiasAliasOff() {
- debug_print("typealiasAliasOff");
- _inTypealiasAlias = false;
- }
-
- boolean inTypealiasAlias() {
- return _inTypealiasAlias;
- }
-
- void debug_print(String str) {
- if (verbose) {
- System.out.println(str);
- }
- }
-
- /* Prints rule entry and exit while parsing */
- boolean verbose = false;
-}
-
- /*
- * Override the catch clause to disable automatic error recovery.
- * By default, the catch block of every rule simple rethrows the error.
- */
-@rulecatch {
- catch (RecognitionException e) {
- throw e;
- }
-}
-
-/* The top-level rule. */
-parse
-scope Symbols;
-@init {
- $Symbols::types = new HashSet<String>();
-}
- : declaration+ EOF -> ^(ROOT declaration+)
- ;
-
-numberLiteral
- : SIGN*
- ( HEX_LITERAL -> ^(UNARY_EXPRESSION_HEX HEX_LITERAL SIGN*)
- | DECIMAL_LITERAL -> ^(UNARY_EXPRESSION_DEC DECIMAL_LITERAL SIGN*)
- | OCTAL_LITERAL -> ^(UNARY_EXPRESSION_OCT OCTAL_LITERAL SIGN*)
- )
- ;
-
-primaryExpression
- : (IDENTIFIER) => IDENTIFIER
- -> ^(UNARY_EXPRESSION_STRING IDENTIFIER)
- | (ctfKeyword) => ctfKeyword -> ^(UNARY_EXPRESSION_STRING ctfKeyword)
- | (STRING_LITERAL) => STRING_LITERAL
- -> ^(UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL)
- /*| (LPAREN unaryExpression RPAREN)*/ // Not supported yet
- | numberLiteral
- | enumConstant
- | CHARACTER_LITERAL
- ;
-
-postfixExpressionSuffix
- : OPENBRAC unaryExpression CLOSEBRAC!
- | (ref=DOT | ref=ARROW) IDENTIFIER
- -> ^($ref ^(UNARY_EXPRESSION_STRING IDENTIFIER))
- ;
-
-postfixExpression
- : primaryExpression postfixExpressionSuffix*
- | ctfSpecifierHead postfixExpressionSuffix+ // added for ctf-v1.8
- ;
-
-unaryExpression
- : postfixExpression
- /* | ((SIGN postfixExpression[true]) | postfixExpression[false]) */
- ;
-
-enumConstant
- : STRING_LITERAL -> ^(UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL)
- | IDENTIFIER -> ^(UNARY_EXPRESSION_STRING IDENTIFIER)
- | ctfKeyword -> ^(UNARY_EXPRESSION_STRING ctfKeyword)
- ;
-
-// 2.2
-
-declaration
-@after {
- if (inTypedef()) {
- typedefOff();
- }
-}
- : declarationSpecifiers declaratorList? TERM
- // When the declaration is completely parsed and was a typedef,
- // we add the declarators to the symbol table.
- -> {inTypedef()}?
- ^(DECLARATION ^(TYPEDEF declaratorList declarationSpecifiers))
- -> ^(DECLARATION declarationSpecifiers declaratorList?)
- | ctfSpecifier TERM!
- ;
-
-declarationSpecifiers
- : (
- // We don't want to keep the typedef keyword in the specifier list.
- // Instead, we keep track that we encountered a typedef in the declaration.
- storageClassSpecifier
- | typeQualifier
- | typeSpecifier
- )+ -> ^(TYPE_SPECIFIER_LIST typeQualifier* typeSpecifier*)
- ;
-
-declaratorList
- : declarator (SEPARATOR declarator)*
- -> ^(TYPE_DECLARATOR_LIST declarator+)
- ;
-
-abstractDeclaratorList
- : abstractDeclarator (SEPARATOR abstractDeclarator)*
- -> ^(TYPE_DECLARATOR_LIST abstractDeclarator+)
- ;
-
-storageClassSpecifier
- : TYPEDEFTOK { typedefOn(); }
- ;
-
-typeSpecifier
- : FLOATTOK
- | INTTOK
- | LONGTOK
- | SHORTTOK
- | SIGNEDTOK
- | UNSIGNEDTOK
- | CHARTOK
- | DOUBLETOK
- | VOIDTOK
- | BOOLTOK
- | COMPLEXTOK
- | IMAGINARYTOK
- | structSpecifier
- | variantSpecifier
- | enumSpecifier
- | ctfTypeSpecifier
- | { inTypealiasAlias() || isTypeName(input.LT(1).getText()) }? => typedefName
- ;
-
-typeQualifier
- : CONSTTOK
- ;
-
-alignAttribute
- : ALIGNTOK LPAREN unaryExpression RPAREN -> ^(ALIGN unaryExpression)
- ;
-
- // you can have an empty struct but not an empty variant
-structBody
-scope Symbols;
-@init {
- $Symbols::types = new HashSet<String>();
-}
- : LCURL structOrVariantDeclarationList? RCURL
- -> ^(STRUCT_BODY structOrVariantDeclarationList?)
- ;
-
-structSpecifier
- : STRUCTTOK
- (
- // We have an IDENTIFIER after 'struct'
- (
- structName
- (
- alignAttribute
- |
- (
- structBody
- ( /* structBody can return an empty tree, so we need those ? */
- alignAttribute
- |
- /* empty */
- )
- )
- |
- /* empty */
- )
- )
- |
- // We have a body after 'struct'
- (
- structBody
- (
- alignAttribute
- |
- /* empty */
- )
- )
- ) -> ^(STRUCT structName? structBody? alignAttribute?)
- ;
-
-structName
- : IDENTIFIER -> ^(STRUCT_NAME IDENTIFIER)
- ;
-
-structOrVariantDeclarationList
- : structOrVariantDeclaration+
- ;
-
-structOrVariantDeclaration
- :
- (
- (
- declarationSpecifiers
- (
- /* If we met a "typedef" */
- {inTypedef()}? => declaratorList {typedefOff();}
- -> ^(TYPEDEF declaratorList declarationSpecifiers)
- | structOrVariantDeclaratorList
- -> ^(SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList)
- )
- )
- |
- // Lines 3 and 4
- typealiasDecl -> typealiasDecl
- )
- TERM
- ;
-
-specifierQualifierList
- : (typeQualifier | typeSpecifier)+
- -> ^(TYPE_SPECIFIER_LIST typeQualifier* typeSpecifier*)
- ;
-
-structOrVariantDeclaratorList
- : structOrVariantDeclarator (SEPARATOR structOrVariantDeclarator)*
- -> ^(TYPE_DECLARATOR_LIST structOrVariantDeclarator+)
- ;
-
-structOrVariantDeclarator
- :
- /* Bitfields not supported yet */
- (declarator (COLON numberLiteral)?) -> declarator
- /*| (COLON numberLiteral)*/
- ;
-
-variantSpecifier
- : VARIANTTOK
- (
- (
- variantName
- (
- (
- variantTag
- (
- variantBody
- |
- /* empty */
- )
- )
- |
- variantBody
- )
- )
- | (variantTag variantBody)
- | variantBody
- ) -> ^(VARIANT variantName? variantTag? variantBody?)
- ;
-
-variantName
- : IDENTIFIER -> ^(VARIANT_NAME IDENTIFIER)
- ;
-
-variantBody
-scope Symbols;
-@init {
- $Symbols::types = new HashSet<String>();
-}
- : LCURL structOrVariantDeclarationList RCURL
- -> ^(VARIANT_BODY structOrVariantDeclarationList)
- ;
-
-variantTag
- : LT IDENTIFIER GT -> ^(VARIANT_TAG IDENTIFIER)
- ;
-
-enumSpecifier
- : ENUMTOK
- (
- // Lines 1 to 5, when we have "ENUMTOK IDENTIFIER".
- (
- enumName
- (
- enumContainerType enumBody
- |
- enumBody
- |
- // no enumDeclarator or enumBodym
- )
- )
- |
- // Lines 1, 2, 4, 5, when we have no IDENTIFIER.
- (
- enumContainerType enumBody
- |
- enumBody
- )
- ) -> ^(ENUM enumName? enumContainerType? enumBody?)
- ;
-
-enumName
- : IDENTIFIER -> ^(ENUM_NAME IDENTIFIER)
- ;
-
-enumBody
- : LCURL enumeratorList SEPARATOR? RCURL -> ^(ENUM_BODY enumeratorList)
- ;
-
-enumContainerType
- : COLON declarationSpecifiers -> ^(ENUM_CONTAINER_TYPE declarationSpecifiers)
- ;
-
-enumeratorList
- : enumerator (SEPARATOR enumerator)* -> (^(ENUM_ENUMERATOR enumerator))+
- ;
-
-enumerator
- : enumConstant enumeratorValue?
- ;
-
-enumeratorValue
- : ASSIGNMENT e1=unaryExpression
- ( /* empty */
- -> ^(ENUM_VALUE $e1)
- | ELIPSES e2=unaryExpression
- -> ^(ENUM_VALUE_RANGE $e1 $e2)
- )
- ;
-
-declarator
- : pointer* directDeclarator
- -> ^(TYPE_DECLARATOR pointer* directDeclarator)
- ;
-
-directDeclarator
- : (
- IDENTIFIER
- { if (inTypedef()) addTypeName($IDENTIFIER.text); }
- { debug_print($IDENTIFIER.text); }
- /*| LPAREN declarator RPAREN*/ /* Not supported yet */
- )
- directDeclaratorSuffix*
- ;
-
-directDeclaratorSuffix
- : OPENBRAC directDeclaratorLength CLOSEBRAC
- -> ^(LENGTH directDeclaratorLength)
- ;
-
-directDeclaratorLength
- : unaryExpression
- ;
-
-abstractDeclarator
- : pointer+ directAbstractDeclarator?
- -> ^(TYPE_DECLARATOR pointer+ directAbstractDeclarator?)
- | directAbstractDeclarator
- -> ^(TYPE_DECLARATOR directAbstractDeclarator)
- ;
-
-/**
- * In the CTF grammar, direct-abstract-declarator can be empty (because of
- * identifier-opt). We take care of that by appending a '?' to each use of
- * "abstractDeclaratorList".
- */
-directAbstractDeclarator
- : (
- IDENTIFIER
- | (LPAREN abstractDeclarator RPAREN)
- ) (
- OPENBRAC unaryExpression? CLOSEBRAC
- )?
- ;
-
-pointer
- : POINTER typeQualifierList? -> ^(POINTER typeQualifierList?)
- ;
-
-typeQualifierList
- : typeQualifier+
- ;
-
-typedefName
- : {inTypealiasAlias() || isTypeName(input.LT(1).getText())}? IDENTIFIER { if ((inTypedef() || inTypealiasAlias()) && !isTypeName($IDENTIFIER.text)) { addTypeName($IDENTIFIER.text); } }
- ;
-
-/**
- * What goes in the target part of a typealias.
- *
- * For example, the integer part in:
- * typealias integer {...} := my_new_integer;
- */
-typealiasTarget
- : declarationSpecifiers abstractDeclaratorList?
- ;
-
-/**
- * What goes in the alias part of a typealias.
- *
- * For example, the my_new_integer part in:
- * typealias integer {...} := my_new_integer;
- */
-typealiasAlias
-@init {
- typealiasAliasOn();
-}
-@after {
- typealiasAliasOff();
-}
- : abstractDeclaratorList
- | declarationSpecifiers abstractDeclaratorList?
- ;
-
-typealiasDecl
- : TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias
- -> ^(TYPEALIAS
- ^(TYPEALIAS_TARGET typealiasTarget)
- ^(TYPEALIAS_ALIAS typealiasAlias))
- ;
-
-// 2.3 CTF stuff
-
-// TODO: Ajouter ceux qui manquent
-ctfKeyword
- : ALIGNTOK
- | EVENTTOK
- | SIGNEDTOK
- | STRINGTOK
- ;
-
-ctfSpecifier
- // event {...}, stream {...}, trace {...}
- : ctfSpecifierHead ctfBody -> ^(ctfSpecifierHead ctfBody)
- // typealias
- | typealiasDecl -> ^(DECLARATION typealiasDecl)
- ;
-
-ctfSpecifierHead
- : EVENTTOK -> EVENT
- | STREAMTOK -> STREAM
- | TRACETOK -> TRACE
- | ENVTOK -> ENV
- | CLOCKTOK -> CLOCK
- | CALLSITETOK -> CALLSITE
- ;
-
-ctfTypeSpecifier
- /* ctfBody can return an empty tree if the body is empty */
- : FLOATINGPOINTTOK ctfBody -> ^(FLOATING_POINT ctfBody?)
- | INTEGERTOK ctfBody -> ^(INTEGER ctfBody?)
- | STRINGTOK ctfBody? -> ^(STRING ctfBody?)
- ;
-
-ctfBody
-scope Symbols;
-@init {
- $Symbols::types = new HashSet<String>();
-}
- : LCURL ctfAssignmentExpressionList? RCURL -> ctfAssignmentExpressionList?
- ;
-
-ctfAssignmentExpressionList
- : (ctfAssignmentExpression TERM!)+
- ;
-
-ctfAssignmentExpression
-@after {
- if (inTypedef()) {
- typedefOff();
- }
-}
- : left=unaryExpression
- ( assignment=ASSIGNMENT right1=unaryExpression
- -> ^(CTF_EXPRESSION_VAL
- ^(CTF_LEFT $left)
- ^(CTF_RIGHT $right1))
- | type_assignment=TYPE_ASSIGNMENT right2=typeSpecifier
- -> ^(CTF_EXPRESSION_TYPE
- ^(CTF_LEFT $left)
- ^(CTF_RIGHT ^(TYPE_SPECIFIER_LIST $right2)))
- )
- | (declarationSpecifiers {inTypedef()}? declaratorList)
- -> ^(TYPEDEF declaratorList declarationSpecifiers)
- | typealiasDecl
- ;
+++ /dev/null
-// $ANTLR 3.5.2 org/eclipse/tracecompass/ctf/parser/CTFLexer.g 2014-10-20 18:17:49
-
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Etienne Bergeron - Update to Antlr 3.5 syntax
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser;
-
-
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-
-@SuppressWarnings("all")
-public class CTFLexer extends Lexer {
- public static final int EOF=-1;
- public static final int ALIGNTOK=4;
- public static final int ARROW=5;
- public static final int ASSIGNMENT=6;
- public static final int BACKSLASH=7;
- public static final int BOOLTOK=8;
- public static final int CALLSITETOK=9;
- public static final int CHARACTER_LITERAL=10;
- public static final int CHARTOK=11;
- public static final int CHAR_CONTENT=12;
- public static final int CLOCKTOK=13;
- public static final int CLOSEBRAC=14;
- public static final int COLON=15;
- public static final int COMMENT=16;
- public static final int COMMENT_CLOSE=17;
- public static final int COMMENT_OPEN=18;
- public static final int COMPLEXTOK=19;
- public static final int CONSTTOK=20;
- public static final int DECIMAL_LITERAL=21;
- public static final int DIGIT=22;
- public static final int DOT=23;
- public static final int DOUBLEQUOTE=24;
- public static final int DOUBLETOK=25;
- public static final int ELIPSES=26;
- public static final int ENUMTOK=27;
- public static final int ENVTOK=28;
- public static final int ESCAPE_SEQUENCE=29;
- public static final int EVENTTOK=30;
- public static final int FLOATINGPOINTTOK=31;
- public static final int FLOATTOK=32;
- public static final int GT=33;
- public static final int HEXADECIMAL_ESCAPE=34;
- public static final int HEX_DIGIT=35;
- public static final int HEX_LITERAL=36;
- public static final int HEX_PREFIX=37;
- public static final int IDENTIFIER=38;
- public static final int IMAGINARYTOK=39;
- public static final int INFINITYTOK=40;
- public static final int INTEGERTOK=41;
- public static final int INTEGER_TYPES_SUFFIX=42;
- public static final int INTTOK=43;
- public static final int LCURL=44;
- public static final int LINE_COMMENT=45;
- public static final int LONGTOK=46;
- public static final int LPAREN=47;
- public static final int LT=48;
- public static final int NANNUMBERTOK=49;
- public static final int NINFINITYTOK=50;
- public static final int NONDIGIT=51;
- public static final int NONZERO_DIGIT=52;
- public static final int OCTAL_ESCAPE=53;
- public static final int OCTAL_LITERAL=54;
- public static final int OCT_DIGIT=55;
- public static final int OCT_PREFIX=56;
- public static final int OPENBRAC=57;
- public static final int POINTER=58;
- public static final int RCURL=59;
- public static final int RPAREN=60;
- public static final int SEPARATOR=61;
- public static final int SHORTTOK=62;
- public static final int SIGN=63;
- public static final int SIGNEDTOK=64;
- public static final int SINGLEQUOTE=65;
- public static final int STREAMTOK=66;
- public static final int STRINGPREFIX=67;
- public static final int STRINGTOK=68;
- public static final int STRING_CONTENT=69;
- public static final int STRING_LITERAL=70;
- public static final int STRUCTTOK=71;
- public static final int TERM=72;
- public static final int TRACETOK=73;
- public static final int TYPEALIASTOK=74;
- public static final int TYPEDEFTOK=75;
- public static final int TYPE_ASSIGNMENT=76;
- public static final int UNICODE_ESCAPE=77;
- public static final int UNSIGNEDTOK=78;
- public static final int VARIANTTOK=79;
- public static final int VOIDTOK=80;
- public static final int WS=81;
-
- // delegates
- // delegators
- public Lexer[] getDelegates() {
- return new Lexer[] {};
- }
-
- public CTFLexer() {}
- public CTFLexer(CharStream input) {
- this(input, new RecognizerSharedState());
- }
- public CTFLexer(CharStream input, RecognizerSharedState state) {
- super(input,state);
- }
- @Override public String getGrammarFileName() { return "org/eclipse/tracecompass/ctf/parser/CTFLexer.g"; }
-
- // $ANTLR start "ALIGNTOK"
- public final void mALIGNTOK() throws RecognitionException {
- try {
- int _type = ALIGNTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:32:18: ( 'align' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:32:20: 'align'
- {
- match("align");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ALIGNTOK"
-
- // $ANTLR start "CONSTTOK"
- public final void mCONSTTOK() throws RecognitionException {
- try {
- int _type = CONSTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:33:18: ( 'const' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:33:20: 'const'
- {
- match("const");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CONSTTOK"
-
- // $ANTLR start "CHARTOK"
- public final void mCHARTOK() throws RecognitionException {
- try {
- int _type = CHARTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:34:18: ( 'char' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:34:20: 'char'
- {
- match("char");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CHARTOK"
-
- // $ANTLR start "DOUBLETOK"
- public final void mDOUBLETOK() throws RecognitionException {
- try {
- int _type = DOUBLETOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:35:18: ( 'double' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:35:20: 'double'
- {
- match("double");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "DOUBLETOK"
-
- // $ANTLR start "ENUMTOK"
- public final void mENUMTOK() throws RecognitionException {
- try {
- int _type = ENUMTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:36:18: ( 'enum' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:36:20: 'enum'
- {
- match("enum");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ENUMTOK"
-
- // $ANTLR start "EVENTTOK"
- public final void mEVENTTOK() throws RecognitionException {
- try {
- int _type = EVENTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:37:18: ( 'event' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:37:20: 'event'
- {
- match("event");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "EVENTTOK"
-
- // $ANTLR start "FLOATINGPOINTTOK"
- public final void mFLOATINGPOINTTOK() throws RecognitionException {
- try {
- int _type = FLOATINGPOINTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:38:18: ( 'floating_point' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:38:20: 'floating_point'
- {
- match("floating_point");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "FLOATINGPOINTTOK"
-
- // $ANTLR start "FLOATTOK"
- public final void mFLOATTOK() throws RecognitionException {
- try {
- int _type = FLOATTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:39:18: ( 'float' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:39:20: 'float'
- {
- match("float");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "FLOATTOK"
-
- // $ANTLR start "INTEGERTOK"
- public final void mINTEGERTOK() throws RecognitionException {
- try {
- int _type = INTEGERTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:40:18: ( 'integer' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:40:20: 'integer'
- {
- match("integer");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "INTEGERTOK"
-
- // $ANTLR start "INTTOK"
- public final void mINTTOK() throws RecognitionException {
- try {
- int _type = INTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:41:18: ( 'int' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:41:20: 'int'
- {
- match("int");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "INTTOK"
-
- // $ANTLR start "LONGTOK"
- public final void mLONGTOK() throws RecognitionException {
- try {
- int _type = LONGTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:42:18: ( 'long' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:42:20: 'long'
- {
- match("long");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "LONGTOK"
-
- // $ANTLR start "SHORTTOK"
- public final void mSHORTTOK() throws RecognitionException {
- try {
- int _type = SHORTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:43:18: ( 'short' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:43:20: 'short'
- {
- match("short");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "SHORTTOK"
-
- // $ANTLR start "SIGNEDTOK"
- public final void mSIGNEDTOK() throws RecognitionException {
- try {
- int _type = SIGNEDTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:44:18: ( 'signed' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:44:20: 'signed'
- {
- match("signed");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "SIGNEDTOK"
-
- // $ANTLR start "STREAMTOK"
- public final void mSTREAMTOK() throws RecognitionException {
- try {
- int _type = STREAMTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:45:18: ( 'stream' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:45:20: 'stream'
- {
- match("stream");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STREAMTOK"
-
- // $ANTLR start "STRINGTOK"
- public final void mSTRINGTOK() throws RecognitionException {
- try {
- int _type = STRINGTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:46:18: ( 'string' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:46:20: 'string'
- {
- match("string");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STRINGTOK"
-
- // $ANTLR start "STRUCTTOK"
- public final void mSTRUCTTOK() throws RecognitionException {
- try {
- int _type = STRUCTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:47:18: ( 'struct' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:47:20: 'struct'
- {
- match("struct");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STRUCTTOK"
-
- // $ANTLR start "TRACETOK"
- public final void mTRACETOK() throws RecognitionException {
- try {
- int _type = TRACETOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:48:18: ( 'trace' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:48:20: 'trace'
- {
- match("trace");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "TRACETOK"
-
- // $ANTLR start "TYPEALIASTOK"
- public final void mTYPEALIASTOK() throws RecognitionException {
- try {
- int _type = TYPEALIASTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:49:18: ( 'typealias' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:49:20: 'typealias'
- {
- match("typealias");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "TYPEALIASTOK"
-
- // $ANTLR start "TYPEDEFTOK"
- public final void mTYPEDEFTOK() throws RecognitionException {
- try {
- int _type = TYPEDEFTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:50:18: ( 'typedef' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:50:20: 'typedef'
- {
- match("typedef");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "TYPEDEFTOK"
-
- // $ANTLR start "UNSIGNEDTOK"
- public final void mUNSIGNEDTOK() throws RecognitionException {
- try {
- int _type = UNSIGNEDTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:51:18: ( 'unsigned' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:51:20: 'unsigned'
- {
- match("unsigned");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "UNSIGNEDTOK"
-
- // $ANTLR start "VARIANTTOK"
- public final void mVARIANTTOK() throws RecognitionException {
- try {
- int _type = VARIANTTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:52:18: ( 'variant' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:52:20: 'variant'
- {
- match("variant");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "VARIANTTOK"
-
- // $ANTLR start "VOIDTOK"
- public final void mVOIDTOK() throws RecognitionException {
- try {
- int _type = VOIDTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:53:18: ( 'void' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:53:20: 'void'
- {
- match("void");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "VOIDTOK"
-
- // $ANTLR start "BOOLTOK"
- public final void mBOOLTOK() throws RecognitionException {
- try {
- int _type = BOOLTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:18: ( '_Bool' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:54:20: '_Bool'
- {
- match("_Bool");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "BOOLTOK"
-
- // $ANTLR start "COMPLEXTOK"
- public final void mCOMPLEXTOK() throws RecognitionException {
- try {
- int _type = COMPLEXTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:55:18: ( '_Complex' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:55:20: '_Complex'
- {
- match("_Complex");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "COMPLEXTOK"
-
- // $ANTLR start "IMAGINARYTOK"
- public final void mIMAGINARYTOK() throws RecognitionException {
- try {
- int _type = IMAGINARYTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:56:18: ( '_Imaginary' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:56:20: '_Imaginary'
- {
- match("_Imaginary");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "IMAGINARYTOK"
-
- // $ANTLR start "ENVTOK"
- public final void mENVTOK() throws RecognitionException {
- try {
- int _type = ENVTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:57:18: ( 'env' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:57:20: 'env'
- {
- match("env");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ENVTOK"
-
- // $ANTLR start "CLOCKTOK"
- public final void mCLOCKTOK() throws RecognitionException {
- try {
- int _type = CLOCKTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:58:18: ( 'clock' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:58:20: 'clock'
- {
- match("clock");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CLOCKTOK"
-
- // $ANTLR start "CALLSITETOK"
- public final void mCALLSITETOK() throws RecognitionException {
- try {
- int _type = CALLSITETOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:62:18: ( 'callsite' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:62:20: 'callsite'
- {
- match("callsite");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CALLSITETOK"
-
- // $ANTLR start "NANNUMBERTOK"
- public final void mNANNUMBERTOK() throws RecognitionException {
- try {
- int _type = NANNUMBERTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:69:15: ( 'NaN' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:69:17: 'NaN'
- {
- match("NaN");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "NANNUMBERTOK"
-
- // $ANTLR start "INFINITYTOK"
- public final void mINFINITYTOK() throws RecognitionException {
- try {
- int _type = INFINITYTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:70:15: ( '+inf' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:70:17: '+inf'
- {
- match("+inf");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "INFINITYTOK"
-
- // $ANTLR start "NINFINITYTOK"
- public final void mNINFINITYTOK() throws RecognitionException {
- try {
- int _type = NINFINITYTOK;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:71:15: ( '-inf' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:71:17: '-inf'
- {
- match("-inf");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "NINFINITYTOK"
-
- // $ANTLR start "SEPARATOR"
- public final void mSEPARATOR() throws RecognitionException {
- try {
- int _type = SEPARATOR;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:76:20: ( ',' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:76:22: ','
- {
- match(',');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "SEPARATOR"
-
- // $ANTLR start "COLON"
- public final void mCOLON() throws RecognitionException {
- try {
- int _type = COLON;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:77:20: ( ':' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:77:22: ':'
- {
- match(':');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "COLON"
-
- // $ANTLR start "ELIPSES"
- public final void mELIPSES() throws RecognitionException {
- try {
- int _type = ELIPSES;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:78:20: ( '...' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:78:22: '...'
- {
- match("...");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ELIPSES"
-
- // $ANTLR start "ASSIGNMENT"
- public final void mASSIGNMENT() throws RecognitionException {
- try {
- int _type = ASSIGNMENT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:79:20: ( '=' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:79:22: '='
- {
- match('=');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ASSIGNMENT"
-
- // $ANTLR start "TYPE_ASSIGNMENT"
- public final void mTYPE_ASSIGNMENT() throws RecognitionException {
- try {
- int _type = TYPE_ASSIGNMENT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:80:20: ( ':=' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:80:22: ':='
- {
- match(":=");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "TYPE_ASSIGNMENT"
-
- // $ANTLR start "LT"
- public final void mLT() throws RecognitionException {
- try {
- int _type = LT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:81:20: ( '<' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:81:22: '<'
- {
- match('<');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "LT"
-
- // $ANTLR start "GT"
- public final void mGT() throws RecognitionException {
- try {
- int _type = GT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:82:20: ( '>' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:82:22: '>'
- {
- match('>');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "GT"
-
- // $ANTLR start "OPENBRAC"
- public final void mOPENBRAC() throws RecognitionException {
- try {
- int _type = OPENBRAC;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:83:20: ( '[' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:83:22: '['
- {
- match('[');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "OPENBRAC"
-
- // $ANTLR start "CLOSEBRAC"
- public final void mCLOSEBRAC() throws RecognitionException {
- try {
- int _type = CLOSEBRAC;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:84:20: ( ']' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:84:22: ']'
- {
- match(']');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CLOSEBRAC"
-
- // $ANTLR start "LPAREN"
- public final void mLPAREN() throws RecognitionException {
- try {
- int _type = LPAREN;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:85:20: ( '(' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:85:22: '('
- {
- match('(');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "LPAREN"
-
- // $ANTLR start "RPAREN"
- public final void mRPAREN() throws RecognitionException {
- try {
- int _type = RPAREN;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:86:20: ( ')' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:86:22: ')'
- {
- match(')');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "RPAREN"
-
- // $ANTLR start "LCURL"
- public final void mLCURL() throws RecognitionException {
- try {
- int _type = LCURL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:87:20: ( '{' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:87:22: '{'
- {
- match('{');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "LCURL"
-
- // $ANTLR start "RCURL"
- public final void mRCURL() throws RecognitionException {
- try {
- int _type = RCURL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:88:20: ( '}' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:88:22: '}'
- {
- match('}');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "RCURL"
-
- // $ANTLR start "TERM"
- public final void mTERM() throws RecognitionException {
- try {
- int _type = TERM;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:89:20: ( ';' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:89:22: ';'
- {
- match(';');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "TERM"
-
- // $ANTLR start "POINTER"
- public final void mPOINTER() throws RecognitionException {
- try {
- int _type = POINTER;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:90:20: ( '*' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:90:22: '*'
- {
- match('*');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "POINTER"
-
- // $ANTLR start "SIGN"
- public final void mSIGN() throws RecognitionException {
- try {
- int _type = SIGN;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:91:20: ( '+' | '-' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "SIGN"
-
- // $ANTLR start "ARROW"
- public final void mARROW() throws RecognitionException {
- try {
- int _type = ARROW;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:92:20: ( '->' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:92:22: '->'
- {
- match("->");
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ARROW"
-
- // $ANTLR start "DOT"
- public final void mDOT() throws RecognitionException {
- try {
- int _type = DOT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:93:20: ( '.' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:93:22: '.'
- {
- match('.');
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "DOT"
-
- // $ANTLR start "BACKSLASH"
- public final void mBACKSLASH() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:94:20: ( '\\\\' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:94:22: '\\\\'
- {
- match('\\');
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "BACKSLASH"
-
- // $ANTLR start "DIGIT"
- public final void mDIGIT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:97:16: ( '0' .. '9' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "DIGIT"
-
- // $ANTLR start "OCT_DIGIT"
- public final void mOCT_DIGIT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:98:20: ( '0' .. '7' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "OCT_DIGIT"
-
- // $ANTLR start "OCT_PREFIX"
- public final void mOCT_PREFIX() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:99:21: ( '0' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:99:23: '0'
- {
- match('0');
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "OCT_PREFIX"
-
- // $ANTLR start "NONZERO_DIGIT"
- public final void mNONZERO_DIGIT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:100:24: ( '1' .. '9' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '1' && input.LA(1) <= '9') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "NONZERO_DIGIT"
-
- // $ANTLR start "HEX_DIGIT"
- public final void mHEX_DIGIT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:101:20: ( DIGIT | ( 'a' .. 'f' ) | ( 'A' .. 'F' ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "HEX_DIGIT"
-
- // $ANTLR start "HEX_PREFIX"
- public final void mHEX_PREFIX() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:102:21: ( '0' ( 'x' | 'X' ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:102:23: '0' ( 'x' | 'X' )
- {
- match('0');
- if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "HEX_PREFIX"
-
- // $ANTLR start "OCTAL_LITERAL"
- public final void mOCTAL_LITERAL() throws RecognitionException {
- try {
- int _type = OCTAL_LITERAL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:15: ( OCT_PREFIX ( OCT_DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:17: OCT_PREFIX ( OCT_DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
- {
- mOCT_PREFIX();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:28: ( OCT_DIGIT )+
- int cnt1=0;
- loop1:
- while (true) {
- int alt1=2;
- int LA1_0 = input.LA(1);
- if ( ((LA1_0 >= '0' && LA1_0 <= '7')) ) {
- alt1=1;
- }
-
- switch (alt1) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- if ( cnt1 >= 1 ) break loop1;
- EarlyExitException eee = new EarlyExitException(1, input);
- throw eee;
- }
- cnt1++;
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:41: ( INTEGER_TYPES_SUFFIX )?
- int alt2=2;
- int LA2_0 = input.LA(1);
- if ( (LA2_0=='L'||LA2_0=='U'||LA2_0=='l'||LA2_0=='u') ) {
- alt2=1;
- }
- switch (alt2) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:107:41: INTEGER_TYPES_SUFFIX
- {
- mINTEGER_TYPES_SUFFIX();
-
- }
- break;
-
- }
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "OCTAL_LITERAL"
-
- // $ANTLR start "DECIMAL_LITERAL"
- public final void mDECIMAL_LITERAL() throws RecognitionException {
- try {
- int _type = DECIMAL_LITERAL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:17: ( ( DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:19: ( DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:19: ( DIGIT )+
- int cnt3=0;
- loop3:
- while (true) {
- int alt3=2;
- int LA3_0 = input.LA(1);
- if ( ((LA3_0 >= '0' && LA3_0 <= '9')) ) {
- alt3=1;
- }
-
- switch (alt3) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- if ( cnt3 >= 1 ) break loop3;
- EarlyExitException eee = new EarlyExitException(3, input);
- throw eee;
- }
- cnt3++;
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:26: ( INTEGER_TYPES_SUFFIX )?
- int alt4=2;
- int LA4_0 = input.LA(1);
- if ( (LA4_0=='L'||LA4_0=='U'||LA4_0=='l'||LA4_0=='u') ) {
- alt4=1;
- }
- switch (alt4) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:108:26: INTEGER_TYPES_SUFFIX
- {
- mINTEGER_TYPES_SUFFIX();
-
- }
- break;
-
- }
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "DECIMAL_LITERAL"
-
- // $ANTLR start "HEX_LITERAL"
- public final void mHEX_LITERAL() throws RecognitionException {
- try {
- int _type = HEX_LITERAL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:13: ( HEX_PREFIX ( HEX_DIGIT )+ ( INTEGER_TYPES_SUFFIX )? )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:15: HEX_PREFIX ( HEX_DIGIT )+ ( INTEGER_TYPES_SUFFIX )?
- {
- mHEX_PREFIX();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:26: ( HEX_DIGIT )+
- int cnt5=0;
- loop5:
- while (true) {
- int alt5=2;
- int LA5_0 = input.LA(1);
- if ( ((LA5_0 >= '0' && LA5_0 <= '9')||(LA5_0 >= 'A' && LA5_0 <= 'F')||(LA5_0 >= 'a' && LA5_0 <= 'f')) ) {
- alt5=1;
- }
-
- switch (alt5) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- if ( cnt5 >= 1 ) break loop5;
- EarlyExitException eee = new EarlyExitException(5, input);
- throw eee;
- }
- cnt5++;
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:37: ( INTEGER_TYPES_SUFFIX )?
- int alt6=2;
- int LA6_0 = input.LA(1);
- if ( (LA6_0=='L'||LA6_0=='U'||LA6_0=='l'||LA6_0=='u') ) {
- alt6=1;
- }
- switch (alt6) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:109:37: INTEGER_TYPES_SUFFIX
- {
- mINTEGER_TYPES_SUFFIX();
-
- }
- break;
-
- }
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "HEX_LITERAL"
-
- // $ANTLR start "INTEGER_TYPES_SUFFIX"
- public final void mINTEGER_TYPES_SUFFIX() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:3: ( ( 'l' ( 'l' )? | 'L' ( 'L' )? ) | ( 'u' | 'U' ) | ( 'u' | 'U' ) ( 'l' ( 'l' )? | 'L' ( 'L' )? ) | ( 'l' ( 'l' )? | 'L' ( 'L' )? ) ( 'u' | 'U' ) )
- int alt16=4;
- switch ( input.LA(1) ) {
- case 'l':
- {
- switch ( input.LA(2) ) {
- case 'l':
- {
- int LA16_4 = input.LA(3);
- if ( (LA16_4=='U'||LA16_4=='u') ) {
- alt16=4;
- }
-
- else {
- alt16=1;
- }
-
- }
- break;
- case 'U':
- case 'u':
- {
- alt16=4;
- }
- break;
- default:
- alt16=1;
- }
- }
- break;
- case 'L':
- {
- switch ( input.LA(2) ) {
- case 'L':
- {
- int LA16_7 = input.LA(3);
- if ( (LA16_7=='U'||LA16_7=='u') ) {
- alt16=4;
- }
-
- else {
- alt16=1;
- }
-
- }
- break;
- case 'U':
- case 'u':
- {
- alt16=4;
- }
- break;
- default:
- alt16=1;
- }
- }
- break;
- case 'U':
- case 'u':
- {
- int LA16_3 = input.LA(2);
- if ( (LA16_3=='L'||LA16_3=='l') ) {
- alt16=3;
- }
-
- else {
- alt16=2;
- }
-
- }
- break;
- default:
- NoViableAltException nvae =
- new NoViableAltException("", 16, 0, input);
- throw nvae;
- }
- switch (alt16) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
- int alt9=2;
- int LA9_0 = input.LA(1);
- if ( (LA9_0=='l') ) {
- alt9=1;
- }
- else if ( (LA9_0=='L') ) {
- alt9=2;
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 9, 0, input);
- throw nvae;
- }
-
- switch (alt9) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:6: 'l' ( 'l' )?
- {
- match('l');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:10: ( 'l' )?
- int alt7=2;
- int LA7_0 = input.LA(1);
- if ( (LA7_0=='l') ) {
- alt7=1;
- }
- switch (alt7) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:11: 'l'
- {
- match('l');
- }
- break;
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:19: 'L' ( 'L' )?
- {
- match('L');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:23: ( 'L' )?
- int alt8=2;
- int LA8_0 = input.LA(1);
- if ( (LA8_0=='L') ) {
- alt8=1;
- }
- switch (alt8) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:117:24: 'L'
- {
- match('L');
- }
- break;
-
- }
-
- }
- break;
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:118:5: ( 'u' | 'U' )
- {
- if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:5: ( 'u' | 'U' ) ( 'l' ( 'l' )? | 'L' ( 'L' )? )
- {
- if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:17: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
- int alt12=2;
- int LA12_0 = input.LA(1);
- if ( (LA12_0=='l') ) {
- alt12=1;
- }
- else if ( (LA12_0=='L') ) {
- alt12=2;
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 12, 0, input);
- throw nvae;
- }
-
- switch (alt12) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:18: 'l' ( 'l' )?
- {
- match('l');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:22: ( 'l' )?
- int alt10=2;
- int LA10_0 = input.LA(1);
- if ( (LA10_0=='l') ) {
- alt10=1;
- }
- switch (alt10) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:23: 'l'
- {
- match('l');
- }
- break;
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:31: 'L' ( 'L' )?
- {
- match('L');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:35: ( 'L' )?
- int alt11=2;
- int LA11_0 = input.LA(1);
- if ( (LA11_0=='L') ) {
- alt11=1;
- }
- switch (alt11) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:119:36: 'L'
- {
- match('L');
- }
- break;
-
- }
-
- }
- break;
-
- }
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? ) ( 'u' | 'U' )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:5: ( 'l' ( 'l' )? | 'L' ( 'L' )? )
- int alt15=2;
- int LA15_0 = input.LA(1);
- if ( (LA15_0=='l') ) {
- alt15=1;
- }
- else if ( (LA15_0=='L') ) {
- alt15=2;
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 15, 0, input);
- throw nvae;
- }
-
- switch (alt15) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:6: 'l' ( 'l' )?
- {
- match('l');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:10: ( 'l' )?
- int alt13=2;
- int LA13_0 = input.LA(1);
- if ( (LA13_0=='l') ) {
- alt13=1;
- }
- switch (alt13) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:11: 'l'
- {
- match('l');
- }
- break;
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:19: 'L' ( 'L' )?
- {
- match('L');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:23: ( 'L' )?
- int alt14=2;
- int LA14_0 = input.LA(1);
- if ( (LA14_0=='L') ) {
- alt14=1;
- }
- switch (alt14) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:120:24: 'L'
- {
- match('L');
- }
- break;
-
- }
-
- }
- break;
-
- }
-
- if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "INTEGER_TYPES_SUFFIX"
-
- // $ANTLR start "ESCAPE_SEQUENCE"
- public final void mESCAPE_SEQUENCE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:127:3: ( BACKSLASH ( '\\'' | '\"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' ) | OCTAL_ESCAPE | UNICODE_ESCAPE | HEXADECIMAL_ESCAPE )
- int alt17=4;
- int LA17_0 = input.LA(1);
- if ( (LA17_0=='\\') ) {
- switch ( input.LA(2) ) {
- case '\"':
- case '\'':
- case '?':
- case '\\':
- case 'a':
- case 'b':
- case 'f':
- case 'n':
- case 'r':
- case 't':
- case 'v':
- {
- alt17=1;
- }
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- alt17=2;
- }
- break;
- case 'U':
- case 'u':
- {
- alt17=3;
- }
- break;
- case 'x':
- {
- alt17=4;
- }
- break;
- default:
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 17, 1, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 17, 0, input);
- throw nvae;
- }
-
- switch (alt17) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:127:5: BACKSLASH ( '\\'' | '\"' | '?' | BACKSLASH | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v' )
- {
- mBACKSLASH();
-
- if ( input.LA(1)=='\"'||input.LA(1)=='\''||input.LA(1)=='?'||input.LA(1)=='\\'||(input.LA(1) >= 'a' && input.LA(1) <= 'b')||input.LA(1)=='f'||input.LA(1)=='n'||input.LA(1)=='r'||input.LA(1)=='t'||input.LA(1)=='v' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:128:5: OCTAL_ESCAPE
- {
- mOCTAL_ESCAPE();
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:129:5: UNICODE_ESCAPE
- {
- mUNICODE_ESCAPE();
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:130:5: HEXADECIMAL_ESCAPE
- {
- mHEXADECIMAL_ESCAPE();
-
- }
- break;
-
- }
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "ESCAPE_SEQUENCE"
-
- // $ANTLR start "OCTAL_ESCAPE"
- public final void mOCTAL_ESCAPE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:137:3: ( BACKSLASH ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' ) | BACKSLASH ( '0' .. '7' ) ( '0' .. '7' ) | BACKSLASH ( '0' .. '7' ) )
- int alt18=3;
- int LA18_0 = input.LA(1);
- if ( (LA18_0=='\\') ) {
- int LA18_1 = input.LA(2);
- if ( ((LA18_1 >= '0' && LA18_1 <= '3')) ) {
- int LA18_2 = input.LA(3);
- if ( ((LA18_2 >= '0' && LA18_2 <= '7')) ) {
- int LA18_4 = input.LA(4);
- if ( ((LA18_4 >= '0' && LA18_4 <= '7')) ) {
- alt18=1;
- }
-
- else {
- alt18=2;
- }
-
- }
-
- else {
- alt18=3;
- }
-
- }
- else if ( ((LA18_1 >= '4' && LA18_1 <= '7')) ) {
- int LA18_3 = input.LA(3);
- if ( ((LA18_3 >= '0' && LA18_3 <= '7')) ) {
- alt18=2;
- }
-
- else {
- alt18=3;
- }
-
- }
-
- else {
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 18, 1, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 18, 0, input);
- throw nvae;
- }
-
- switch (alt18) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:137:5: BACKSLASH ( '0' .. '3' ) ( '0' .. '7' ) ( '0' .. '7' )
- {
- mBACKSLASH();
-
- if ( (input.LA(1) >= '0' && input.LA(1) <= '3') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:138:5: BACKSLASH ( '0' .. '7' ) ( '0' .. '7' )
- {
- mBACKSLASH();
-
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:139:5: BACKSLASH ( '0' .. '7' )
- {
- mBACKSLASH();
-
- if ( (input.LA(1) >= '0' && input.LA(1) <= '7') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "OCTAL_ESCAPE"
-
- // $ANTLR start "HEXADECIMAL_ESCAPE"
- public final void mHEXADECIMAL_ESCAPE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:29: ( BACKSLASH 'x' ( HEX_DIGIT )+ )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:31: BACKSLASH 'x' ( HEX_DIGIT )+
- {
- mBACKSLASH();
-
- match('x');
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:145:45: ( HEX_DIGIT )+
- int cnt19=0;
- loop19:
- while (true) {
- int alt19=2;
- int LA19_0 = input.LA(1);
- if ( ((LA19_0 >= '0' && LA19_0 <= '9')||(LA19_0 >= 'A' && LA19_0 <= 'F')||(LA19_0 >= 'a' && LA19_0 <= 'f')) ) {
- alt19=1;
- }
-
- switch (alt19) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- if ( cnt19 >= 1 ) break loop19;
- EarlyExitException eee = new EarlyExitException(19, input);
- throw eee;
- }
- cnt19++;
- }
-
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "HEXADECIMAL_ESCAPE"
-
- // $ANTLR start "UNICODE_ESCAPE"
- public final void mUNICODE_ESCAPE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:151:3: ( BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT | BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT )
- int alt20=2;
- int LA20_0 = input.LA(1);
- if ( (LA20_0=='\\') ) {
- int LA20_1 = input.LA(2);
- if ( (LA20_1=='u') ) {
- alt20=1;
- }
- else if ( (LA20_1=='U') ) {
- alt20=2;
- }
-
- else {
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 20, 1, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 20, 0, input);
- throw nvae;
- }
-
- switch (alt20) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:151:5: BACKSLASH 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
- {
- mBACKSLASH();
-
- match('u');
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:152:5: BACKSLASH 'U' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
- {
- mBACKSLASH();
-
- match('U');
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- mHEX_DIGIT();
-
- }
- break;
-
- }
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "UNICODE_ESCAPE"
-
- // $ANTLR start "STRINGPREFIX"
- public final void mSTRINGPREFIX() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:157:23: ( 'L' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:157:25: 'L'
- {
- match('L');
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STRINGPREFIX"
-
- // $ANTLR start "CHARACTER_LITERAL"
- public final void mCHARACTER_LITERAL() throws RecognitionException {
- try {
- int _type = CHARACTER_LITERAL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:19: ( ( STRINGPREFIX )? SINGLEQUOTE ( CHAR_CONTENT )+ SINGLEQUOTE )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:21: ( STRINGPREFIX )? SINGLEQUOTE ( CHAR_CONTENT )+ SINGLEQUOTE
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:21: ( STRINGPREFIX )?
- int alt21=2;
- int LA21_0 = input.LA(1);
- if ( (LA21_0=='L') ) {
- alt21=1;
- }
- switch (alt21) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( input.LA(1)=='L' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
-
- mSINGLEQUOTE();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:47: ( CHAR_CONTENT )+
- int cnt22=0;
- loop22:
- while (true) {
- int alt22=2;
- int LA22_0 = input.LA(1);
- if ( ((LA22_0 >= '\u0000' && LA22_0 <= '&')||(LA22_0 >= '(' && LA22_0 <= '\uFFFF')) ) {
- alt22=1;
- }
-
- switch (alt22) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:162:47: CHAR_CONTENT
- {
- mCHAR_CONTENT();
-
- }
- break;
-
- default :
- if ( cnt22 >= 1 ) break loop22;
- EarlyExitException eee = new EarlyExitException(22, input);
- throw eee;
- }
- cnt22++;
- }
-
- mSINGLEQUOTE();
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CHARACTER_LITERAL"
-
- // $ANTLR start "CHAR_CONTENT"
- public final void mCHAR_CONTENT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:23: ( ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:25: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:25: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | SINGLEQUOTE ) )
- int alt23=2;
- int LA23_0 = input.LA(1);
- if ( (LA23_0=='\\') ) {
- alt23=1;
- }
- else if ( ((LA23_0 >= '\u0000' && LA23_0 <= '&')||(LA23_0 >= '(' && LA23_0 <= '[')||(LA23_0 >= ']' && LA23_0 <= '\uFFFF')) ) {
- alt23=2;
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 23, 0, input);
- throw nvae;
- }
-
- switch (alt23) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:26: ESCAPE_SEQUENCE
- {
- mESCAPE_SEQUENCE();
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:163:44: ~ ( BACKSLASH | SINGLEQUOTE )
- {
- if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '&')||(input.LA(1) >= '(' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
-
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "CHAR_CONTENT"
-
- // $ANTLR start "SINGLEQUOTE"
- public final void mSINGLEQUOTE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:164:22: ( '\\'' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:164:24: '\\''
- {
- match('\'');
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "SINGLEQUOTE"
-
- // $ANTLR start "STRING_LITERAL"
- public final void mSTRING_LITERAL() throws RecognitionException {
- try {
- int _type = STRING_LITERAL;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:16: ( ( STRINGPREFIX )? DOUBLEQUOTE ( STRING_CONTENT )* DOUBLEQUOTE )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:18: ( STRINGPREFIX )? DOUBLEQUOTE ( STRING_CONTENT )* DOUBLEQUOTE
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:18: ( STRINGPREFIX )?
- int alt24=2;
- int LA24_0 = input.LA(1);
- if ( (LA24_0=='L') ) {
- alt24=1;
- }
- switch (alt24) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( input.LA(1)=='L' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
-
- mDOUBLEQUOTE();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:44: ( STRING_CONTENT )*
- loop25:
- while (true) {
- int alt25=2;
- int LA25_0 = input.LA(1);
- if ( ((LA25_0 >= '\u0000' && LA25_0 <= '!')||(LA25_0 >= '#' && LA25_0 <= '\uFFFF')) ) {
- alt25=1;
- }
-
- switch (alt25) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:169:44: STRING_CONTENT
- {
- mSTRING_CONTENT();
-
- }
- break;
-
- default :
- break loop25;
- }
- }
-
- mDOUBLEQUOTE();
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STRING_LITERAL"
-
- // $ANTLR start "STRING_CONTENT"
- public final void mSTRING_CONTENT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:25: ( ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:27: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:27: ( ESCAPE_SEQUENCE |~ ( BACKSLASH | DOUBLEQUOTE ) )
- int alt26=2;
- int LA26_0 = input.LA(1);
- if ( (LA26_0=='\\') ) {
- alt26=1;
- }
- else if ( ((LA26_0 >= '\u0000' && LA26_0 <= '!')||(LA26_0 >= '#' && LA26_0 <= '[')||(LA26_0 >= ']' && LA26_0 <= '\uFFFF')) ) {
- alt26=2;
- }
-
- else {
- NoViableAltException nvae =
- new NoViableAltException("", 26, 0, input);
- throw nvae;
- }
-
- switch (alt26) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:28: ESCAPE_SEQUENCE
- {
- mESCAPE_SEQUENCE();
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:170:46: ~ ( BACKSLASH | DOUBLEQUOTE )
- {
- if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '!')||(input.LA(1) >= '#' && input.LA(1) <= '[')||(input.LA(1) >= ']' && input.LA(1) <= '\uFFFF') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- }
-
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "STRING_CONTENT"
-
- // $ANTLR start "DOUBLEQUOTE"
- public final void mDOUBLEQUOTE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:171:22: ( '\"' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:171:24: '\"'
- {
- match('\"');
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "DOUBLEQUOTE"
-
- // $ANTLR start "WS"
- public final void mWS() throws RecognitionException {
- try {
- int _type = WS;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:176:4: ( ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:176:6: ( ' ' | '\\r' | '\\t' | '\\u000C' | '\\n' )
- {
- if ( (input.LA(1) >= '\t' && input.LA(1) <= '\n')||(input.LA(1) >= '\f' && input.LA(1) <= '\r')||input.LA(1)==' ' ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- _channel = HIDDEN;
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "WS"
-
- // $ANTLR start "COMMENT"
- public final void mCOMMENT() throws RecognitionException {
- try {
- int _type = COMMENT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:9: ( COMMENT_OPEN ( . )* COMMENT_CLOSE )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:11: COMMENT_OPEN ( . )* COMMENT_CLOSE
- {
- mCOMMENT_OPEN();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:24: ( . )*
- loop27:
- while (true) {
- int alt27=2;
- int LA27_0 = input.LA(1);
- if ( (LA27_0=='*') ) {
- int LA27_1 = input.LA(2);
- if ( (LA27_1=='/') ) {
- alt27=2;
- }
- else if ( ((LA27_1 >= '\u0000' && LA27_1 <= '.')||(LA27_1 >= '0' && LA27_1 <= '\uFFFF')) ) {
- alt27=1;
- }
-
- }
- else if ( ((LA27_0 >= '\u0000' && LA27_0 <= ')')||(LA27_0 >= '+' && LA27_0 <= '\uFFFF')) ) {
- alt27=1;
- }
-
- switch (alt27) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:183:24: .
- {
- matchAny();
- }
- break;
-
- default :
- break loop27;
- }
- }
-
- mCOMMENT_CLOSE();
-
- _channel = HIDDEN;
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "COMMENT"
-
- // $ANTLR start "COMMENT_OPEN"
- public final void mCOMMENT_OPEN() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:184:23: ( '/*' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:184:25: '/*'
- {
- match("/*");
-
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "COMMENT_OPEN"
-
- // $ANTLR start "COMMENT_CLOSE"
- public final void mCOMMENT_CLOSE() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:185:24: ( '*/' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:185:26: '*/'
- {
- match("*/");
-
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "COMMENT_CLOSE"
-
- // $ANTLR start "LINE_COMMENT"
- public final void mLINE_COMMENT() throws RecognitionException {
- try {
- int _type = LINE_COMMENT;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:14: ( '//' (~ ( '\\n' ) )* '\\n' )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:16: '//' (~ ( '\\n' ) )* '\\n'
- {
- match("//");
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:190:21: (~ ( '\\n' ) )*
- loop28:
- while (true) {
- int alt28=2;
- int LA28_0 = input.LA(1);
- if ( ((LA28_0 >= '\u0000' && LA28_0 <= '\t')||(LA28_0 >= '\u000B' && LA28_0 <= '\uFFFF')) ) {
- alt28=1;
- }
-
- switch (alt28) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '\u0000' && input.LA(1) <= '\t')||(input.LA(1) >= '\u000B' && input.LA(1) <= '\uFFFF') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- break loop28;
- }
- }
-
- match('\n');
- _channel = HIDDEN;
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "LINE_COMMENT"
-
- // $ANTLR start "IDENTIFIER"
- public final void mIDENTIFIER() throws RecognitionException {
- try {
- int _type = IDENTIFIER;
- int _channel = DEFAULT_TOKEN_CHANNEL;
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:12: ( NONDIGIT ( NONDIGIT | DIGIT )* )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:14: NONDIGIT ( NONDIGIT | DIGIT )*
- {
- mNONDIGIT();
-
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:195:23: ( NONDIGIT | DIGIT )*
- loop29:
- while (true) {
- int alt29=2;
- int LA29_0 = input.LA(1);
- if ( ((LA29_0 >= '0' && LA29_0 <= '9')||(LA29_0 >= 'A' && LA29_0 <= 'Z')||LA29_0=='_'||(LA29_0 >= 'a' && LA29_0 <= 'z')) ) {
- alt29=1;
- }
-
- switch (alt29) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
- break;
-
- default :
- break loop29;
- }
- }
-
- }
-
- state.type = _type;
- state.channel = _channel;
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "IDENTIFIER"
-
- // $ANTLR start "NONDIGIT"
- public final void mNONDIGIT() throws RecognitionException {
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:196:19: ( ( '_' ) | ( 'A' .. 'Z' ) | ( 'a' .. 'z' ) )
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:
- {
- if ( (input.LA(1) >= 'A' && input.LA(1) <= 'Z')||input.LA(1)=='_'||(input.LA(1) >= 'a' && input.LA(1) <= 'z') ) {
- input.consume();
- }
- else {
- MismatchedSetException mse = new MismatchedSetException(null,input);
- recover(mse);
- throw mse;
- }
- }
-
- }
- finally {
- // do for sure before leaving
- }
- }
- // $ANTLR end "NONDIGIT"
-
- @Override
- public void mTokens() throws RecognitionException {
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:8: ( ALIGNTOK | CONSTTOK | CHARTOK | DOUBLETOK | ENUMTOK | EVENTTOK | FLOATINGPOINTTOK | FLOATTOK | INTEGERTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | STREAMTOK | STRINGTOK | STRUCTTOK | TRACETOK | TYPEALIASTOK | TYPEDEFTOK | UNSIGNEDTOK | VARIANTTOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | ENVTOK | CLOCKTOK | CALLSITETOK | NANNUMBERTOK | INFINITYTOK | NINFINITYTOK | SEPARATOR | COLON | ELIPSES | ASSIGNMENT | TYPE_ASSIGNMENT | LT | GT | OPENBRAC | CLOSEBRAC | LPAREN | RPAREN | LCURL | RCURL | TERM | POINTER | SIGN | ARROW | DOT | OCTAL_LITERAL | DECIMAL_LITERAL | HEX_LITERAL | CHARACTER_LITERAL | STRING_LITERAL | WS | COMMENT | LINE_COMMENT | IDENTIFIER )
- int alt30=58;
- alt30 = dfa30.predict(input);
- switch (alt30) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:10: ALIGNTOK
- {
- mALIGNTOK();
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:19: CONSTTOK
- {
- mCONSTTOK();
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:28: CHARTOK
- {
- mCHARTOK();
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:36: DOUBLETOK
- {
- mDOUBLETOK();
-
- }
- break;
- case 5 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:46: ENUMTOK
- {
- mENUMTOK();
-
- }
- break;
- case 6 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:54: EVENTTOK
- {
- mEVENTTOK();
-
- }
- break;
- case 7 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:63: FLOATINGPOINTTOK
- {
- mFLOATINGPOINTTOK();
-
- }
- break;
- case 8 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:80: FLOATTOK
- {
- mFLOATTOK();
-
- }
- break;
- case 9 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:89: INTEGERTOK
- {
- mINTEGERTOK();
-
- }
- break;
- case 10 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:100: INTTOK
- {
- mINTTOK();
-
- }
- break;
- case 11 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:107: LONGTOK
- {
- mLONGTOK();
-
- }
- break;
- case 12 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:115: SHORTTOK
- {
- mSHORTTOK();
-
- }
- break;
- case 13 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:124: SIGNEDTOK
- {
- mSIGNEDTOK();
-
- }
- break;
- case 14 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:134: STREAMTOK
- {
- mSTREAMTOK();
-
- }
- break;
- case 15 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:144: STRINGTOK
- {
- mSTRINGTOK();
-
- }
- break;
- case 16 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:154: STRUCTTOK
- {
- mSTRUCTTOK();
-
- }
- break;
- case 17 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:164: TRACETOK
- {
- mTRACETOK();
-
- }
- break;
- case 18 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:173: TYPEALIASTOK
- {
- mTYPEALIASTOK();
-
- }
- break;
- case 19 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:186: TYPEDEFTOK
- {
- mTYPEDEFTOK();
-
- }
- break;
- case 20 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:197: UNSIGNEDTOK
- {
- mUNSIGNEDTOK();
-
- }
- break;
- case 21 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:209: VARIANTTOK
- {
- mVARIANTTOK();
-
- }
- break;
- case 22 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:220: VOIDTOK
- {
- mVOIDTOK();
-
- }
- break;
- case 23 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:228: BOOLTOK
- {
- mBOOLTOK();
-
- }
- break;
- case 24 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:236: COMPLEXTOK
- {
- mCOMPLEXTOK();
-
- }
- break;
- case 25 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:247: IMAGINARYTOK
- {
- mIMAGINARYTOK();
-
- }
- break;
- case 26 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:260: ENVTOK
- {
- mENVTOK();
-
- }
- break;
- case 27 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:267: CLOCKTOK
- {
- mCLOCKTOK();
-
- }
- break;
- case 28 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:276: CALLSITETOK
- {
- mCALLSITETOK();
-
- }
- break;
- case 29 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:288: NANNUMBERTOK
- {
- mNANNUMBERTOK();
-
- }
- break;
- case 30 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:301: INFINITYTOK
- {
- mINFINITYTOK();
-
- }
- break;
- case 31 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:313: NINFINITYTOK
- {
- mNINFINITYTOK();
-
- }
- break;
- case 32 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:326: SEPARATOR
- {
- mSEPARATOR();
-
- }
- break;
- case 33 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:336: COLON
- {
- mCOLON();
-
- }
- break;
- case 34 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:342: ELIPSES
- {
- mELIPSES();
-
- }
- break;
- case 35 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:350: ASSIGNMENT
- {
- mASSIGNMENT();
-
- }
- break;
- case 36 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:361: TYPE_ASSIGNMENT
- {
- mTYPE_ASSIGNMENT();
-
- }
- break;
- case 37 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:377: LT
- {
- mLT();
-
- }
- break;
- case 38 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:380: GT
- {
- mGT();
-
- }
- break;
- case 39 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:383: OPENBRAC
- {
- mOPENBRAC();
-
- }
- break;
- case 40 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:392: CLOSEBRAC
- {
- mCLOSEBRAC();
-
- }
- break;
- case 41 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:402: LPAREN
- {
- mLPAREN();
-
- }
- break;
- case 42 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:409: RPAREN
- {
- mRPAREN();
-
- }
- break;
- case 43 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:416: LCURL
- {
- mLCURL();
-
- }
- break;
- case 44 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:422: RCURL
- {
- mRCURL();
-
- }
- break;
- case 45 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:428: TERM
- {
- mTERM();
-
- }
- break;
- case 46 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:433: POINTER
- {
- mPOINTER();
-
- }
- break;
- case 47 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:441: SIGN
- {
- mSIGN();
-
- }
- break;
- case 48 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:446: ARROW
- {
- mARROW();
-
- }
- break;
- case 49 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:452: DOT
- {
- mDOT();
-
- }
- break;
- case 50 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:456: OCTAL_LITERAL
- {
- mOCTAL_LITERAL();
-
- }
- break;
- case 51 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:470: DECIMAL_LITERAL
- {
- mDECIMAL_LITERAL();
-
- }
- break;
- case 52 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:486: HEX_LITERAL
- {
- mHEX_LITERAL();
-
- }
- break;
- case 53 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:498: CHARACTER_LITERAL
- {
- mCHARACTER_LITERAL();
-
- }
- break;
- case 54 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:516: STRING_LITERAL
- {
- mSTRING_LITERAL();
-
- }
- break;
- case 55 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:531: WS
- {
- mWS();
-
- }
- break;
- case 56 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:534: COMMENT
- {
- mCOMMENT();
-
- }
- break;
- case 57 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:542: LINE_COMMENT
- {
- mLINE_COMMENT();
-
- }
- break;
- case 58 :
- // org/eclipse/tracecompass/ctf/parser/CTFLexer.g:1:555: IDENTIFIER
- {
- mIDENTIFIER();
-
- }
- break;
-
- }
- }
-
-
- protected DFA30 dfa30 = new DFA30(this);
- static final String DFA30_eotS =
- "\1\uffff\15\45\2\76\1\uffff\1\102\1\104\13\uffff\1\37\1\uffff\1\45\5\uffff"+
- "\27\45\11\uffff\1\144\2\uffff\7\45\1\154\2\45\1\160\14\45\1\177\3\144"+
- "\1\uffff\2\45\1\u0087\3\45\1\u008b\1\uffff\3\45\1\uffff\1\u008f\11\45"+
- "\1\u009a\3\45\1\uffff\1\144\1\uffff\3\144\1\u00a0\1\u00a1\1\uffff\1\u00a2"+
- "\2\45\1\uffff\1\u00a5\1\u00a7\1\45\1\uffff\1\u00a9\4\45\1\u00ae\4\45\1"+
- "\uffff\1\u00b3\2\45\5\uffff\1\45\1\u00b7\1\uffff\1\45\1\uffff\1\45\1\uffff"+
- "\1\u00ba\1\u00bb\1\u00bc\1\u00bd\1\uffff\4\45\1\uffff\3\45\1\uffff\1\45"+
- "\1\u00c6\4\uffff\1\45\1\u00c8\1\45\1\u00ca\2\45\1\u00cd\1\45\1\uffff\1"+
- "\45\1\uffff\1\u00d0\1\uffff\1\u00d1\1\45\1\uffff\1\45\1\u00d4\2\uffff"+
- "\2\45\1\uffff\1\u00d7\1\45\1\uffff\2\45\1\u00db\1\uffff";
- static final String DFA30_eofS =
- "\u00dc\uffff";
- static final String DFA30_minS =
- "\1\11\1\154\1\141\1\157\1\156\1\154\1\156\1\157\1\150\1\162\1\156\1\141"+
- "\1\102\1\141\1\151\1\76\1\uffff\1\75\1\56\13\uffff\1\60\1\uffff\1\42\3"+
- "\uffff\1\52\1\uffff\1\151\1\156\1\141\1\157\1\154\2\165\1\145\1\157\1"+
- "\164\1\156\1\157\1\147\1\162\1\141\1\160\1\163\1\162\1\151\2\157\1\155"+
- "\1\116\11\uffff\1\60\2\uffff\1\147\1\163\1\162\1\143\1\154\1\142\1\155"+
- "\1\60\1\156\1\141\1\60\1\147\1\162\1\156\1\145\1\143\1\145\2\151\1\144"+
- "\1\157\1\155\1\141\1\60\1\125\2\114\1\uffff\1\156\1\164\1\60\1\153\1\163"+
- "\1\154\1\60\1\uffff\2\164\1\147\1\uffff\1\60\1\164\1\145\1\141\1\156\1"+
- "\143\1\145\1\141\1\147\1\141\1\60\1\154\1\160\1\147\1\uffff\1\125\1\uffff"+
- "\1\125\1\154\1\114\2\60\1\uffff\1\60\1\151\1\145\1\uffff\2\60\1\145\1"+
- "\uffff\1\60\1\144\1\155\1\147\1\164\1\60\1\154\1\145\2\156\1\uffff\1\60"+
- "\1\154\1\151\5\uffff\1\164\1\60\1\uffff\1\156\1\uffff\1\162\1\uffff\4"+
- "\60\1\uffff\1\151\1\146\1\145\1\164\1\uffff\1\145\1\156\1\145\1\uffff"+
- "\1\147\1\60\4\uffff\1\141\1\60\1\144\1\60\1\170\1\141\1\60\1\137\1\uffff"+
- "\1\163\1\uffff\1\60\1\uffff\1\60\1\162\1\uffff\1\160\1\60\2\uffff\1\171"+
- "\1\157\1\uffff\1\60\1\151\1\uffff\1\156\1\164\1\60\1\uffff";
- static final String DFA30_maxS =
- "\1\175\1\154\2\157\1\166\1\154\1\156\1\157\1\164\1\171\1\156\1\157\1\111"+
- "\1\141\2\151\1\uffff\1\75\1\56\13\uffff\1\170\1\uffff\1\47\3\uffff\1\57"+
- "\1\uffff\1\151\1\156\1\141\1\157\1\154\1\165\1\166\1\145\1\157\1\164\1"+
- "\156\1\157\1\147\1\162\1\141\1\160\1\163\1\162\1\151\2\157\1\155\1\116"+
- "\11\uffff\1\165\2\uffff\1\147\1\163\1\162\1\143\1\154\1\142\1\155\1\172"+
- "\1\156\1\141\1\172\1\147\1\162\1\156\1\165\1\143\1\145\2\151\1\144\1\157"+
- "\1\155\1\141\1\172\2\165\1\154\1\uffff\1\156\1\164\1\172\1\153\1\163\1"+
- "\154\1\172\1\uffff\2\164\1\147\1\uffff\1\172\1\164\1\145\1\141\1\156\1"+
- "\143\1\145\1\144\1\147\1\141\1\172\1\154\1\160\1\147\1\uffff\1\165\1\uffff"+
- "\1\165\1\154\1\114\2\172\1\uffff\1\172\1\151\1\145\1\uffff\2\172\1\145"+
- "\1\uffff\1\172\1\144\1\155\1\147\1\164\1\172\1\154\1\145\2\156\1\uffff"+
- "\1\172\1\154\1\151\5\uffff\1\164\1\172\1\uffff\1\156\1\uffff\1\162\1\uffff"+
- "\4\172\1\uffff\1\151\1\146\1\145\1\164\1\uffff\1\145\1\156\1\145\1\uffff"+
- "\1\147\1\172\4\uffff\1\141\1\172\1\144\1\172\1\170\1\141\1\172\1\137\1"+
- "\uffff\1\163\1\uffff\1\172\1\uffff\1\172\1\162\1\uffff\1\160\1\172\2\uffff"+
- "\1\171\1\157\1\uffff\1\172\1\151\1\uffff\1\156\1\164\1\172\1\uffff";
- static final String DFA30_acceptS =
- "\20\uffff\1\40\2\uffff\1\43\1\45\1\46\1\47\1\50\1\51\1\52\1\53\1\54\1"+
- "\55\1\56\1\uffff\1\63\1\uffff\1\65\1\66\1\67\1\uffff\1\72\27\uffff\1\36"+
- "\1\57\1\37\1\60\1\44\1\41\1\42\1\61\1\64\1\uffff\1\70\1\71\33\uffff\1"+
- "\62\7\uffff\1\32\3\uffff\1\12\16\uffff\1\35\1\uffff\1\62\5\uffff\1\3\3"+
- "\uffff\1\5\3\uffff\1\13\12\uffff\1\26\3\uffff\2\62\1\1\1\2\1\33\2\uffff"+
- "\1\6\1\uffff\1\10\1\uffff\1\14\4\uffff\1\21\4\uffff\1\27\3\uffff\1\4\2"+
- "\uffff\1\15\1\16\1\17\1\20\10\uffff\1\11\1\uffff\1\23\1\uffff\1\25\2\uffff"+
- "\1\34\2\uffff\1\24\1\30\2\uffff\1\22\2\uffff\1\31\3\uffff\1\7";
- static final String DFA30_specialS =
- "\u00dc\uffff}>";
- static final String[] DFA30_transitionS = {
- "\2\43\1\uffff\2\43\22\uffff\1\43\1\uffff\1\42\4\uffff\1\41\1\30\1\31"+
- "\1\35\1\16\1\20\1\17\1\22\1\44\1\36\11\37\1\21\1\34\1\24\1\23\1\25\2"+
- "\uffff\13\45\1\40\1\45\1\15\14\45\1\26\1\uffff\1\27\1\uffff\1\14\1\uffff"+
- "\1\1\1\45\1\2\1\3\1\4\1\5\2\45\1\6\2\45\1\7\6\45\1\10\1\11\1\12\1\13"+
- "\4\45\1\32\1\uffff\1\33",
- "\1\46",
- "\1\52\6\uffff\1\50\3\uffff\1\51\2\uffff\1\47",
- "\1\53",
- "\1\54\7\uffff\1\55",
- "\1\56",
- "\1\57",
- "\1\60",
- "\1\61\1\62\12\uffff\1\63",
- "\1\64\6\uffff\1\65",
- "\1\66",
- "\1\67\15\uffff\1\70",
- "\1\71\1\72\5\uffff\1\73",
- "\1\74",
- "\1\75",
- "\1\100\52\uffff\1\77",
- "",
- "\1\101",
- "\1\103",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "\10\106\40\uffff\1\105\37\uffff\1\105",
- "",
- "\1\42\4\uffff\1\41",
- "",
- "",
- "",
- "\1\107\4\uffff\1\110",
- "",
- "\1\111",
- "\1\112",
- "\1\113",
- "\1\114",
- "\1\115",
- "\1\116",
- "\1\117\1\120",
- "\1\121",
- "\1\122",
- "\1\123",
- "\1\124",
- "\1\125",
- "\1\126",
- "\1\127",
- "\1\130",
- "\1\131",
- "\1\132",
- "\1\133",
- "\1\134",
- "\1\135",
- "\1\136",
- "\1\137",
- "\1\140",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "\10\106\2\37\22\uffff\1\142\10\uffff\1\143\26\uffff\1\141\10\uffff\1"+
- "\143",
- "",
- "",
- "\1\145",
- "\1\146",
- "\1\147",
- "\1\150",
- "\1\151",
- "\1\152",
- "\1\153",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\155",
- "\1\156",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\4\45\1\157\25\45",
- "\1\161",
- "\1\162",
- "\1\163",
- "\1\164\3\uffff\1\165\13\uffff\1\166",
- "\1\167",
- "\1\170",
- "\1\171",
- "\1\172",
- "\1\173",
- "\1\174",
- "\1\175",
- "\1\176",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u0081\26\uffff\1\u0080\10\uffff\1\u0081",
- "\1\u0082\10\uffff\1\u0081\37\uffff\1\u0081",
- "\1\u0084\37\uffff\1\u0083",
- "",
- "\1\u0085",
- "\1\u0086",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u0088",
- "\1\u0089",
- "\1\u008a",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "\1\u008c",
- "\1\u008d",
- "\1\u008e",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u0090",
- "\1\u0091",
- "\1\u0092",
- "\1\u0093",
- "\1\u0094",
- "\1\u0095",
- "\1\u0096\2\uffff\1\u0097",
- "\1\u0098",
- "\1\u0099",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u009b",
- "\1\u009c",
- "\1\u009d",
- "",
- "\1\u0081\37\uffff\1\u0081",
- "",
- "\1\u0081\37\uffff\1\u0081",
- "\1\u009e",
- "\1\u009f",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00a3",
- "\1\u00a4",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\10\45\1\u00a6\21\45",
- "\1\u00a8",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00aa",
- "\1\u00ab",
- "\1\u00ac",
- "\1\u00ad",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00af",
- "\1\u00b0",
- "\1\u00b1",
- "\1\u00b2",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00b4",
- "\1\u00b5",
- "",
- "",
- "",
- "",
- "",
- "\1\u00b6",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "\1\u00b8",
- "",
- "\1\u00b9",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "\1\u00be",
- "\1\u00bf",
- "\1\u00c0",
- "\1\u00c1",
- "",
- "\1\u00c2",
- "\1\u00c3",
- "\1\u00c4",
- "",
- "\1\u00c5",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "",
- "",
- "",
- "\1\u00c7",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00c9",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00cb",
- "\1\u00cc",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00ce",
- "",
- "\1\u00cf",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00d2",
- "",
- "\1\u00d3",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "",
- "",
- "\1\u00d5",
- "\1\u00d6",
- "",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- "\1\u00d8",
- "",
- "\1\u00d9",
- "\1\u00da",
- "\12\45\7\uffff\32\45\4\uffff\1\45\1\uffff\32\45",
- ""
- };
-
- static final short[] DFA30_eot = DFA.unpackEncodedString(DFA30_eotS);
- static final short[] DFA30_eof = DFA.unpackEncodedString(DFA30_eofS);
- static final char[] DFA30_min = DFA.unpackEncodedStringToUnsignedChars(DFA30_minS);
- static final char[] DFA30_max = DFA.unpackEncodedStringToUnsignedChars(DFA30_maxS);
- static final short[] DFA30_accept = DFA.unpackEncodedString(DFA30_acceptS);
- static final short[] DFA30_special = DFA.unpackEncodedString(DFA30_specialS);
- static final short[][] DFA30_transition;
-
- static {
- int numStates = DFA30_transitionS.length;
- DFA30_transition = new short[numStates][];
- for (int i=0; i<numStates; i++) {
- DFA30_transition[i] = DFA.unpackEncodedString(DFA30_transitionS[i]);
- }
- }
-
- protected class DFA30 extends DFA {
-
- public DFA30(BaseRecognizer recognizer) {
- this.recognizer = recognizer;
- this.decisionNumber = 30;
- this.eot = DFA30_eot;
- this.eof = DFA30_eof;
- this.min = DFA30_min;
- this.max = DFA30_max;
- this.accept = DFA30_accept;
- this.special = DFA30_special;
- this.transition = DFA30_transition;
- }
- @Override
- public String getDescription() {
- return "1:1: Tokens : ( ALIGNTOK | CONSTTOK | CHARTOK | DOUBLETOK | ENUMTOK | EVENTTOK | FLOATINGPOINTTOK | FLOATTOK | INTEGERTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | STREAMTOK | STRINGTOK | STRUCTTOK | TRACETOK | TYPEALIASTOK | TYPEDEFTOK | UNSIGNEDTOK | VARIANTTOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | ENVTOK | CLOCKTOK | CALLSITETOK | NANNUMBERTOK | INFINITYTOK | NINFINITYTOK | SEPARATOR | COLON | ELIPSES | ASSIGNMENT | TYPE_ASSIGNMENT | LT | GT | OPENBRAC | CLOSEBRAC | LPAREN | RPAREN | LCURL | RCURL | TERM | POINTER | SIGN | ARROW | DOT | OCTAL_LITERAL | DECIMAL_LITERAL | HEX_LITERAL | CHARACTER_LITERAL | STRING_LITERAL | WS | COMMENT | LINE_COMMENT | IDENTIFIER );";
- }
- }
-
-}
+++ /dev/null
-// $ANTLR 3.5.2 org/eclipse/tracecompass/ctf/parser/CTFParser.g 2014-10-20 18:17:49
-
-/*******************************************************************************
- * Copyright (c) 2010, 2013 Ericsson, Ecole Polytechnique de Montréal 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Marchi - Initial API and implementation
- * Etienne Bergeron - Update to Antlr 3.5 syntax
- *******************************************************************************/
-
-package org.eclipse.tracecompass.ctf.parser;
-
-import java.util.Set;
-import java.util.HashSet;
-
-
-import org.antlr.runtime.*;
-import java.util.Stack;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.antlr.runtime.tree.*;
-
-
-@SuppressWarnings("all")
-public class CTFParser extends Parser {
- public static final String[] tokenNames = new String[] {
- "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ALIGNTOK", "ARROW", "ASSIGNMENT",
- "BACKSLASH", "BOOLTOK", "CALLSITETOK", "CHARACTER_LITERAL", "CHARTOK",
- "CHAR_CONTENT", "CLOCKTOK", "CLOSEBRAC", "COLON", "COMMENT", "COMMENT_CLOSE",
- "COMMENT_OPEN", "COMPLEXTOK", "CONSTTOK", "DECIMAL_LITERAL", "DIGIT",
- "DOT", "DOUBLEQUOTE", "DOUBLETOK", "ELIPSES", "ENUMTOK", "ENVTOK", "ESCAPE_SEQUENCE",
- "EVENTTOK", "FLOATINGPOINTTOK", "FLOATTOK", "GT", "HEXADECIMAL_ESCAPE",
- "HEX_DIGIT", "HEX_LITERAL", "HEX_PREFIX", "IDENTIFIER", "IMAGINARYTOK",
- "INFINITYTOK", "INTEGERTOK", "INTEGER_TYPES_SUFFIX", "INTTOK", "LCURL",
- "LINE_COMMENT", "LONGTOK", "LPAREN", "LT", "NANNUMBERTOK", "NINFINITYTOK",
- "NONDIGIT", "NONZERO_DIGIT", "OCTAL_ESCAPE", "OCTAL_LITERAL", "OCT_DIGIT",
- "OCT_PREFIX", "OPENBRAC", "POINTER", "RCURL", "RPAREN", "SEPARATOR", "SHORTTOK",
- "SIGN", "SIGNEDTOK", "SINGLEQUOTE", "STREAMTOK", "STRINGPREFIX", "STRINGTOK",
- "STRING_CONTENT", "STRING_LITERAL", "STRUCTTOK", "TERM", "TRACETOK", "TYPEALIASTOK",
- "TYPEDEFTOK", "TYPE_ASSIGNMENT", "UNICODE_ESCAPE", "UNSIGNEDTOK", "VARIANTTOK",
- "VOIDTOK", "WS", "ALIGN", "CALLSITE", "CLOCK", "CTF_EXPRESSION_TYPE",
- "CTF_EXPRESSION_VAL", "CTF_LEFT", "CTF_RIGHT", "DECLARATION", "DECLARATOR",
- "ENUM", "ENUM_BODY", "ENUM_CONTAINER_TYPE", "ENUM_ENUMERATOR", "ENUM_NAME",
- "ENUM_VALUE", "ENUM_VALUE_RANGE", "ENV", "EVENT", "FLOATING_POINT", "INTEGER",
- "LENGTH", "ROOT", "STREAM", "STRING", "STRUCT", "STRUCT_BODY", "STRUCT_NAME",
- "SV_DECLARATION", "TRACE", "TYPEALIAS", "TYPEALIAS_ALIAS", "TYPEALIAS_TARGET",
- "TYPEDEF", "TYPE_DECLARATOR", "TYPE_DECLARATOR_LIST", "TYPE_SPECIFIER_LIST",
- "UNARY_EXPRESSION_DEC", "UNARY_EXPRESSION_HEX", "UNARY_EXPRESSION_OCT",
- "UNARY_EXPRESSION_STRING", "UNARY_EXPRESSION_STRING_QUOTES", "VARIANT",
- "VARIANT_BODY", "VARIANT_NAME", "VARIANT_TAG"
- };
- public static final int EOF=-1;
- public static final int ALIGNTOK=4;
- public static final int ARROW=5;
- public static final int ASSIGNMENT=6;
- public static final int BACKSLASH=7;
- public static final int BOOLTOK=8;
- public static final int CALLSITETOK=9;
- public static final int CHARACTER_LITERAL=10;
- public static final int CHARTOK=11;
- public static final int CHAR_CONTENT=12;
- public static final int CLOCKTOK=13;
- public static final int CLOSEBRAC=14;
- public static final int COLON=15;
- public static final int COMMENT=16;
- public static final int COMMENT_CLOSE=17;
- public static final int COMMENT_OPEN=18;
- public static final int COMPLEXTOK=19;
- public static final int CONSTTOK=20;
- public static final int DECIMAL_LITERAL=21;
- public static final int DIGIT=22;
- public static final int DOT=23;
- public static final int DOUBLEQUOTE=24;
- public static final int DOUBLETOK=25;
- public static final int ELIPSES=26;
- public static final int ENUMTOK=27;
- public static final int ENVTOK=28;
- public static final int ESCAPE_SEQUENCE=29;
- public static final int EVENTTOK=30;
- public static final int FLOATINGPOINTTOK=31;
- public static final int FLOATTOK=32;
- public static final int GT=33;
- public static final int HEXADECIMAL_ESCAPE=34;
- public static final int HEX_DIGIT=35;
- public static final int HEX_LITERAL=36;
- public static final int HEX_PREFIX=37;
- public static final int IDENTIFIER=38;
- public static final int IMAGINARYTOK=39;
- public static final int INFINITYTOK=40;
- public static final int INTEGERTOK=41;
- public static final int INTEGER_TYPES_SUFFIX=42;
- public static final int INTTOK=43;
- public static final int LCURL=44;
- public static final int LINE_COMMENT=45;
- public static final int LONGTOK=46;
- public static final int LPAREN=47;
- public static final int LT=48;
- public static final int NANNUMBERTOK=49;
- public static final int NINFINITYTOK=50;
- public static final int NONDIGIT=51;
- public static final int NONZERO_DIGIT=52;
- public static final int OCTAL_ESCAPE=53;
- public static final int OCTAL_LITERAL=54;
- public static final int OCT_DIGIT=55;
- public static final int OCT_PREFIX=56;
- public static final int OPENBRAC=57;
- public static final int POINTER=58;
- public static final int RCURL=59;
- public static final int RPAREN=60;
- public static final int SEPARATOR=61;
- public static final int SHORTTOK=62;
- public static final int SIGN=63;
- public static final int SIGNEDTOK=64;
- public static final int SINGLEQUOTE=65;
- public static final int STREAMTOK=66;
- public static final int STRINGPREFIX=67;
- public static final int STRINGTOK=68;
- public static final int STRING_CONTENT=69;
- public static final int STRING_LITERAL=70;
- public static final int STRUCTTOK=71;
- public static final int TERM=72;
- public static final int TRACETOK=73;
- public static final int TYPEALIASTOK=74;
- public static final int TYPEDEFTOK=75;
- public static final int TYPE_ASSIGNMENT=76;
- public static final int UNICODE_ESCAPE=77;
- public static final int UNSIGNEDTOK=78;
- public static final int VARIANTTOK=79;
- public static final int VOIDTOK=80;
- public static final int WS=81;
- public static final int ALIGN=82;
- public static final int CALLSITE=83;
- public static final int CLOCK=84;
- public static final int CTF_EXPRESSION_TYPE=85;
- public static final int CTF_EXPRESSION_VAL=86;
- public static final int CTF_LEFT=87;
- public static final int CTF_RIGHT=88;
- public static final int DECLARATION=89;
- public static final int DECLARATOR=90;
- public static final int ENUM=91;
- public static final int ENUM_BODY=92;
- public static final int ENUM_CONTAINER_TYPE=93;
- public static final int ENUM_ENUMERATOR=94;
- public static final int ENUM_NAME=95;
- public static final int ENUM_VALUE=96;
- public static final int ENUM_VALUE_RANGE=97;
- public static final int ENV=98;
- public static final int EVENT=99;
- public static final int FLOATING_POINT=100;
- public static final int INTEGER=101;
- public static final int LENGTH=102;
- public static final int ROOT=103;
- public static final int STREAM=104;
- public static final int STRING=105;
- public static final int STRUCT=106;
- public static final int STRUCT_BODY=107;
- public static final int STRUCT_NAME=108;
- public static final int SV_DECLARATION=109;
- public static final int TRACE=110;
- public static final int TYPEALIAS=111;
- public static final int TYPEALIAS_ALIAS=112;
- public static final int TYPEALIAS_TARGET=113;
- public static final int TYPEDEF=114;
- public static final int TYPE_DECLARATOR=115;
- public static final int TYPE_DECLARATOR_LIST=116;
- public static final int TYPE_SPECIFIER_LIST=117;
- public static final int UNARY_EXPRESSION_DEC=118;
- public static final int UNARY_EXPRESSION_HEX=119;
- public static final int UNARY_EXPRESSION_OCT=120;
- public static final int UNARY_EXPRESSION_STRING=121;
- public static final int UNARY_EXPRESSION_STRING_QUOTES=122;
- public static final int VARIANT=123;
- public static final int VARIANT_BODY=124;
- public static final int VARIANT_NAME=125;
- public static final int VARIANT_TAG=126;
-
- // delegates
- public Parser[] getDelegates() {
- return new Parser[] {};
- }
-
- // delegators
-
- protected static class Symbols_scope {
- Set<String> types;
- }
- protected Stack<Symbols_scope> Symbols_stack = new Stack<Symbols_scope>();
-
-
- public CTFParser(TokenStream input) {
- this(input, new RecognizerSharedState());
- }
- public CTFParser(TokenStream input, RecognizerSharedState state) {
- super(input, state);
- }
-
- protected TreeAdaptor adaptor = new CommonTreeAdaptor();
-
- public void setTreeAdaptor(TreeAdaptor adaptor) {
- this.adaptor = adaptor;
- }
- public TreeAdaptor getTreeAdaptor() {
- return adaptor;
- }
- @Override public String[] getTokenNames() { return CTFParser.tokenNames; }
- @Override public String getGrammarFileName() { return "org/eclipse/tracecompass/ctf/parser/CTFParser.g"; }
-
-
- public CTFParser(TokenStream input, boolean verbose) {
- this(input);
- this.verbose = verbose;
- }
-
- /**
- * This method is overriden to disable automatic error recovery.
- * On a mismatched token, it simply re-throw an exception.
- */
- @Override
- protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
- throw new MismatchedTokenException(ttype, input);
- }
-
- /**
- * Checks if a given name has been defined has a type.
- * From: http://www.antlr.org/grammar/1153358328744/C.g
- *
- * @param name The name to check.
- * @return True if is is a type, false otherwise.
- */
- boolean isTypeName(String name) {
- for (int i = Symbols_stack.size() - 1; i >= 0; i--) {
- Symbols_scope scope = (Symbols_scope) Symbols_stack.get(i);
- if (scope.types.contains(name)) {
- return true;
- }
- }
- return false;
- }
-
- void addTypeName(String name) {
- Symbols_stack.peek().types.add(name);
- if (verbose) {
- debug_print("New type: " + name);
- }
- }
-
- boolean _inTypedef = false;
-
- void typedefOn() {
- debug_print("typedefOn");
- _inTypedef = true;
- }
-
- void typedefOff() {
- debug_print("typedefOff");
- _inTypedef = false;
- }
-
- boolean inTypedef() {
- return _inTypedef;
- }
-
- boolean _inTypealiasAlias = false;
-
- void typealiasAliasOn() {
- debug_print("typealiasAliasOn");
- _inTypealiasAlias = true;
- }
-
- void typealiasAliasOff() {
- debug_print("typealiasAliasOff");
- _inTypealiasAlias = false;
- }
-
- boolean inTypealiasAlias() {
- return _inTypealiasAlias;
- }
-
- void debug_print(String str) {
- if (verbose) {
- System.out.println(str);
- }
- }
-
- /* Prints rule entry and exit while parsing */
- boolean verbose = false;
-
-
- public static class parse_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "parse"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:192:1: parse : ( declaration )+ EOF -> ^( ROOT ( declaration )+ ) ;
- public final CTFParser.parse_return parse() throws RecognitionException {
- Symbols_stack.push(new Symbols_scope());
-
- CTFParser.parse_return retval = new CTFParser.parse_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token EOF2=null;
- ParserRuleReturnScope declaration1 =null;
-
- CommonTree EOF2_tree=null;
- RewriteRuleTokenStream stream_EOF=new RewriteRuleTokenStream(adaptor,"token EOF");
- RewriteRuleSubtreeStream stream_declaration=new RewriteRuleSubtreeStream(adaptor,"rule declaration");
-
-
- Symbols_stack.peek().types = new HashSet<String>();
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:3: ( ( declaration )+ EOF -> ^( ROOT ( declaration )+ ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: ( declaration )+ EOF
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: ( declaration )+
- int cnt1=0;
- loop1:
- while (true) {
- int alt1=2;
- int LA1_0 = input.LA(1);
- if ( (LA1_0==BOOLTOK||LA1_0==CHARTOK||(LA1_0 >= COMPLEXTOK && LA1_0 <= CONSTTOK)||LA1_0==DOUBLETOK||LA1_0==ENUMTOK||(LA1_0 >= FLOATINGPOINTTOK && LA1_0 <= FLOATTOK)||LA1_0==IMAGINARYTOK||LA1_0==INTEGERTOK||LA1_0==INTTOK||LA1_0==LONGTOK||LA1_0==SHORTTOK||LA1_0==SIGNEDTOK||LA1_0==STRINGTOK||LA1_0==STRUCTTOK||LA1_0==TYPEDEFTOK||(LA1_0 >= UNSIGNEDTOK && LA1_0 <= VOIDTOK)) ) {
- alt1=1;
- }
- else if ( (LA1_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt1=1;
- }
- else if ( (LA1_0==CALLSITETOK||LA1_0==CLOCKTOK||LA1_0==ENVTOK||LA1_0==EVENTTOK||LA1_0==STREAMTOK||(LA1_0 >= TRACETOK && LA1_0 <= TYPEALIASTOK)) ) {
- alt1=1;
- }
-
- switch (alt1) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:5: declaration
- {
- pushFollow(FOLLOW_declaration_in_parse449);
- declaration1=declaration();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declaration.add(declaration1.getTree());
- }
- break;
-
- default :
- if ( cnt1 >= 1 ) break loop1;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(1, input);
- throw eee;
- }
- cnt1++;
- }
-
- EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_parse452); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_EOF.add(EOF2);
-
- // AST REWRITE
- // elements: declaration
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 197:22: -> ^( ROOT ( declaration )+ )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:197:25: ^( ROOT ( declaration )+ )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ROOT, "ROOT"), root_1);
- if ( !(stream_declaration.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_declaration.hasNext() ) {
- adaptor.addChild(root_1, stream_declaration.nextTree());
- }
- stream_declaration.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- Symbols_stack.pop();
-
- }
- return retval;
- }
- // $ANTLR end "parse"
-
-
- public static class numberLiteral_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "numberLiteral"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:200:1: numberLiteral : ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) ) ;
- public final CTFParser.numberLiteral_return numberLiteral() throws RecognitionException {
- CTFParser.numberLiteral_return retval = new CTFParser.numberLiteral_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token SIGN3=null;
- Token HEX_LITERAL4=null;
- Token DECIMAL_LITERAL5=null;
- Token OCTAL_LITERAL6=null;
-
- CommonTree SIGN3_tree=null;
- CommonTree HEX_LITERAL4_tree=null;
- CommonTree DECIMAL_LITERAL5_tree=null;
- CommonTree OCTAL_LITERAL6_tree=null;
- RewriteRuleTokenStream stream_SIGN=new RewriteRuleTokenStream(adaptor,"token SIGN");
- RewriteRuleTokenStream stream_OCTAL_LITERAL=new RewriteRuleTokenStream(adaptor,"token OCTAL_LITERAL");
- RewriteRuleTokenStream stream_HEX_LITERAL=new RewriteRuleTokenStream(adaptor,"token HEX_LITERAL");
- RewriteRuleTokenStream stream_DECIMAL_LITERAL=new RewriteRuleTokenStream(adaptor,"token DECIMAL_LITERAL");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:3: ( ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: ( SIGN )* ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: ( SIGN )*
- loop2:
- while (true) {
- int alt2=2;
- int LA2_0 = input.LA(1);
- if ( (LA2_0==SIGN) ) {
- alt2=1;
- }
-
- switch (alt2) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:201:5: SIGN
- {
- SIGN3=(Token)match(input,SIGN,FOLLOW_SIGN_in_numberLiteral474); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SIGN.add(SIGN3);
-
- }
- break;
-
- default :
- break loop2;
- }
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:7: ( HEX_LITERAL -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* ) | DECIMAL_LITERAL -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* ) | OCTAL_LITERAL -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* ) )
- int alt3=3;
- switch ( input.LA(1) ) {
- case HEX_LITERAL:
- {
- alt3=1;
- }
- break;
- case DECIMAL_LITERAL:
- {
- alt3=2;
- }
- break;
- case OCTAL_LITERAL:
- {
- alt3=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 3, 0, input);
- throw nvae;
- }
- switch (alt3) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:9: HEX_LITERAL
- {
- HEX_LITERAL4=(Token)match(input,HEX_LITERAL,FOLLOW_HEX_LITERAL_in_numberLiteral485); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_HEX_LITERAL.add(HEX_LITERAL4);
-
- // AST REWRITE
- // elements: HEX_LITERAL, SIGN
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 202:21: -> ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:24: ^( UNARY_EXPRESSION_HEX HEX_LITERAL ( SIGN )* )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_HEX, "UNARY_EXPRESSION_HEX"), root_1);
- adaptor.addChild(root_1, stream_HEX_LITERAL.nextNode());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:202:59: ( SIGN )*
- while ( stream_SIGN.hasNext() ) {
- adaptor.addChild(root_1, stream_SIGN.nextNode());
- }
- stream_SIGN.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:9: DECIMAL_LITERAL
- {
- DECIMAL_LITERAL5=(Token)match(input,DECIMAL_LITERAL,FOLLOW_DECIMAL_LITERAL_in_numberLiteral506); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_DECIMAL_LITERAL.add(DECIMAL_LITERAL5);
-
- // AST REWRITE
- // elements: SIGN, DECIMAL_LITERAL
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 203:25: -> ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:28: ^( UNARY_EXPRESSION_DEC DECIMAL_LITERAL ( SIGN )* )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_DEC, "UNARY_EXPRESSION_DEC"), root_1);
- adaptor.addChild(root_1, stream_DECIMAL_LITERAL.nextNode());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:203:67: ( SIGN )*
- while ( stream_SIGN.hasNext() ) {
- adaptor.addChild(root_1, stream_SIGN.nextNode());
- }
- stream_SIGN.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:9: OCTAL_LITERAL
- {
- OCTAL_LITERAL6=(Token)match(input,OCTAL_LITERAL,FOLLOW_OCTAL_LITERAL_in_numberLiteral527); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_OCTAL_LITERAL.add(OCTAL_LITERAL6);
-
- // AST REWRITE
- // elements: SIGN, OCTAL_LITERAL
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 204:23: -> ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:26: ^( UNARY_EXPRESSION_OCT OCTAL_LITERAL ( SIGN )* )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_OCT, "UNARY_EXPRESSION_OCT"), root_1);
- adaptor.addChild(root_1, stream_OCTAL_LITERAL.nextNode());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:204:63: ( SIGN )*
- while ( stream_SIGN.hasNext() ) {
- adaptor.addChild(root_1, stream_SIGN.nextNode());
- }
- stream_SIGN.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "numberLiteral"
-
-
- public static class primaryExpression_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "primaryExpression"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:208:1: primaryExpression : ( ( IDENTIFIER )=> IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ( ctfKeyword )=> ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) | ( STRING_LITERAL )=> STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | numberLiteral | enumConstant | CHARACTER_LITERAL );
- public final CTFParser.primaryExpression_return primaryExpression() throws RecognitionException {
- CTFParser.primaryExpression_return retval = new CTFParser.primaryExpression_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER7=null;
- Token STRING_LITERAL9=null;
- Token CHARACTER_LITERAL12=null;
- ParserRuleReturnScope ctfKeyword8 =null;
- ParserRuleReturnScope numberLiteral10 =null;
- ParserRuleReturnScope enumConstant11 =null;
-
- CommonTree IDENTIFIER7_tree=null;
- CommonTree STRING_LITERAL9_tree=null;
- CommonTree CHARACTER_LITERAL12_tree=null;
- RewriteRuleTokenStream stream_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token STRING_LITERAL");
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
- RewriteRuleSubtreeStream stream_ctfKeyword=new RewriteRuleSubtreeStream(adaptor,"rule ctfKeyword");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:3: ( ( IDENTIFIER )=> IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ( ctfKeyword )=> ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) | ( STRING_LITERAL )=> STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | numberLiteral | enumConstant | CHARACTER_LITERAL )
- int alt4=6;
- switch ( input.LA(1) ) {
- case IDENTIFIER:
- {
- int LA4_1 = input.LA(2);
- if ( (synpred1_CTFParser()) ) {
- alt4=1;
- }
- else if ( (true) ) {
- alt4=5;
- }
-
- }
- break;
- case ALIGNTOK:
- case EVENTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- {
- int LA4_2 = input.LA(2);
- if ( (synpred2_CTFParser()) ) {
- alt4=2;
- }
- else if ( (true) ) {
- alt4=5;
- }
-
- }
- break;
- case STRING_LITERAL:
- {
- int LA4_3 = input.LA(2);
- if ( (synpred3_CTFParser()) ) {
- alt4=3;
- }
- else if ( (true) ) {
- alt4=5;
- }
-
- }
- break;
- case DECIMAL_LITERAL:
- case HEX_LITERAL:
- case OCTAL_LITERAL:
- case SIGN:
- {
- alt4=4;
- }
- break;
- case CHARACTER_LITERAL:
- {
- alt4=6;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 4, 0, input);
- throw nvae;
- }
- switch (alt4) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:5: ( IDENTIFIER )=> IDENTIFIER
- {
- IDENTIFIER7=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_primaryExpression565); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER7);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 210:7: -> ^( UNARY_EXPRESSION_STRING IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:210:10: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:5: ( ctfKeyword )=> ctfKeyword
- {
- pushFollow(FOLLOW_ctfKeyword_in_primaryExpression591);
- ctfKeyword8=ctfKeyword();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfKeyword.add(ctfKeyword8.getTree());
- // AST REWRITE
- // elements: ctfKeyword
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 211:32: -> ^( UNARY_EXPRESSION_STRING ctfKeyword )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:35: ^( UNARY_EXPRESSION_STRING ctfKeyword )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
- adaptor.addChild(root_1, stream_ctfKeyword.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:5: ( STRING_LITERAL )=> STRING_LITERAL
- {
- STRING_LITERAL9=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_primaryExpression611); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_STRING_LITERAL.add(STRING_LITERAL9);
-
- // AST REWRITE
- // elements: STRING_LITERAL
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 213:7: -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:213:10: ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING_QUOTES, "UNARY_EXPRESSION_STRING_QUOTES"), root_1);
- adaptor.addChild(root_1, stream_STRING_LITERAL.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:215:5: numberLiteral
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_numberLiteral_in_primaryExpression636);
- numberLiteral10=numberLiteral();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, numberLiteral10.getTree());
-
- }
- break;
- case 5 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:216:5: enumConstant
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_enumConstant_in_primaryExpression642);
- enumConstant11=enumConstant();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, enumConstant11.getTree());
-
- }
- break;
- case 6 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:217:5: CHARACTER_LITERAL
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- CHARACTER_LITERAL12=(Token)match(input,CHARACTER_LITERAL,FOLLOW_CHARACTER_LITERAL_in_primaryExpression648); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- CHARACTER_LITERAL12_tree = (CommonTree)adaptor.create(CHARACTER_LITERAL12);
- adaptor.addChild(root_0, CHARACTER_LITERAL12_tree);
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "primaryExpression"
-
-
- public static class postfixExpressionSuffix_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "postfixExpressionSuffix"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:220:1: postfixExpressionSuffix : ( OPENBRAC unaryExpression CLOSEBRAC !| (ref= DOT |ref= ARROW ) IDENTIFIER -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) ) );
- public final CTFParser.postfixExpressionSuffix_return postfixExpressionSuffix() throws RecognitionException {
- CTFParser.postfixExpressionSuffix_return retval = new CTFParser.postfixExpressionSuffix_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token ref=null;
- Token OPENBRAC13=null;
- Token CLOSEBRAC15=null;
- Token IDENTIFIER16=null;
- ParserRuleReturnScope unaryExpression14 =null;
-
- CommonTree ref_tree=null;
- CommonTree OPENBRAC13_tree=null;
- CommonTree CLOSEBRAC15_tree=null;
- CommonTree IDENTIFIER16_tree=null;
- RewriteRuleTokenStream stream_ARROW=new RewriteRuleTokenStream(adaptor,"token ARROW");
- RewriteRuleTokenStream stream_DOT=new RewriteRuleTokenStream(adaptor,"token DOT");
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:221:3: ( OPENBRAC unaryExpression CLOSEBRAC !| (ref= DOT |ref= ARROW ) IDENTIFIER -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) ) )
- int alt6=2;
- int LA6_0 = input.LA(1);
- if ( (LA6_0==OPENBRAC) ) {
- alt6=1;
- }
- else if ( (LA6_0==ARROW||LA6_0==DOT) ) {
- alt6=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 6, 0, input);
- throw nvae;
- }
-
- switch (alt6) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:221:5: OPENBRAC unaryExpression CLOSEBRAC !
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- OPENBRAC13=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_postfixExpressionSuffix661); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- OPENBRAC13_tree = (CommonTree)adaptor.create(OPENBRAC13);
- adaptor.addChild(root_0, OPENBRAC13_tree);
- }
-
- pushFollow(FOLLOW_unaryExpression_in_postfixExpressionSuffix663);
- unaryExpression14=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression14.getTree());
-
- CLOSEBRAC15=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_postfixExpressionSuffix665); if (state.failed) return retval;
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:5: (ref= DOT |ref= ARROW ) IDENTIFIER
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:5: (ref= DOT |ref= ARROW )
- int alt5=2;
- int LA5_0 = input.LA(1);
- if ( (LA5_0==DOT) ) {
- alt5=1;
- }
- else if ( (LA5_0==ARROW) ) {
- alt5=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 5, 0, input);
- throw nvae;
- }
-
- switch (alt5) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:6: ref= DOT
- {
- ref=(Token)match(input,DOT,FOLLOW_DOT_in_postfixExpressionSuffix675); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_DOT.add(ref);
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:222:16: ref= ARROW
- {
- ref=(Token)match(input,ARROW,FOLLOW_ARROW_in_postfixExpressionSuffix681); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ARROW.add(ref);
-
- }
- break;
-
- }
-
- IDENTIFIER16=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_postfixExpressionSuffix684); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER16);
-
- // AST REWRITE
- // elements: IDENTIFIER, ref
- // token labels: ref
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleTokenStream stream_ref=new RewriteRuleTokenStream(adaptor,"token ref",ref);
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 223:7: -> ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:223:10: ^( $ref ^( UNARY_EXPRESSION_STRING IDENTIFIER ) )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot(stream_ref.nextNode(), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:223:17: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_2);
- adaptor.addChild(root_2, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_1, root_2);
- }
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "postfixExpressionSuffix"
-
-
- public static class postfixExpression_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "postfixExpression"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:226:1: postfixExpression : ( primaryExpression ( postfixExpressionSuffix )* | ctfSpecifierHead ( postfixExpressionSuffix )+ );
- public final CTFParser.postfixExpression_return postfixExpression() throws RecognitionException {
- CTFParser.postfixExpression_return retval = new CTFParser.postfixExpression_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope primaryExpression17 =null;
- ParserRuleReturnScope postfixExpressionSuffix18 =null;
- ParserRuleReturnScope ctfSpecifierHead19 =null;
- ParserRuleReturnScope postfixExpressionSuffix20 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:3: ( primaryExpression ( postfixExpressionSuffix )* | ctfSpecifierHead ( postfixExpressionSuffix )+ )
- int alt9=2;
- switch ( input.LA(1) ) {
- case ALIGNTOK:
- case CHARACTER_LITERAL:
- case DECIMAL_LITERAL:
- case HEX_LITERAL:
- case IDENTIFIER:
- case OCTAL_LITERAL:
- case SIGN:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRING_LITERAL:
- {
- alt9=1;
- }
- break;
- case EVENTTOK:
- {
- alt9=1;
- }
- break;
- case CALLSITETOK:
- case CLOCKTOK:
- case ENVTOK:
- case STREAMTOK:
- case TRACETOK:
- {
- alt9=2;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 9, 0, input);
- throw nvae;
- }
- switch (alt9) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:5: primaryExpression ( postfixExpressionSuffix )*
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_primaryExpression_in_postfixExpression716);
- primaryExpression17=primaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, primaryExpression17.getTree());
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:23: ( postfixExpressionSuffix )*
- loop7:
- while (true) {
- int alt7=2;
- int LA7_0 = input.LA(1);
- if ( (LA7_0==ARROW||LA7_0==DOT||LA7_0==OPENBRAC) ) {
- alt7=1;
- }
-
- switch (alt7) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:227:23: postfixExpressionSuffix
- {
- pushFollow(FOLLOW_postfixExpressionSuffix_in_postfixExpression718);
- postfixExpressionSuffix18=postfixExpressionSuffix();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpressionSuffix18.getTree());
-
- }
- break;
-
- default :
- break loop7;
- }
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:5: ctfSpecifierHead ( postfixExpressionSuffix )+
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_ctfSpecifierHead_in_postfixExpression725);
- ctfSpecifierHead19=ctfSpecifierHead();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfSpecifierHead19.getTree());
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:22: ( postfixExpressionSuffix )+
- int cnt8=0;
- loop8:
- while (true) {
- int alt8=2;
- int LA8_0 = input.LA(1);
- if ( (LA8_0==ARROW||LA8_0==DOT||LA8_0==OPENBRAC) ) {
- alt8=1;
- }
-
- switch (alt8) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:228:22: postfixExpressionSuffix
- {
- pushFollow(FOLLOW_postfixExpressionSuffix_in_postfixExpression727);
- postfixExpressionSuffix20=postfixExpressionSuffix();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpressionSuffix20.getTree());
-
- }
- break;
-
- default :
- if ( cnt8 >= 1 ) break loop8;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(8, input);
- throw eee;
- }
- cnt8++;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "postfixExpression"
-
-
- public static class unaryExpression_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "unaryExpression"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:231:1: unaryExpression : postfixExpression ;
- public final CTFParser.unaryExpression_return unaryExpression() throws RecognitionException {
- CTFParser.unaryExpression_return retval = new CTFParser.unaryExpression_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope postfixExpression21 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:232:3: ( postfixExpression )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:232:5: postfixExpression
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_postfixExpression_in_unaryExpression743);
- postfixExpression21=postfixExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, postfixExpression21.getTree());
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "unaryExpression"
-
-
- public static class enumConstant_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumConstant"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:236:1: enumConstant : ( STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) );
- public final CTFParser.enumConstant_return enumConstant() throws RecognitionException {
- CTFParser.enumConstant_return retval = new CTFParser.enumConstant_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token STRING_LITERAL22=null;
- Token IDENTIFIER23=null;
- ParserRuleReturnScope ctfKeyword24 =null;
-
- CommonTree STRING_LITERAL22_tree=null;
- CommonTree IDENTIFIER23_tree=null;
- RewriteRuleTokenStream stream_STRING_LITERAL=new RewriteRuleTokenStream(adaptor,"token STRING_LITERAL");
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
- RewriteRuleSubtreeStream stream_ctfKeyword=new RewriteRuleSubtreeStream(adaptor,"rule ctfKeyword");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:3: ( STRING_LITERAL -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL ) | IDENTIFIER -> ^( UNARY_EXPRESSION_STRING IDENTIFIER ) | ctfKeyword -> ^( UNARY_EXPRESSION_STRING ctfKeyword ) )
- int alt10=3;
- switch ( input.LA(1) ) {
- case STRING_LITERAL:
- {
- alt10=1;
- }
- break;
- case IDENTIFIER:
- {
- alt10=2;
- }
- break;
- case ALIGNTOK:
- case EVENTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- {
- alt10=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 10, 0, input);
- throw nvae;
- }
- switch (alt10) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:5: STRING_LITERAL
- {
- STRING_LITERAL22=(Token)match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_enumConstant760); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_STRING_LITERAL.add(STRING_LITERAL22);
-
- // AST REWRITE
- // elements: STRING_LITERAL
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 237:20: -> ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:237:23: ^( UNARY_EXPRESSION_STRING_QUOTES STRING_LITERAL )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING_QUOTES, "UNARY_EXPRESSION_STRING_QUOTES"), root_1);
- adaptor.addChild(root_1, stream_STRING_LITERAL.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:238:5: IDENTIFIER
- {
- IDENTIFIER23=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_enumConstant774); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER23);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 238:16: -> ^( UNARY_EXPRESSION_STRING IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:238:19: ^( UNARY_EXPRESSION_STRING IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:239:5: ctfKeyword
- {
- pushFollow(FOLLOW_ctfKeyword_in_enumConstant788);
- ctfKeyword24=ctfKeyword();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfKeyword.add(ctfKeyword24.getTree());
- // AST REWRITE
- // elements: ctfKeyword
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 239:16: -> ^( UNARY_EXPRESSION_STRING ctfKeyword )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:239:19: ^( UNARY_EXPRESSION_STRING ctfKeyword )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(UNARY_EXPRESSION_STRING, "UNARY_EXPRESSION_STRING"), root_1);
- adaptor.addChild(root_1, stream_ctfKeyword.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumConstant"
-
-
- public static class declaration_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "declaration"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:244:1: declaration : ( declarationSpecifiers ( declaratorList )? TERM -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) ) -> ^( DECLARATION declarationSpecifiers ( declaratorList )? ) | ctfSpecifier TERM !);
- public final CTFParser.declaration_return declaration() throws RecognitionException {
- CTFParser.declaration_return retval = new CTFParser.declaration_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token TERM27=null;
- Token TERM29=null;
- ParserRuleReturnScope declarationSpecifiers25 =null;
- ParserRuleReturnScope declaratorList26 =null;
- ParserRuleReturnScope ctfSpecifier28 =null;
-
- CommonTree TERM27_tree=null;
- CommonTree TERM29_tree=null;
- RewriteRuleTokenStream stream_TERM=new RewriteRuleTokenStream(adaptor,"token TERM");
- RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
- RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:3: ( declarationSpecifiers ( declaratorList )? TERM -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) ) -> ^( DECLARATION declarationSpecifiers ( declaratorList )? ) | ctfSpecifier TERM !)
- int alt12=2;
- int LA12_0 = input.LA(1);
- if ( (LA12_0==BOOLTOK||LA12_0==CHARTOK||(LA12_0 >= COMPLEXTOK && LA12_0 <= CONSTTOK)||LA12_0==DOUBLETOK||LA12_0==ENUMTOK||(LA12_0 >= FLOATINGPOINTTOK && LA12_0 <= FLOATTOK)||LA12_0==IMAGINARYTOK||LA12_0==INTEGERTOK||LA12_0==INTTOK||LA12_0==LONGTOK||LA12_0==SHORTTOK||LA12_0==SIGNEDTOK||LA12_0==STRINGTOK||LA12_0==STRUCTTOK||LA12_0==TYPEDEFTOK||(LA12_0 >= UNSIGNEDTOK && LA12_0 <= VOIDTOK)) ) {
- alt12=1;
- }
- else if ( (LA12_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt12=1;
- }
- else if ( (LA12_0==CALLSITETOK||LA12_0==CLOCKTOK||LA12_0==ENVTOK||LA12_0==EVENTTOK||LA12_0==STREAMTOK||(LA12_0 >= TRACETOK && LA12_0 <= TYPEALIASTOK)) ) {
- alt12=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 12, 0, input);
- throw nvae;
- }
-
- switch (alt12) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:5: declarationSpecifiers ( declaratorList )? TERM
- {
- pushFollow(FOLLOW_declarationSpecifiers_in_declaration816);
- declarationSpecifiers25=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers25.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:27: ( declaratorList )?
- int alt11=2;
- int LA11_0 = input.LA(1);
- if ( (LA11_0==IDENTIFIER||LA11_0==POINTER) ) {
- alt11=1;
- }
- switch (alt11) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:250:27: declaratorList
- {
- pushFollow(FOLLOW_declaratorList_in_declaration818);
- declaratorList26=declaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList26.getTree());
- }
- break;
-
- }
-
- TERM27=(Token)match(input,TERM,FOLLOW_TERM_in_declaration821); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TERM.add(TERM27);
-
- // AST REWRITE
- // elements: declaratorList, declaratorList, declarationSpecifiers, declarationSpecifiers
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 253:7: -> {inTypedef()}? ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) )
- if (inTypedef()) {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:254:10: ^( DECLARATION ^( TYPEDEF declaratorList declarationSpecifiers ) )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:254:24: ^( TYPEDEF declaratorList declarationSpecifiers )
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_2);
- adaptor.addChild(root_2, stream_declaratorList.nextTree());
- adaptor.addChild(root_2, stream_declarationSpecifiers.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
- else // 255:7: -> ^( DECLARATION declarationSpecifiers ( declaratorList )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:255:10: ^( DECLARATION declarationSpecifiers ( declaratorList )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
- adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:255:46: ( declaratorList )?
- if ( stream_declaratorList.hasNext() ) {
- adaptor.addChild(root_1, stream_declaratorList.nextTree());
- }
- stream_declaratorList.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:256:5: ctfSpecifier TERM !
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_ctfSpecifier_in_declaration889);
- ctfSpecifier28=ctfSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfSpecifier28.getTree());
-
- TERM29=(Token)match(input,TERM,FOLLOW_TERM_in_declaration891); if (state.failed) return retval;
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- if ( state.backtracking==0 ) {
- if (inTypedef()) {
- typedefOff();
- }
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "declaration"
-
-
- public static class declarationSpecifiers_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "declarationSpecifiers"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:259:1: declarationSpecifiers : ( storageClassSpecifier | typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) ;
- public final CTFParser.declarationSpecifiers_return declarationSpecifiers() throws RecognitionException {
- CTFParser.declarationSpecifiers_return retval = new CTFParser.declarationSpecifiers_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope storageClassSpecifier30 =null;
- ParserRuleReturnScope typeQualifier31 =null;
- ParserRuleReturnScope typeSpecifier32 =null;
-
- RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
- RewriteRuleSubtreeStream stream_typeQualifier=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifier");
- RewriteRuleSubtreeStream stream_storageClassSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule storageClassSpecifier");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:3: ( ( storageClassSpecifier | typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:5: ( storageClassSpecifier | typeQualifier | typeSpecifier )+
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:260:5: ( storageClassSpecifier | typeQualifier | typeSpecifier )+
- int cnt13=0;
- loop13:
- while (true) {
- int alt13=4;
- switch ( input.LA(1) ) {
- case IDENTIFIER:
- {
- int LA13_2 = input.LA(2);
- if ( ((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))) ) {
- alt13=3;
- }
-
- }
- break;
- case TYPEDEFTOK:
- {
- alt13=1;
- }
- break;
- case CONSTTOK:
- {
- alt13=2;
- }
- break;
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt13=3;
- }
- break;
- }
- switch (alt13) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:263:9: storageClassSpecifier
- {
- pushFollow(FOLLOW_storageClassSpecifier_in_declarationSpecifiers929);
- storageClassSpecifier30=storageClassSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_storageClassSpecifier.add(storageClassSpecifier30.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:264:9: typeQualifier
- {
- pushFollow(FOLLOW_typeQualifier_in_declarationSpecifiers939);
- typeQualifier31=typeQualifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeQualifier.add(typeQualifier31.getTree());
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:265:9: typeSpecifier
- {
- pushFollow(FOLLOW_typeSpecifier_in_declarationSpecifiers949);
- typeSpecifier32=typeSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeSpecifier.add(typeSpecifier32.getTree());
- }
- break;
-
- default :
- if ( cnt13 >= 1 ) break loop13;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(13, input);
- throw eee;
- }
- cnt13++;
- }
-
- // AST REWRITE
- // elements: typeQualifier, typeSpecifier
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 266:6: -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:9: ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:31: ( typeQualifier )*
- while ( stream_typeQualifier.hasNext() ) {
- adaptor.addChild(root_1, stream_typeQualifier.nextTree());
- }
- stream_typeQualifier.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:266:46: ( typeSpecifier )*
- while ( stream_typeSpecifier.hasNext() ) {
- adaptor.addChild(root_1, stream_typeSpecifier.nextTree());
- }
- stream_typeSpecifier.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "declarationSpecifiers"
-
-
- public static class declaratorList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "declaratorList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:269:1: declaratorList : declarator ( SEPARATOR declarator )* -> ^( TYPE_DECLARATOR_LIST ( declarator )+ ) ;
- public final CTFParser.declaratorList_return declaratorList() throws RecognitionException {
- CTFParser.declaratorList_return retval = new CTFParser.declaratorList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token SEPARATOR34=null;
- ParserRuleReturnScope declarator33 =null;
- ParserRuleReturnScope declarator35 =null;
-
- CommonTree SEPARATOR34_tree=null;
- RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
- RewriteRuleSubtreeStream stream_declarator=new RewriteRuleSubtreeStream(adaptor,"rule declarator");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:3: ( declarator ( SEPARATOR declarator )* -> ^( TYPE_DECLARATOR_LIST ( declarator )+ ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:5: declarator ( SEPARATOR declarator )*
- {
- pushFollow(FOLLOW_declarator_in_declaratorList979);
- declarator33=declarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarator.add(declarator33.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:16: ( SEPARATOR declarator )*
- loop14:
- while (true) {
- int alt14=2;
- int LA14_0 = input.LA(1);
- if ( (LA14_0==SEPARATOR) ) {
- alt14=1;
- }
-
- switch (alt14) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:270:17: SEPARATOR declarator
- {
- SEPARATOR34=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_declaratorList982); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR34);
-
- pushFollow(FOLLOW_declarator_in_declaratorList984);
- declarator35=declarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarator.add(declarator35.getTree());
- }
- break;
-
- default :
- break loop14;
- }
- }
-
- // AST REWRITE
- // elements: declarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 271:7: -> ^( TYPE_DECLARATOR_LIST ( declarator )+ )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:271:10: ^( TYPE_DECLARATOR_LIST ( declarator )+ )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
- if ( !(stream_declarator.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_declarator.hasNext() ) {
- adaptor.addChild(root_1, stream_declarator.nextTree());
- }
- stream_declarator.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "declaratorList"
-
-
- public static class abstractDeclaratorList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "abstractDeclaratorList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:274:1: abstractDeclaratorList : abstractDeclarator ( SEPARATOR abstractDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ ) ;
- public final CTFParser.abstractDeclaratorList_return abstractDeclaratorList() throws RecognitionException {
- CTFParser.abstractDeclaratorList_return retval = new CTFParser.abstractDeclaratorList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token SEPARATOR37=null;
- ParserRuleReturnScope abstractDeclarator36 =null;
- ParserRuleReturnScope abstractDeclarator38 =null;
-
- CommonTree SEPARATOR37_tree=null;
- RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
- RewriteRuleSubtreeStream stream_abstractDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule abstractDeclarator");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:3: ( abstractDeclarator ( SEPARATOR abstractDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:5: abstractDeclarator ( SEPARATOR abstractDeclarator )*
- {
- pushFollow(FOLLOW_abstractDeclarator_in_abstractDeclaratorList1014);
- abstractDeclarator36=abstractDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_abstractDeclarator.add(abstractDeclarator36.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:24: ( SEPARATOR abstractDeclarator )*
- loop15:
- while (true) {
- int alt15=2;
- int LA15_0 = input.LA(1);
- if ( (LA15_0==SEPARATOR) ) {
- alt15=1;
- }
-
- switch (alt15) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:275:25: SEPARATOR abstractDeclarator
- {
- SEPARATOR37=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_abstractDeclaratorList1017); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR37);
-
- pushFollow(FOLLOW_abstractDeclarator_in_abstractDeclaratorList1019);
- abstractDeclarator38=abstractDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_abstractDeclarator.add(abstractDeclarator38.getTree());
- }
- break;
-
- default :
- break loop15;
- }
- }
-
- // AST REWRITE
- // elements: abstractDeclarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 276:7: -> ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:276:10: ^( TYPE_DECLARATOR_LIST ( abstractDeclarator )+ )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
- if ( !(stream_abstractDeclarator.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_abstractDeclarator.hasNext() ) {
- adaptor.addChild(root_1, stream_abstractDeclarator.nextTree());
- }
- stream_abstractDeclarator.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "abstractDeclaratorList"
-
-
- public static class storageClassSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "storageClassSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:279:1: storageClassSpecifier : TYPEDEFTOK ;
- public final CTFParser.storageClassSpecifier_return storageClassSpecifier() throws RecognitionException {
- CTFParser.storageClassSpecifier_return retval = new CTFParser.storageClassSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token TYPEDEFTOK39=null;
-
- CommonTree TYPEDEFTOK39_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:280:3: ( TYPEDEFTOK )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:280:5: TYPEDEFTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- TYPEDEFTOK39=(Token)match(input,TYPEDEFTOK,FOLLOW_TYPEDEFTOK_in_storageClassSpecifier1049); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- TYPEDEFTOK39_tree = (CommonTree)adaptor.create(TYPEDEFTOK39);
- adaptor.addChild(root_0, TYPEDEFTOK39_tree);
- }
-
- if ( state.backtracking==0 ) { typedefOn(); }
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "storageClassSpecifier"
-
-
- public static class typeSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typeSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:283:1: typeSpecifier : ( FLOATTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | UNSIGNEDTOK | CHARTOK | DOUBLETOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | structSpecifier | variantSpecifier | enumSpecifier | ctfTypeSpecifier |{...}? => typedefName );
- public final CTFParser.typeSpecifier_return typeSpecifier() throws RecognitionException {
- CTFParser.typeSpecifier_return retval = new CTFParser.typeSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token FLOATTOK40=null;
- Token INTTOK41=null;
- Token LONGTOK42=null;
- Token SHORTTOK43=null;
- Token SIGNEDTOK44=null;
- Token UNSIGNEDTOK45=null;
- Token CHARTOK46=null;
- Token DOUBLETOK47=null;
- Token VOIDTOK48=null;
- Token BOOLTOK49=null;
- Token COMPLEXTOK50=null;
- Token IMAGINARYTOK51=null;
- ParserRuleReturnScope structSpecifier52 =null;
- ParserRuleReturnScope variantSpecifier53 =null;
- ParserRuleReturnScope enumSpecifier54 =null;
- ParserRuleReturnScope ctfTypeSpecifier55 =null;
- ParserRuleReturnScope typedefName56 =null;
-
- CommonTree FLOATTOK40_tree=null;
- CommonTree INTTOK41_tree=null;
- CommonTree LONGTOK42_tree=null;
- CommonTree SHORTTOK43_tree=null;
- CommonTree SIGNEDTOK44_tree=null;
- CommonTree UNSIGNEDTOK45_tree=null;
- CommonTree CHARTOK46_tree=null;
- CommonTree DOUBLETOK47_tree=null;
- CommonTree VOIDTOK48_tree=null;
- CommonTree BOOLTOK49_tree=null;
- CommonTree COMPLEXTOK50_tree=null;
- CommonTree IMAGINARYTOK51_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:284:3: ( FLOATTOK | INTTOK | LONGTOK | SHORTTOK | SIGNEDTOK | UNSIGNEDTOK | CHARTOK | DOUBLETOK | VOIDTOK | BOOLTOK | COMPLEXTOK | IMAGINARYTOK | structSpecifier | variantSpecifier | enumSpecifier | ctfTypeSpecifier |{...}? => typedefName )
- int alt16=17;
- int LA16_0 = input.LA(1);
- if ( (LA16_0==FLOATTOK) ) {
- alt16=1;
- }
- else if ( (LA16_0==INTTOK) ) {
- alt16=2;
- }
- else if ( (LA16_0==LONGTOK) ) {
- alt16=3;
- }
- else if ( (LA16_0==SHORTTOK) ) {
- alt16=4;
- }
- else if ( (LA16_0==SIGNEDTOK) ) {
- alt16=5;
- }
- else if ( (LA16_0==UNSIGNEDTOK) ) {
- alt16=6;
- }
- else if ( (LA16_0==CHARTOK) ) {
- alt16=7;
- }
- else if ( (LA16_0==DOUBLETOK) ) {
- alt16=8;
- }
- else if ( (LA16_0==VOIDTOK) ) {
- alt16=9;
- }
- else if ( (LA16_0==BOOLTOK) ) {
- alt16=10;
- }
- else if ( (LA16_0==COMPLEXTOK) ) {
- alt16=11;
- }
- else if ( (LA16_0==IMAGINARYTOK) ) {
- alt16=12;
- }
- else if ( (LA16_0==STRUCTTOK) ) {
- alt16=13;
- }
- else if ( (LA16_0==VARIANTTOK) ) {
- alt16=14;
- }
- else if ( (LA16_0==ENUMTOK) ) {
- alt16=15;
- }
- else if ( (LA16_0==FLOATINGPOINTTOK||LA16_0==INTEGERTOK||LA16_0==STRINGTOK) ) {
- alt16=16;
- }
- else if ( (LA16_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt16=17;
- }
-
- switch (alt16) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:284:5: FLOATTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- FLOATTOK40=(Token)match(input,FLOATTOK,FOLLOW_FLOATTOK_in_typeSpecifier1065); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- FLOATTOK40_tree = (CommonTree)adaptor.create(FLOATTOK40);
- adaptor.addChild(root_0, FLOATTOK40_tree);
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:285:5: INTTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- INTTOK41=(Token)match(input,INTTOK,FOLLOW_INTTOK_in_typeSpecifier1071); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- INTTOK41_tree = (CommonTree)adaptor.create(INTTOK41);
- adaptor.addChild(root_0, INTTOK41_tree);
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:286:5: LONGTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- LONGTOK42=(Token)match(input,LONGTOK,FOLLOW_LONGTOK_in_typeSpecifier1077); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- LONGTOK42_tree = (CommonTree)adaptor.create(LONGTOK42);
- adaptor.addChild(root_0, LONGTOK42_tree);
- }
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:287:5: SHORTTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- SHORTTOK43=(Token)match(input,SHORTTOK,FOLLOW_SHORTTOK_in_typeSpecifier1083); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- SHORTTOK43_tree = (CommonTree)adaptor.create(SHORTTOK43);
- adaptor.addChild(root_0, SHORTTOK43_tree);
- }
-
- }
- break;
- case 5 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:288:5: SIGNEDTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- SIGNEDTOK44=(Token)match(input,SIGNEDTOK,FOLLOW_SIGNEDTOK_in_typeSpecifier1089); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- SIGNEDTOK44_tree = (CommonTree)adaptor.create(SIGNEDTOK44);
- adaptor.addChild(root_0, SIGNEDTOK44_tree);
- }
-
- }
- break;
- case 6 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:289:5: UNSIGNEDTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- UNSIGNEDTOK45=(Token)match(input,UNSIGNEDTOK,FOLLOW_UNSIGNEDTOK_in_typeSpecifier1095); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- UNSIGNEDTOK45_tree = (CommonTree)adaptor.create(UNSIGNEDTOK45);
- adaptor.addChild(root_0, UNSIGNEDTOK45_tree);
- }
-
- }
- break;
- case 7 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:290:5: CHARTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- CHARTOK46=(Token)match(input,CHARTOK,FOLLOW_CHARTOK_in_typeSpecifier1101); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- CHARTOK46_tree = (CommonTree)adaptor.create(CHARTOK46);
- adaptor.addChild(root_0, CHARTOK46_tree);
- }
-
- }
- break;
- case 8 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:291:5: DOUBLETOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- DOUBLETOK47=(Token)match(input,DOUBLETOK,FOLLOW_DOUBLETOK_in_typeSpecifier1107); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- DOUBLETOK47_tree = (CommonTree)adaptor.create(DOUBLETOK47);
- adaptor.addChild(root_0, DOUBLETOK47_tree);
- }
-
- }
- break;
- case 9 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:292:5: VOIDTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- VOIDTOK48=(Token)match(input,VOIDTOK,FOLLOW_VOIDTOK_in_typeSpecifier1113); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- VOIDTOK48_tree = (CommonTree)adaptor.create(VOIDTOK48);
- adaptor.addChild(root_0, VOIDTOK48_tree);
- }
-
- }
- break;
- case 10 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:293:5: BOOLTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- BOOLTOK49=(Token)match(input,BOOLTOK,FOLLOW_BOOLTOK_in_typeSpecifier1119); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- BOOLTOK49_tree = (CommonTree)adaptor.create(BOOLTOK49);
- adaptor.addChild(root_0, BOOLTOK49_tree);
- }
-
- }
- break;
- case 11 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:294:5: COMPLEXTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- COMPLEXTOK50=(Token)match(input,COMPLEXTOK,FOLLOW_COMPLEXTOK_in_typeSpecifier1125); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- COMPLEXTOK50_tree = (CommonTree)adaptor.create(COMPLEXTOK50);
- adaptor.addChild(root_0, COMPLEXTOK50_tree);
- }
-
- }
- break;
- case 12 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:295:5: IMAGINARYTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- IMAGINARYTOK51=(Token)match(input,IMAGINARYTOK,FOLLOW_IMAGINARYTOK_in_typeSpecifier1131); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- IMAGINARYTOK51_tree = (CommonTree)adaptor.create(IMAGINARYTOK51);
- adaptor.addChild(root_0, IMAGINARYTOK51_tree);
- }
-
- }
- break;
- case 13 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:296:5: structSpecifier
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_structSpecifier_in_typeSpecifier1137);
- structSpecifier52=structSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, structSpecifier52.getTree());
-
- }
- break;
- case 14 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:297:5: variantSpecifier
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_variantSpecifier_in_typeSpecifier1143);
- variantSpecifier53=variantSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, variantSpecifier53.getTree());
-
- }
- break;
- case 15 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:298:5: enumSpecifier
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_enumSpecifier_in_typeSpecifier1149);
- enumSpecifier54=enumSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, enumSpecifier54.getTree());
-
- }
- break;
- case 16 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:299:5: ctfTypeSpecifier
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_ctfTypeSpecifier_in_typeSpecifier1155);
- ctfTypeSpecifier55=ctfTypeSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfTypeSpecifier55.getTree());
-
- }
- break;
- case 17 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:300:5: {...}? => typedefName
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- if ( !(( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )) ) {
- if (state.backtracking>0) {state.failed=true; return retval;}
- throw new FailedPredicateException(input, "typeSpecifier", " inTypealiasAlias() || isTypeName(input.LT(1).getText()) ");
- }
- pushFollow(FOLLOW_typedefName_in_typeSpecifier1165);
- typedefName56=typedefName();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, typedefName56.getTree());
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typeSpecifier"
-
-
- public static class typeQualifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typeQualifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:303:1: typeQualifier : CONSTTOK ;
- public final CTFParser.typeQualifier_return typeQualifier() throws RecognitionException {
- CTFParser.typeQualifier_return retval = new CTFParser.typeQualifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token CONSTTOK57=null;
-
- CommonTree CONSTTOK57_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:304:3: ( CONSTTOK )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:304:5: CONSTTOK
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- CONSTTOK57=(Token)match(input,CONSTTOK,FOLLOW_CONSTTOK_in_typeQualifier1178); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- CONSTTOK57_tree = (CommonTree)adaptor.create(CONSTTOK57);
- adaptor.addChild(root_0, CONSTTOK57_tree);
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typeQualifier"
-
-
- public static class alignAttribute_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "alignAttribute"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:307:1: alignAttribute : ALIGNTOK LPAREN unaryExpression RPAREN -> ^( ALIGN unaryExpression ) ;
- public final CTFParser.alignAttribute_return alignAttribute() throws RecognitionException {
- CTFParser.alignAttribute_return retval = new CTFParser.alignAttribute_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token ALIGNTOK58=null;
- Token LPAREN59=null;
- Token RPAREN61=null;
- ParserRuleReturnScope unaryExpression60 =null;
-
- CommonTree ALIGNTOK58_tree=null;
- CommonTree LPAREN59_tree=null;
- CommonTree RPAREN61_tree=null;
- RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
- RewriteRuleTokenStream stream_ALIGNTOK=new RewriteRuleTokenStream(adaptor,"token ALIGNTOK");
- RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
- RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:3: ( ALIGNTOK LPAREN unaryExpression RPAREN -> ^( ALIGN unaryExpression ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:5: ALIGNTOK LPAREN unaryExpression RPAREN
- {
- ALIGNTOK58=(Token)match(input,ALIGNTOK,FOLLOW_ALIGNTOK_in_alignAttribute1191); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ALIGNTOK.add(ALIGNTOK58);
-
- LPAREN59=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_alignAttribute1193); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LPAREN.add(LPAREN59);
-
- pushFollow(FOLLOW_unaryExpression_in_alignAttribute1195);
- unaryExpression60=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_unaryExpression.add(unaryExpression60.getTree());
- RPAREN61=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_alignAttribute1197); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_RPAREN.add(RPAREN61);
-
- // AST REWRITE
- // elements: unaryExpression
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 308:44: -> ^( ALIGN unaryExpression )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:308:47: ^( ALIGN unaryExpression )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ALIGN, "ALIGN"), root_1);
- adaptor.addChild(root_1, stream_unaryExpression.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "alignAttribute"
-
-
- public static class structBody_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structBody"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:312:1: structBody : LCURL ( structOrVariantDeclarationList )? RCURL -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? ) ;
- public final CTFParser.structBody_return structBody() throws RecognitionException {
- Symbols_stack.push(new Symbols_scope());
-
- CTFParser.structBody_return retval = new CTFParser.structBody_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token LCURL62=null;
- Token RCURL64=null;
- ParserRuleReturnScope structOrVariantDeclarationList63 =null;
-
- CommonTree LCURL62_tree=null;
- CommonTree RCURL64_tree=null;
- RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
- RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
- RewriteRuleSubtreeStream stream_structOrVariantDeclarationList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarationList");
-
-
- Symbols_stack.peek().types = new HashSet<String>();
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:3: ( LCURL ( structOrVariantDeclarationList )? RCURL -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:5: LCURL ( structOrVariantDeclarationList )? RCURL
- {
- LCURL62=(Token)match(input,LCURL,FOLLOW_LCURL_in_structBody1231); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LCURL.add(LCURL62);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:11: ( structOrVariantDeclarationList )?
- int alt17=2;
- int LA17_0 = input.LA(1);
- if ( (LA17_0==BOOLTOK||LA17_0==CHARTOK||(LA17_0 >= COMPLEXTOK && LA17_0 <= CONSTTOK)||LA17_0==DOUBLETOK||LA17_0==ENUMTOK||(LA17_0 >= FLOATINGPOINTTOK && LA17_0 <= FLOATTOK)||LA17_0==IMAGINARYTOK||LA17_0==INTEGERTOK||LA17_0==INTTOK||LA17_0==LONGTOK||LA17_0==SHORTTOK||LA17_0==SIGNEDTOK||LA17_0==STRINGTOK||LA17_0==STRUCTTOK||LA17_0==TYPEDEFTOK||(LA17_0 >= UNSIGNEDTOK && LA17_0 <= VOIDTOK)) ) {
- alt17=1;
- }
- else if ( (LA17_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt17=1;
- }
- else if ( (LA17_0==TYPEALIASTOK) ) {
- alt17=1;
- }
- switch (alt17) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:317:11: structOrVariantDeclarationList
- {
- pushFollow(FOLLOW_structOrVariantDeclarationList_in_structBody1233);
- structOrVariantDeclarationList63=structOrVariantDeclarationList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structOrVariantDeclarationList.add(structOrVariantDeclarationList63.getTree());
- }
- break;
-
- }
-
- RCURL64=(Token)match(input,RCURL,FOLLOW_RCURL_in_structBody1236); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_RCURL.add(RCURL64);
-
- // AST REWRITE
- // elements: structOrVariantDeclarationList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 318:7: -> ^( STRUCT_BODY ( structOrVariantDeclarationList )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:318:10: ^( STRUCT_BODY ( structOrVariantDeclarationList )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT_BODY, "STRUCT_BODY"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:318:24: ( structOrVariantDeclarationList )?
- if ( stream_structOrVariantDeclarationList.hasNext() ) {
- adaptor.addChild(root_1, stream_structOrVariantDeclarationList.nextTree());
- }
- stream_structOrVariantDeclarationList.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- Symbols_stack.pop();
-
- }
- return retval;
- }
- // $ANTLR end "structBody"
-
-
- public static class structSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:321:1: structSpecifier : STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) ) -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? ) ;
- public final CTFParser.structSpecifier_return structSpecifier() throws RecognitionException {
- CTFParser.structSpecifier_return retval = new CTFParser.structSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token STRUCTTOK65=null;
- ParserRuleReturnScope structName66 =null;
- ParserRuleReturnScope alignAttribute67 =null;
- ParserRuleReturnScope structBody68 =null;
- ParserRuleReturnScope alignAttribute69 =null;
- ParserRuleReturnScope structBody70 =null;
- ParserRuleReturnScope alignAttribute71 =null;
-
- CommonTree STRUCTTOK65_tree=null;
- RewriteRuleTokenStream stream_STRUCTTOK=new RewriteRuleTokenStream(adaptor,"token STRUCTTOK");
- RewriteRuleSubtreeStream stream_structName=new RewriteRuleSubtreeStream(adaptor,"rule structName");
- RewriteRuleSubtreeStream stream_structBody=new RewriteRuleSubtreeStream(adaptor,"rule structBody");
- RewriteRuleSubtreeStream stream_alignAttribute=new RewriteRuleSubtreeStream(adaptor,"rule alignAttribute");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:322:3: ( STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) ) -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:322:5: STRUCTTOK ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) )
- {
- STRUCTTOK65=(Token)match(input,STRUCTTOK,FOLLOW_STRUCTTOK_in_structSpecifier1264); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_STRUCTTOK.add(STRUCTTOK65);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:323:3: ( ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) ) | ( structBody ( alignAttribute |) ) )
- int alt21=2;
- int LA21_0 = input.LA(1);
- if ( (LA21_0==IDENTIFIER) ) {
- alt21=1;
- }
- else if ( (LA21_0==LCURL) ) {
- alt21=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 21, 0, input);
- throw nvae;
- }
-
- switch (alt21) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:325:5: ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:325:5: ( structName ( alignAttribute | ( structBody ( alignAttribute |) ) |) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:326:9: structName ( alignAttribute | ( structBody ( alignAttribute |) ) |)
- {
- pushFollow(FOLLOW_structName_in_structSpecifier1289);
- structName66=structName();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structName.add(structName66.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:327:9: ( alignAttribute | ( structBody ( alignAttribute |) ) |)
- int alt19=3;
- switch ( input.LA(1) ) {
- case ALIGNTOK:
- {
- alt19=1;
- }
- break;
- case LCURL:
- {
- switch ( input.LA(2) ) {
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case RCURL:
- case SHORTTOK:
- case STRUCTTOK:
- case TYPEALIASTOK:
- case TYPEDEFTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt19=2;
- }
- break;
- case SIGNEDTOK:
- {
- int LA19_5 = input.LA(3);
- if ( (LA19_5==BOOLTOK||LA19_5==CHARTOK||(LA19_5 >= COMPLEXTOK && LA19_5 <= CONSTTOK)||LA19_5==DOUBLETOK||LA19_5==ENUMTOK||(LA19_5 >= FLOATINGPOINTTOK && LA19_5 <= FLOATTOK)||(LA19_5 >= IDENTIFIER && LA19_5 <= IMAGINARYTOK)||LA19_5==INTEGERTOK||LA19_5==INTTOK||LA19_5==LONGTOK||LA19_5==POINTER||LA19_5==SHORTTOK||LA19_5==SIGNEDTOK||LA19_5==STRINGTOK||LA19_5==STRUCTTOK||LA19_5==TYPEDEFTOK||(LA19_5 >= UNSIGNEDTOK && LA19_5 <= VOIDTOK)) ) {
- alt19=2;
- }
- else if ( (LA19_5==ASSIGNMENT||LA19_5==RCURL||LA19_5==SEPARATOR) ) {
- alt19=3;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 19, 5, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case STRINGTOK:
- {
- int LA19_6 = input.LA(3);
- if ( (LA19_6==BOOLTOK||LA19_6==CHARTOK||(LA19_6 >= COMPLEXTOK && LA19_6 <= CONSTTOK)||LA19_6==DOUBLETOK||LA19_6==ENUMTOK||(LA19_6 >= FLOATINGPOINTTOK && LA19_6 <= FLOATTOK)||(LA19_6 >= IDENTIFIER && LA19_6 <= IMAGINARYTOK)||LA19_6==INTEGERTOK||(LA19_6 >= INTTOK && LA19_6 <= LCURL)||LA19_6==LONGTOK||LA19_6==POINTER||LA19_6==SHORTTOK||LA19_6==SIGNEDTOK||LA19_6==STRINGTOK||LA19_6==STRUCTTOK||LA19_6==TYPEDEFTOK||(LA19_6 >= UNSIGNEDTOK && LA19_6 <= VOIDTOK)) ) {
- alt19=2;
- }
- else if ( (LA19_6==ASSIGNMENT||LA19_6==RCURL||LA19_6==SEPARATOR) ) {
- alt19=3;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 19, 6, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case IDENTIFIER:
- {
- int LA19_7 = input.LA(3);
- if ( (LA19_7==BOOLTOK||LA19_7==CHARTOK||(LA19_7 >= COMPLEXTOK && LA19_7 <= CONSTTOK)||LA19_7==DOUBLETOK||LA19_7==ENUMTOK||(LA19_7 >= FLOATINGPOINTTOK && LA19_7 <= FLOATTOK)||(LA19_7 >= IDENTIFIER && LA19_7 <= IMAGINARYTOK)||LA19_7==INTEGERTOK||LA19_7==INTTOK||LA19_7==LONGTOK||LA19_7==POINTER||LA19_7==SHORTTOK||LA19_7==SIGNEDTOK||LA19_7==STRINGTOK||LA19_7==STRUCTTOK||LA19_7==TYPEDEFTOK||(LA19_7 >= UNSIGNEDTOK && LA19_7 <= VOIDTOK)) ) {
- alt19=2;
- }
- else if ( (LA19_7==ASSIGNMENT||LA19_7==RCURL||LA19_7==SEPARATOR) ) {
- alt19=3;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 19, 7, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case ALIGNTOK:
- case EVENTTOK:
- case STRING_LITERAL:
- {
- alt19=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 19, 2, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
- }
- break;
- case EOF:
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IDENTIFIER:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case LPAREN:
- case POINTER:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case TERM:
- case TYPEDEFTOK:
- case TYPE_ASSIGNMENT:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt19=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 19, 0, input);
- throw nvae;
- }
- switch (alt19) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:328:11: alignAttribute
- {
- pushFollow(FOLLOW_alignAttribute_in_structSpecifier1311);
- alignAttribute67=alignAttribute();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute67.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:330:11: ( structBody ( alignAttribute |) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:330:11: ( structBody ( alignAttribute |) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:331:13: structBody ( alignAttribute |)
- {
- pushFollow(FOLLOW_structBody_in_structSpecifier1347);
- structBody68=structBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structBody.add(structBody68.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:332:13: ( alignAttribute |)
- int alt18=2;
- int LA18_0 = input.LA(1);
- if ( (LA18_0==ALIGNTOK) ) {
- alt18=1;
- }
- else if ( (LA18_0==EOF||LA18_0==BOOLTOK||LA18_0==CHARTOK||(LA18_0 >= COMPLEXTOK && LA18_0 <= CONSTTOK)||LA18_0==DOUBLETOK||LA18_0==ENUMTOK||(LA18_0 >= FLOATINGPOINTTOK && LA18_0 <= FLOATTOK)||(LA18_0 >= IDENTIFIER && LA18_0 <= IMAGINARYTOK)||LA18_0==INTEGERTOK||(LA18_0 >= INTTOK && LA18_0 <= LCURL)||(LA18_0 >= LONGTOK && LA18_0 <= LPAREN)||LA18_0==POINTER||LA18_0==SHORTTOK||LA18_0==SIGNEDTOK||LA18_0==STRINGTOK||(LA18_0 >= STRUCTTOK && LA18_0 <= TERM)||(LA18_0 >= TYPEDEFTOK && LA18_0 <= TYPE_ASSIGNMENT)||(LA18_0 >= UNSIGNEDTOK && LA18_0 <= VOIDTOK)) ) {
- alt18=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 18, 0, input);
- throw nvae;
- }
-
- switch (alt18) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:333:14: alignAttribute
- {
- pushFollow(FOLLOW_alignAttribute_in_structSpecifier1378);
- alignAttribute69=alignAttribute();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute69.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:336:13:
- {
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:340:9:
- {
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:344:5: ( structBody ( alignAttribute |) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:344:5: ( structBody ( alignAttribute |) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:345:7: structBody ( alignAttribute |)
- {
- pushFollow(FOLLOW_structBody_in_structSpecifier1494);
- structBody70=structBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structBody.add(structBody70.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:346:7: ( alignAttribute |)
- int alt20=2;
- int LA20_0 = input.LA(1);
- if ( (LA20_0==ALIGNTOK) ) {
- alt20=1;
- }
- else if ( (LA20_0==EOF||LA20_0==BOOLTOK||LA20_0==CHARTOK||(LA20_0 >= COMPLEXTOK && LA20_0 <= CONSTTOK)||LA20_0==DOUBLETOK||LA20_0==ENUMTOK||(LA20_0 >= FLOATINGPOINTTOK && LA20_0 <= FLOATTOK)||(LA20_0 >= IDENTIFIER && LA20_0 <= IMAGINARYTOK)||LA20_0==INTEGERTOK||(LA20_0 >= INTTOK && LA20_0 <= LCURL)||(LA20_0 >= LONGTOK && LA20_0 <= LPAREN)||LA20_0==POINTER||LA20_0==SHORTTOK||LA20_0==SIGNEDTOK||LA20_0==STRINGTOK||(LA20_0 >= STRUCTTOK && LA20_0 <= TERM)||(LA20_0 >= TYPEDEFTOK && LA20_0 <= TYPE_ASSIGNMENT)||(LA20_0 >= UNSIGNEDTOK && LA20_0 <= VOIDTOK)) ) {
- alt20=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 20, 0, input);
- throw nvae;
- }
-
- switch (alt20) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:347:9: alignAttribute
- {
- pushFollow(FOLLOW_alignAttribute_in_structSpecifier1512);
- alignAttribute71=alignAttribute();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_alignAttribute.add(alignAttribute71.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:350:7:
- {
- }
- break;
-
- }
-
- }
-
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: alignAttribute, structBody, structName
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 352:5: -> ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:8: ^( STRUCT ( structName )? ( structBody )? ( alignAttribute )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT, "STRUCT"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:17: ( structName )?
- if ( stream_structName.hasNext() ) {
- adaptor.addChild(root_1, stream_structName.nextTree());
- }
- stream_structName.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:29: ( structBody )?
- if ( stream_structBody.hasNext() ) {
- adaptor.addChild(root_1, stream_structBody.nextTree());
- }
- stream_structBody.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:352:41: ( alignAttribute )?
- if ( stream_alignAttribute.hasNext() ) {
- adaptor.addChild(root_1, stream_alignAttribute.nextTree());
- }
- stream_alignAttribute.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structSpecifier"
-
-
- public static class structName_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structName"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:355:1: structName : IDENTIFIER -> ^( STRUCT_NAME IDENTIFIER ) ;
- public final CTFParser.structName_return structName() throws RecognitionException {
- CTFParser.structName_return retval = new CTFParser.structName_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER72=null;
-
- CommonTree IDENTIFIER72_tree=null;
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:3: ( IDENTIFIER -> ^( STRUCT_NAME IDENTIFIER ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:5: IDENTIFIER
- {
- IDENTIFIER72=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_structName1578); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER72);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 356:16: -> ^( STRUCT_NAME IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:356:19: ^( STRUCT_NAME IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRUCT_NAME, "STRUCT_NAME"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structName"
-
-
- public static class structOrVariantDeclarationList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structOrVariantDeclarationList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:359:1: structOrVariantDeclarationList : ( structOrVariantDeclaration )+ ;
- public final CTFParser.structOrVariantDeclarationList_return structOrVariantDeclarationList() throws RecognitionException {
- CTFParser.structOrVariantDeclarationList_return retval = new CTFParser.structOrVariantDeclarationList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope structOrVariantDeclaration73 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:3: ( ( structOrVariantDeclaration )+ )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: ( structOrVariantDeclaration )+
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: ( structOrVariantDeclaration )+
- int cnt22=0;
- loop22:
- while (true) {
- int alt22=2;
- int LA22_0 = input.LA(1);
- if ( (LA22_0==BOOLTOK||LA22_0==CHARTOK||(LA22_0 >= COMPLEXTOK && LA22_0 <= CONSTTOK)||LA22_0==DOUBLETOK||LA22_0==ENUMTOK||(LA22_0 >= FLOATINGPOINTTOK && LA22_0 <= FLOATTOK)||LA22_0==IMAGINARYTOK||LA22_0==INTEGERTOK||LA22_0==INTTOK||LA22_0==LONGTOK||LA22_0==SHORTTOK||LA22_0==SIGNEDTOK||LA22_0==STRINGTOK||LA22_0==STRUCTTOK||LA22_0==TYPEDEFTOK||(LA22_0 >= UNSIGNEDTOK && LA22_0 <= VOIDTOK)) ) {
- alt22=1;
- }
- else if ( (LA22_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt22=1;
- }
- else if ( (LA22_0==TYPEALIASTOK) ) {
- alt22=1;
- }
-
- switch (alt22) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:360:5: structOrVariantDeclaration
- {
- pushFollow(FOLLOW_structOrVariantDeclaration_in_structOrVariantDeclarationList1599);
- structOrVariantDeclaration73=structOrVariantDeclaration();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, structOrVariantDeclaration73.getTree());
-
- }
- break;
-
- default :
- if ( cnt22 >= 1 ) break loop22;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(22, input);
- throw eee;
- }
- cnt22++;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structOrVariantDeclarationList"
-
-
- public static class structOrVariantDeclaration_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structOrVariantDeclaration"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:363:1: structOrVariantDeclaration : ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM ;
- public final CTFParser.structOrVariantDeclaration_return structOrVariantDeclaration() throws RecognitionException {
- CTFParser.structOrVariantDeclaration_return retval = new CTFParser.structOrVariantDeclaration_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token TERM78=null;
- ParserRuleReturnScope declarationSpecifiers74 =null;
- ParserRuleReturnScope declaratorList75 =null;
- ParserRuleReturnScope structOrVariantDeclaratorList76 =null;
- ParserRuleReturnScope typealiasDecl77 =null;
-
- CommonTree TERM78_tree=null;
- RewriteRuleTokenStream stream_TERM=new RewriteRuleTokenStream(adaptor,"token TERM");
- RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
- RewriteRuleSubtreeStream stream_typealiasDecl=new RewriteRuleSubtreeStream(adaptor,"rule typealiasDecl");
- RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
- RewriteRuleSubtreeStream stream_structOrVariantDeclaratorList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclaratorList");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:364:3: ( ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:365:3: ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl ) TERM
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:365:3: ( ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) ) | typealiasDecl -> typealiasDecl )
- int alt24=2;
- int LA24_0 = input.LA(1);
- if ( (LA24_0==BOOLTOK||LA24_0==CHARTOK||(LA24_0 >= COMPLEXTOK && LA24_0 <= CONSTTOK)||LA24_0==DOUBLETOK||LA24_0==ENUMTOK||(LA24_0 >= FLOATINGPOINTTOK && LA24_0 <= FLOATTOK)||LA24_0==IMAGINARYTOK||LA24_0==INTEGERTOK||LA24_0==INTTOK||LA24_0==LONGTOK||LA24_0==SHORTTOK||LA24_0==SIGNEDTOK||LA24_0==STRINGTOK||LA24_0==STRUCTTOK||LA24_0==TYPEDEFTOK||(LA24_0 >= UNSIGNEDTOK && LA24_0 <= VOIDTOK)) ) {
- alt24=1;
- }
- else if ( (LA24_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt24=1;
- }
- else if ( (LA24_0==TYPEALIASTOK) ) {
- alt24=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 24, 0, input);
- throw nvae;
- }
-
- switch (alt24) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:366:7: ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:366:7: ( declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:367:8: declarationSpecifiers ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )
- {
- pushFollow(FOLLOW_declarationSpecifiers_in_structOrVariantDeclaration1632);
- declarationSpecifiers74=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers74.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:368:10: ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )
- int alt23=2;
- alt23 = dfa23.predict(input);
- switch (alt23) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:370:12: {...}? => declaratorList
- {
- if ( !((inTypedef())) ) {
- if (state.backtracking>0) {state.failed=true; return retval;}
- throw new FailedPredicateException(input, "structOrVariantDeclaration", "inTypedef()");
- }
- pushFollow(FOLLOW_declaratorList_in_structOrVariantDeclaration1673);
- declaratorList75=declaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList75.getTree());
- if ( state.backtracking==0 ) {typedefOff();}
- // AST REWRITE
- // elements: declaratorList, declarationSpecifiers
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 371:14: -> ^( TYPEDEF declaratorList declarationSpecifiers )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:371:17: ^( TYPEDEF declaratorList declarationSpecifiers )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_1);
- adaptor.addChild(root_1, stream_declaratorList.nextTree());
- adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:372:14: structOrVariantDeclaratorList
- {
- pushFollow(FOLLOW_structOrVariantDeclaratorList_in_structOrVariantDeclaration1713);
- structOrVariantDeclaratorList76=structOrVariantDeclaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structOrVariantDeclaratorList.add(structOrVariantDeclaratorList76.getTree());
- // AST REWRITE
- // elements: structOrVariantDeclaratorList, declarationSpecifiers
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 373:14: -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:373:17: ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(SV_DECLARATION, "SV_DECLARATION"), root_1);
- adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
- adaptor.addChild(root_1, stream_structOrVariantDeclaratorList.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:378:5: typealiasDecl
- {
- pushFollow(FOLLOW_typealiasDecl_in_structOrVariantDeclaration1772);
- typealiasDecl77=typealiasDecl();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typealiasDecl.add(typealiasDecl77.getTree());
- // AST REWRITE
- // elements: typealiasDecl
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 378:19: -> typealiasDecl
- {
- adaptor.addChild(root_0, stream_typealiasDecl.nextTree());
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
-
- TERM78=(Token)match(input,TERM,FOLLOW_TERM_in_structOrVariantDeclaration1784); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TERM.add(TERM78);
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structOrVariantDeclaration"
-
-
- public static class specifierQualifierList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "specifierQualifierList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:383:1: specifierQualifierList : ( typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) ;
- public final CTFParser.specifierQualifierList_return specifierQualifierList() throws RecognitionException {
- CTFParser.specifierQualifierList_return retval = new CTFParser.specifierQualifierList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope typeQualifier79 =null;
- ParserRuleReturnScope typeSpecifier80 =null;
-
- RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
- RewriteRuleSubtreeStream stream_typeQualifier=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifier");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:3: ( ( typeQualifier | typeSpecifier )+ -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:5: ( typeQualifier | typeSpecifier )+
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:5: ( typeQualifier | typeSpecifier )+
- int cnt25=0;
- loop25:
- while (true) {
- int alt25=3;
- int LA25_0 = input.LA(1);
- if ( (LA25_0==CONSTTOK) ) {
- alt25=1;
- }
- else if ( (LA25_0==BOOLTOK||LA25_0==CHARTOK||LA25_0==COMPLEXTOK||LA25_0==DOUBLETOK||LA25_0==ENUMTOK||(LA25_0 >= FLOATINGPOINTTOK && LA25_0 <= FLOATTOK)||LA25_0==IMAGINARYTOK||LA25_0==INTEGERTOK||LA25_0==INTTOK||LA25_0==LONGTOK||LA25_0==SHORTTOK||LA25_0==SIGNEDTOK||LA25_0==STRINGTOK||LA25_0==STRUCTTOK||(LA25_0 >= UNSIGNEDTOK && LA25_0 <= VOIDTOK)) ) {
- alt25=2;
- }
- else if ( (LA25_0==IDENTIFIER) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt25=2;
- }
-
- switch (alt25) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:6: typeQualifier
- {
- pushFollow(FOLLOW_typeQualifier_in_specifierQualifierList1798);
- typeQualifier79=typeQualifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeQualifier.add(typeQualifier79.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:384:22: typeSpecifier
- {
- pushFollow(FOLLOW_typeSpecifier_in_specifierQualifierList1802);
- typeSpecifier80=typeSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeSpecifier.add(typeSpecifier80.getTree());
- }
- break;
-
- default :
- if ( cnt25 >= 1 ) break loop25;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(25, input);
- throw eee;
- }
- cnt25++;
- }
-
- // AST REWRITE
- // elements: typeQualifier, typeSpecifier
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 385:7: -> ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:10: ^( TYPE_SPECIFIER_LIST ( typeQualifier )* ( typeSpecifier )* )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:32: ( typeQualifier )*
- while ( stream_typeQualifier.hasNext() ) {
- adaptor.addChild(root_1, stream_typeQualifier.nextTree());
- }
- stream_typeQualifier.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:385:47: ( typeSpecifier )*
- while ( stream_typeSpecifier.hasNext() ) {
- adaptor.addChild(root_1, stream_typeSpecifier.nextTree());
- }
- stream_typeSpecifier.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "specifierQualifierList"
-
-
- public static class structOrVariantDeclaratorList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structOrVariantDeclaratorList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:388:1: structOrVariantDeclaratorList : structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ ) ;
- public final CTFParser.structOrVariantDeclaratorList_return structOrVariantDeclaratorList() throws RecognitionException {
- CTFParser.structOrVariantDeclaratorList_return retval = new CTFParser.structOrVariantDeclaratorList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token SEPARATOR82=null;
- ParserRuleReturnScope structOrVariantDeclarator81 =null;
- ParserRuleReturnScope structOrVariantDeclarator83 =null;
-
- CommonTree SEPARATOR82_tree=null;
- RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
- RewriteRuleSubtreeStream stream_structOrVariantDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarator");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:3: ( structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )* -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:5: structOrVariantDeclarator ( SEPARATOR structOrVariantDeclarator )*
- {
- pushFollow(FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1835);
- structOrVariantDeclarator81=structOrVariantDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structOrVariantDeclarator.add(structOrVariantDeclarator81.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:31: ( SEPARATOR structOrVariantDeclarator )*
- loop26:
- while (true) {
- int alt26=2;
- int LA26_0 = input.LA(1);
- if ( (LA26_0==SEPARATOR) ) {
- alt26=1;
- }
-
- switch (alt26) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:389:32: SEPARATOR structOrVariantDeclarator
- {
- SEPARATOR82=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_structOrVariantDeclaratorList1838); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR82);
-
- pushFollow(FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1840);
- structOrVariantDeclarator83=structOrVariantDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structOrVariantDeclarator.add(structOrVariantDeclarator83.getTree());
- }
- break;
-
- default :
- break loop26;
- }
- }
-
- // AST REWRITE
- // elements: structOrVariantDeclarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 390:7: -> ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:390:10: ^( TYPE_DECLARATOR_LIST ( structOrVariantDeclarator )+ )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR_LIST, "TYPE_DECLARATOR_LIST"), root_1);
- if ( !(stream_structOrVariantDeclarator.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_structOrVariantDeclarator.hasNext() ) {
- adaptor.addChild(root_1, stream_structOrVariantDeclarator.nextTree());
- }
- stream_structOrVariantDeclarator.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structOrVariantDeclaratorList"
-
-
- public static class structOrVariantDeclarator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "structOrVariantDeclarator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:393:1: structOrVariantDeclarator : ( declarator ( COLON numberLiteral )? ) -> declarator ;
- public final CTFParser.structOrVariantDeclarator_return structOrVariantDeclarator() throws RecognitionException {
- CTFParser.structOrVariantDeclarator_return retval = new CTFParser.structOrVariantDeclarator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token COLON85=null;
- ParserRuleReturnScope declarator84 =null;
- ParserRuleReturnScope numberLiteral86 =null;
-
- CommonTree COLON85_tree=null;
- RewriteRuleTokenStream stream_COLON=new RewriteRuleTokenStream(adaptor,"token COLON");
- RewriteRuleSubtreeStream stream_declarator=new RewriteRuleSubtreeStream(adaptor,"rule declarator");
- RewriteRuleSubtreeStream stream_numberLiteral=new RewriteRuleSubtreeStream(adaptor,"rule numberLiteral");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:394:3: ( ( declarator ( COLON numberLiteral )? ) -> declarator )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:5: ( declarator ( COLON numberLiteral )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:5: ( declarator ( COLON numberLiteral )? )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:6: declarator ( COLON numberLiteral )?
- {
- pushFollow(FOLLOW_declarator_in_structOrVariantDeclarator1879);
- declarator84=declarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarator.add(declarator84.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:17: ( COLON numberLiteral )?
- int alt27=2;
- int LA27_0 = input.LA(1);
- if ( (LA27_0==COLON) ) {
- alt27=1;
- }
- switch (alt27) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:396:18: COLON numberLiteral
- {
- COLON85=(Token)match(input,COLON,FOLLOW_COLON_in_structOrVariantDeclarator1882); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_COLON.add(COLON85);
-
- pushFollow(FOLLOW_numberLiteral_in_structOrVariantDeclarator1884);
- numberLiteral86=numberLiteral();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_numberLiteral.add(numberLiteral86.getTree());
- }
- break;
-
- }
-
- }
-
- // AST REWRITE
- // elements: declarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 396:41: -> declarator
- {
- adaptor.addChild(root_0, stream_declarator.nextTree());
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "structOrVariantDeclarator"
-
-
- public static class variantSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "variantSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:400:1: variantSpecifier : VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody ) -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? ) ;
- public final CTFParser.variantSpecifier_return variantSpecifier() throws RecognitionException {
- CTFParser.variantSpecifier_return retval = new CTFParser.variantSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token VARIANTTOK87=null;
- ParserRuleReturnScope variantName88 =null;
- ParserRuleReturnScope variantTag89 =null;
- ParserRuleReturnScope variantBody90 =null;
- ParserRuleReturnScope variantBody91 =null;
- ParserRuleReturnScope variantTag92 =null;
- ParserRuleReturnScope variantBody93 =null;
- ParserRuleReturnScope variantBody94 =null;
-
- CommonTree VARIANTTOK87_tree=null;
- RewriteRuleTokenStream stream_VARIANTTOK=new RewriteRuleTokenStream(adaptor,"token VARIANTTOK");
- RewriteRuleSubtreeStream stream_variantName=new RewriteRuleSubtreeStream(adaptor,"rule variantName");
- RewriteRuleSubtreeStream stream_variantTag=new RewriteRuleSubtreeStream(adaptor,"rule variantTag");
- RewriteRuleSubtreeStream stream_variantBody=new RewriteRuleSubtreeStream(adaptor,"rule variantBody");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:401:3: ( VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody ) -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:401:5: VARIANTTOK ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody )
- {
- VARIANTTOK87=(Token)match(input,VARIANTTOK,FOLLOW_VARIANTTOK_in_variantSpecifier1908); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_VARIANTTOK.add(VARIANTTOK87);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:402:3: ( ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) ) | ( variantTag variantBody ) | variantBody )
- int alt30=3;
- switch ( input.LA(1) ) {
- case IDENTIFIER:
- {
- alt30=1;
- }
- break;
- case LT:
- {
- alt30=2;
- }
- break;
- case LCURL:
- {
- alt30=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 30, 0, input);
- throw nvae;
- }
- switch (alt30) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:403:5: ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:403:5: ( variantName ( ( variantTag ( variantBody |) ) | variantBody ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:404:7: variantName ( ( variantTag ( variantBody |) ) | variantBody )
- {
- pushFollow(FOLLOW_variantName_in_variantSpecifier1926);
- variantName88=variantName();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantName.add(variantName88.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:405:7: ( ( variantTag ( variantBody |) ) | variantBody )
- int alt29=2;
- int LA29_0 = input.LA(1);
- if ( (LA29_0==LT) ) {
- alt29=1;
- }
- else if ( (LA29_0==LCURL) ) {
- alt29=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 29, 0, input);
- throw nvae;
- }
-
- switch (alt29) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:406:9: ( variantTag ( variantBody |) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:406:9: ( variantTag ( variantBody |) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:407:11: variantTag ( variantBody |)
- {
- pushFollow(FOLLOW_variantTag_in_variantSpecifier1956);
- variantTag89=variantTag();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantTag.add(variantTag89.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:408:11: ( variantBody |)
- int alt28=2;
- int LA28_0 = input.LA(1);
- if ( (LA28_0==LCURL) ) {
- switch ( input.LA(2) ) {
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case SHORTTOK:
- case STRUCTTOK:
- case TYPEALIASTOK:
- case TYPEDEFTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt28=1;
- }
- break;
- case SIGNEDTOK:
- {
- int LA28_4 = input.LA(3);
- if ( (LA28_4==BOOLTOK||LA28_4==CHARTOK||(LA28_4 >= COMPLEXTOK && LA28_4 <= CONSTTOK)||LA28_4==DOUBLETOK||LA28_4==ENUMTOK||(LA28_4 >= FLOATINGPOINTTOK && LA28_4 <= FLOATTOK)||(LA28_4 >= IDENTIFIER && LA28_4 <= IMAGINARYTOK)||LA28_4==INTEGERTOK||LA28_4==INTTOK||LA28_4==LONGTOK||LA28_4==POINTER||LA28_4==SHORTTOK||LA28_4==SIGNEDTOK||LA28_4==STRINGTOK||LA28_4==STRUCTTOK||LA28_4==TYPEDEFTOK||(LA28_4 >= UNSIGNEDTOK && LA28_4 <= VOIDTOK)) ) {
- alt28=1;
- }
- else if ( (LA28_4==ASSIGNMENT||LA28_4==RCURL||LA28_4==SEPARATOR) ) {
- alt28=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 28, 4, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case STRINGTOK:
- {
- int LA28_5 = input.LA(3);
- if ( (LA28_5==BOOLTOK||LA28_5==CHARTOK||(LA28_5 >= COMPLEXTOK && LA28_5 <= CONSTTOK)||LA28_5==DOUBLETOK||LA28_5==ENUMTOK||(LA28_5 >= FLOATINGPOINTTOK && LA28_5 <= FLOATTOK)||(LA28_5 >= IDENTIFIER && LA28_5 <= IMAGINARYTOK)||LA28_5==INTEGERTOK||(LA28_5 >= INTTOK && LA28_5 <= LCURL)||LA28_5==LONGTOK||LA28_5==POINTER||LA28_5==SHORTTOK||LA28_5==SIGNEDTOK||LA28_5==STRINGTOK||LA28_5==STRUCTTOK||LA28_5==TYPEDEFTOK||(LA28_5 >= UNSIGNEDTOK && LA28_5 <= VOIDTOK)) ) {
- alt28=1;
- }
- else if ( (LA28_5==ASSIGNMENT||LA28_5==RCURL||LA28_5==SEPARATOR) ) {
- alt28=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 28, 5, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case IDENTIFIER:
- {
- int LA28_6 = input.LA(3);
- if ( (LA28_6==BOOLTOK||LA28_6==CHARTOK||(LA28_6 >= COMPLEXTOK && LA28_6 <= CONSTTOK)||LA28_6==DOUBLETOK||LA28_6==ENUMTOK||(LA28_6 >= FLOATINGPOINTTOK && LA28_6 <= FLOATTOK)||(LA28_6 >= IDENTIFIER && LA28_6 <= IMAGINARYTOK)||LA28_6==INTEGERTOK||LA28_6==INTTOK||LA28_6==LONGTOK||LA28_6==POINTER||LA28_6==SHORTTOK||LA28_6==SIGNEDTOK||LA28_6==STRINGTOK||LA28_6==STRUCTTOK||LA28_6==TYPEDEFTOK||(LA28_6 >= UNSIGNEDTOK && LA28_6 <= VOIDTOK)) ) {
- alt28=1;
- }
- else if ( (LA28_6==ASSIGNMENT||LA28_6==RCURL||LA28_6==SEPARATOR) ) {
- alt28=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
- input.consume();
- }
- NoViableAltException nvae =
- new NoViableAltException("", 28, 6, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case ALIGNTOK:
- case EVENTTOK:
- case STRING_LITERAL:
- {
- alt28=2;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 28, 1, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
- }
- else if ( (LA28_0==EOF||LA28_0==BOOLTOK||LA28_0==CHARTOK||(LA28_0 >= COMPLEXTOK && LA28_0 <= CONSTTOK)||LA28_0==DOUBLETOK||LA28_0==ENUMTOK||(LA28_0 >= FLOATINGPOINTTOK && LA28_0 <= FLOATTOK)||(LA28_0 >= IDENTIFIER && LA28_0 <= IMAGINARYTOK)||LA28_0==INTEGERTOK||LA28_0==INTTOK||(LA28_0 >= LONGTOK && LA28_0 <= LPAREN)||LA28_0==POINTER||LA28_0==SHORTTOK||LA28_0==SIGNEDTOK||LA28_0==STRINGTOK||(LA28_0 >= STRUCTTOK && LA28_0 <= TERM)||(LA28_0 >= TYPEDEFTOK && LA28_0 <= TYPE_ASSIGNMENT)||(LA28_0 >= UNSIGNEDTOK && LA28_0 <= VOIDTOK)) ) {
- alt28=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 28, 0, input);
- throw nvae;
- }
-
- switch (alt28) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:409:13: variantBody
- {
- pushFollow(FOLLOW_variantBody_in_variantSpecifier1982);
- variantBody90=variantBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantBody.add(variantBody90.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:412:11:
- {
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:415:9: variantBody
- {
- pushFollow(FOLLOW_variantBody_in_variantSpecifier2050);
- variantBody91=variantBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantBody.add(variantBody91.getTree());
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:5: ( variantTag variantBody )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:5: ( variantTag variantBody )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:418:6: variantTag variantBody
- {
- pushFollow(FOLLOW_variantTag_in_variantSpecifier2071);
- variantTag92=variantTag();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantTag.add(variantTag92.getTree());
- pushFollow(FOLLOW_variantBody_in_variantSpecifier2073);
- variantBody93=variantBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantBody.add(variantBody93.getTree());
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:419:5: variantBody
- {
- pushFollow(FOLLOW_variantBody_in_variantSpecifier2080);
- variantBody94=variantBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_variantBody.add(variantBody94.getTree());
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: variantBody, variantName, variantTag
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 420:5: -> ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:8: ^( VARIANT ( variantName )? ( variantTag )? ( variantBody )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT, "VARIANT"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:18: ( variantName )?
- if ( stream_variantName.hasNext() ) {
- adaptor.addChild(root_1, stream_variantName.nextTree());
- }
- stream_variantName.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:31: ( variantTag )?
- if ( stream_variantTag.hasNext() ) {
- adaptor.addChild(root_1, stream_variantTag.nextTree());
- }
- stream_variantTag.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:420:43: ( variantBody )?
- if ( stream_variantBody.hasNext() ) {
- adaptor.addChild(root_1, stream_variantBody.nextTree());
- }
- stream_variantBody.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "variantSpecifier"
-
-
- public static class variantName_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "variantName"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:423:1: variantName : IDENTIFIER -> ^( VARIANT_NAME IDENTIFIER ) ;
- public final CTFParser.variantName_return variantName() throws RecognitionException {
- CTFParser.variantName_return retval = new CTFParser.variantName_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER95=null;
-
- CommonTree IDENTIFIER95_tree=null;
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:3: ( IDENTIFIER -> ^( VARIANT_NAME IDENTIFIER ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:5: IDENTIFIER
- {
- IDENTIFIER95=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_variantName2112); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER95);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 424:16: -> ^( VARIANT_NAME IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:424:19: ^( VARIANT_NAME IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_NAME, "VARIANT_NAME"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "variantName"
-
-
- public static class variantBody_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "variantBody"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:427:1: variantBody : LCURL structOrVariantDeclarationList RCURL -> ^( VARIANT_BODY structOrVariantDeclarationList ) ;
- public final CTFParser.variantBody_return variantBody() throws RecognitionException {
- Symbols_stack.push(new Symbols_scope());
-
- CTFParser.variantBody_return retval = new CTFParser.variantBody_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token LCURL96=null;
- Token RCURL98=null;
- ParserRuleReturnScope structOrVariantDeclarationList97 =null;
-
- CommonTree LCURL96_tree=null;
- CommonTree RCURL98_tree=null;
- RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
- RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
- RewriteRuleSubtreeStream stream_structOrVariantDeclarationList=new RewriteRuleSubtreeStream(adaptor,"rule structOrVariantDeclarationList");
-
-
- Symbols_stack.peek().types = new HashSet<String>();
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:432:3: ( LCURL structOrVariantDeclarationList RCURL -> ^( VARIANT_BODY structOrVariantDeclarationList ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:432:5: LCURL structOrVariantDeclarationList RCURL
- {
- LCURL96=(Token)match(input,LCURL,FOLLOW_LCURL_in_variantBody2143); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LCURL.add(LCURL96);
-
- pushFollow(FOLLOW_structOrVariantDeclarationList_in_variantBody2145);
- structOrVariantDeclarationList97=structOrVariantDeclarationList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_structOrVariantDeclarationList.add(structOrVariantDeclarationList97.getTree());
- RCURL98=(Token)match(input,RCURL,FOLLOW_RCURL_in_variantBody2147); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_RCURL.add(RCURL98);
-
- // AST REWRITE
- // elements: structOrVariantDeclarationList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 433:7: -> ^( VARIANT_BODY structOrVariantDeclarationList )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:433:10: ^( VARIANT_BODY structOrVariantDeclarationList )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_BODY, "VARIANT_BODY"), root_1);
- adaptor.addChild(root_1, stream_structOrVariantDeclarationList.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- Symbols_stack.pop();
-
- }
- return retval;
- }
- // $ANTLR end "variantBody"
-
-
- public static class variantTag_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "variantTag"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:436:1: variantTag : LT IDENTIFIER GT -> ^( VARIANT_TAG IDENTIFIER ) ;
- public final CTFParser.variantTag_return variantTag() throws RecognitionException {
- CTFParser.variantTag_return retval = new CTFParser.variantTag_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token LT99=null;
- Token IDENTIFIER100=null;
- Token GT101=null;
-
- CommonTree LT99_tree=null;
- CommonTree IDENTIFIER100_tree=null;
- CommonTree GT101_tree=null;
- RewriteRuleTokenStream stream_GT=new RewriteRuleTokenStream(adaptor,"token GT");
- RewriteRuleTokenStream stream_LT=new RewriteRuleTokenStream(adaptor,"token LT");
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:3: ( LT IDENTIFIER GT -> ^( VARIANT_TAG IDENTIFIER ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:5: LT IDENTIFIER GT
- {
- LT99=(Token)match(input,LT,FOLLOW_LT_in_variantTag2174); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LT.add(LT99);
-
- IDENTIFIER100=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_variantTag2176); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER100);
-
- GT101=(Token)match(input,GT,FOLLOW_GT_in_variantTag2178); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_GT.add(GT101);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 437:22: -> ^( VARIANT_TAG IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:437:25: ^( VARIANT_TAG IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(VARIANT_TAG, "VARIANT_TAG"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "variantTag"
-
-
- public static class enumSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:440:1: enumSpecifier : ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) ) -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? ) ;
- public final CTFParser.enumSpecifier_return enumSpecifier() throws RecognitionException {
- CTFParser.enumSpecifier_return retval = new CTFParser.enumSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token ENUMTOK102=null;
- ParserRuleReturnScope enumName103 =null;
- ParserRuleReturnScope enumContainerType104 =null;
- ParserRuleReturnScope enumBody105 =null;
- ParserRuleReturnScope enumBody106 =null;
- ParserRuleReturnScope enumContainerType107 =null;
- ParserRuleReturnScope enumBody108 =null;
- ParserRuleReturnScope enumBody109 =null;
-
- CommonTree ENUMTOK102_tree=null;
- RewriteRuleTokenStream stream_ENUMTOK=new RewriteRuleTokenStream(adaptor,"token ENUMTOK");
- RewriteRuleSubtreeStream stream_enumName=new RewriteRuleSubtreeStream(adaptor,"rule enumName");
- RewriteRuleSubtreeStream stream_enumContainerType=new RewriteRuleSubtreeStream(adaptor,"rule enumContainerType");
- RewriteRuleSubtreeStream stream_enumBody=new RewriteRuleSubtreeStream(adaptor,"rule enumBody");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:441:3: ( ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) ) -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:441:5: ENUMTOK ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) )
- {
- ENUMTOK102=(Token)match(input,ENUMTOK,FOLLOW_ENUMTOK_in_enumSpecifier2199); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ENUMTOK.add(ENUMTOK102);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:442:5: ( ( enumName ( enumContainerType enumBody | enumBody |) ) | ( enumContainerType enumBody | enumBody ) )
- int alt33=2;
- int LA33_0 = input.LA(1);
- if ( (LA33_0==IDENTIFIER) ) {
- alt33=1;
- }
- else if ( (LA33_0==COLON||LA33_0==LCURL) ) {
- alt33=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 33, 0, input);
- throw nvae;
- }
-
- switch (alt33) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:444:9: ( enumName ( enumContainerType enumBody | enumBody |) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:444:9: ( enumName ( enumContainerType enumBody | enumBody |) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:445:13: enumName ( enumContainerType enumBody | enumBody |)
- {
- pushFollow(FOLLOW_enumName_in_enumSpecifier2238);
- enumName103=enumName();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumName.add(enumName103.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:446:13: ( enumContainerType enumBody | enumBody |)
- int alt31=3;
- switch ( input.LA(1) ) {
- case COLON:
- {
- alt31=1;
- }
- break;
- case LCURL:
- {
- alt31=2;
- }
- break;
- case EOF:
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IDENTIFIER:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case LPAREN:
- case POINTER:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case TERM:
- case TYPEDEFTOK:
- case TYPE_ASSIGNMENT:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt31=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 31, 0, input);
- throw nvae;
- }
- switch (alt31) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:447:17: enumContainerType enumBody
- {
- pushFollow(FOLLOW_enumContainerType_in_enumSpecifier2270);
- enumContainerType104=enumContainerType();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumContainerType.add(enumContainerType104.getTree());
- pushFollow(FOLLOW_enumBody_in_enumSpecifier2272);
- enumBody105=enumBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumBody.add(enumBody105.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:449:17: enumBody
- {
- pushFollow(FOLLOW_enumBody_in_enumSpecifier2302);
- enumBody106=enumBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumBody.add(enumBody106.getTree());
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:452:13:
- {
- }
- break;
-
- }
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:456:9: ( enumContainerType enumBody | enumBody )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:456:9: ( enumContainerType enumBody | enumBody )
- int alt32=2;
- int LA32_0 = input.LA(1);
- if ( (LA32_0==COLON) ) {
- alt32=1;
- }
- else if ( (LA32_0==LCURL) ) {
- alt32=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 32, 0, input);
- throw nvae;
- }
-
- switch (alt32) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:457:13: enumContainerType enumBody
- {
- pushFollow(FOLLOW_enumContainerType_in_enumSpecifier2394);
- enumContainerType107=enumContainerType();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumContainerType.add(enumContainerType107.getTree());
- pushFollow(FOLLOW_enumBody_in_enumSpecifier2396);
- enumBody108=enumBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumBody.add(enumBody108.getTree());
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:459:13: enumBody
- {
- pushFollow(FOLLOW_enumBody_in_enumSpecifier2420);
- enumBody109=enumBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumBody.add(enumBody109.getTree());
- }
- break;
-
- }
-
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: enumContainerType, enumName, enumBody
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 461:7: -> ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:10: ^( ENUM ( enumName )? ( enumContainerType )? ( enumBody )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM, "ENUM"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:17: ( enumName )?
- if ( stream_enumName.hasNext() ) {
- adaptor.addChild(root_1, stream_enumName.nextTree());
- }
- stream_enumName.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:27: ( enumContainerType )?
- if ( stream_enumContainerType.hasNext() ) {
- adaptor.addChild(root_1, stream_enumContainerType.nextTree());
- }
- stream_enumContainerType.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:461:46: ( enumBody )?
- if ( stream_enumBody.hasNext() ) {
- adaptor.addChild(root_1, stream_enumBody.nextTree());
- }
- stream_enumBody.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumSpecifier"
-
-
- public static class enumName_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumName"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:464:1: enumName : IDENTIFIER -> ^( ENUM_NAME IDENTIFIER ) ;
- public final CTFParser.enumName_return enumName() throws RecognitionException {
- CTFParser.enumName_return retval = new CTFParser.enumName_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER110=null;
-
- CommonTree IDENTIFIER110_tree=null;
- RewriteRuleTokenStream stream_IDENTIFIER=new RewriteRuleTokenStream(adaptor,"token IDENTIFIER");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:3: ( IDENTIFIER -> ^( ENUM_NAME IDENTIFIER ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:5: IDENTIFIER
- {
- IDENTIFIER110=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_enumName2464); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_IDENTIFIER.add(IDENTIFIER110);
-
- // AST REWRITE
- // elements: IDENTIFIER
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 465:16: -> ^( ENUM_NAME IDENTIFIER )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:465:19: ^( ENUM_NAME IDENTIFIER )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_NAME, "ENUM_NAME"), root_1);
- adaptor.addChild(root_1, stream_IDENTIFIER.nextNode());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumName"
-
-
- public static class enumBody_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumBody"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:468:1: enumBody : LCURL enumeratorList ( SEPARATOR )? RCURL -> ^( ENUM_BODY enumeratorList ) ;
- public final CTFParser.enumBody_return enumBody() throws RecognitionException {
- CTFParser.enumBody_return retval = new CTFParser.enumBody_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token LCURL111=null;
- Token SEPARATOR113=null;
- Token RCURL114=null;
- ParserRuleReturnScope enumeratorList112 =null;
-
- CommonTree LCURL111_tree=null;
- CommonTree SEPARATOR113_tree=null;
- CommonTree RCURL114_tree=null;
- RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
- RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
- RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
- RewriteRuleSubtreeStream stream_enumeratorList=new RewriteRuleSubtreeStream(adaptor,"rule enumeratorList");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:3: ( LCURL enumeratorList ( SEPARATOR )? RCURL -> ^( ENUM_BODY enumeratorList ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:5: LCURL enumeratorList ( SEPARATOR )? RCURL
- {
- LCURL111=(Token)match(input,LCURL,FOLLOW_LCURL_in_enumBody2485); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LCURL.add(LCURL111);
-
- pushFollow(FOLLOW_enumeratorList_in_enumBody2487);
- enumeratorList112=enumeratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumeratorList.add(enumeratorList112.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:26: ( SEPARATOR )?
- int alt34=2;
- int LA34_0 = input.LA(1);
- if ( (LA34_0==SEPARATOR) ) {
- alt34=1;
- }
- switch (alt34) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:26: SEPARATOR
- {
- SEPARATOR113=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_enumBody2489); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR113);
-
- }
- break;
-
- }
-
- RCURL114=(Token)match(input,RCURL,FOLLOW_RCURL_in_enumBody2492); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_RCURL.add(RCURL114);
-
- // AST REWRITE
- // elements: enumeratorList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 469:43: -> ^( ENUM_BODY enumeratorList )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:469:46: ^( ENUM_BODY enumeratorList )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_BODY, "ENUM_BODY"), root_1);
- adaptor.addChild(root_1, stream_enumeratorList.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumBody"
-
-
- public static class enumContainerType_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumContainerType"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:472:1: enumContainerType : COLON declarationSpecifiers -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers ) ;
- public final CTFParser.enumContainerType_return enumContainerType() throws RecognitionException {
- CTFParser.enumContainerType_return retval = new CTFParser.enumContainerType_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token COLON115=null;
- ParserRuleReturnScope declarationSpecifiers116 =null;
-
- CommonTree COLON115_tree=null;
- RewriteRuleTokenStream stream_COLON=new RewriteRuleTokenStream(adaptor,"token COLON");
- RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:3: ( COLON declarationSpecifiers -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:5: COLON declarationSpecifiers
- {
- COLON115=(Token)match(input,COLON,FOLLOW_COLON_in_enumContainerType2513); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_COLON.add(COLON115);
-
- pushFollow(FOLLOW_declarationSpecifiers_in_enumContainerType2515);
- declarationSpecifiers116=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers116.getTree());
- // AST REWRITE
- // elements: declarationSpecifiers
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 473:33: -> ^( ENUM_CONTAINER_TYPE declarationSpecifiers )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:473:36: ^( ENUM_CONTAINER_TYPE declarationSpecifiers )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_CONTAINER_TYPE, "ENUM_CONTAINER_TYPE"), root_1);
- adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumContainerType"
-
-
- public static class enumeratorList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumeratorList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:476:1: enumeratorList : enumerator ( SEPARATOR enumerator )* -> ( ^( ENUM_ENUMERATOR enumerator ) )+ ;
- public final CTFParser.enumeratorList_return enumeratorList() throws RecognitionException {
- CTFParser.enumeratorList_return retval = new CTFParser.enumeratorList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token SEPARATOR118=null;
- ParserRuleReturnScope enumerator117 =null;
- ParserRuleReturnScope enumerator119 =null;
-
- CommonTree SEPARATOR118_tree=null;
- RewriteRuleTokenStream stream_SEPARATOR=new RewriteRuleTokenStream(adaptor,"token SEPARATOR");
- RewriteRuleSubtreeStream stream_enumerator=new RewriteRuleSubtreeStream(adaptor,"rule enumerator");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:3: ( enumerator ( SEPARATOR enumerator )* -> ( ^( ENUM_ENUMERATOR enumerator ) )+ )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:5: enumerator ( SEPARATOR enumerator )*
- {
- pushFollow(FOLLOW_enumerator_in_enumeratorList2536);
- enumerator117=enumerator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumerator.add(enumerator117.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:16: ( SEPARATOR enumerator )*
- loop35:
- while (true) {
- int alt35=2;
- int LA35_0 = input.LA(1);
- if ( (LA35_0==SEPARATOR) ) {
- int LA35_1 = input.LA(2);
- if ( (LA35_1==ALIGNTOK||LA35_1==EVENTTOK||LA35_1==IDENTIFIER||LA35_1==SIGNEDTOK||LA35_1==STRINGTOK||LA35_1==STRING_LITERAL) ) {
- alt35=1;
- }
-
- }
-
- switch (alt35) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:17: SEPARATOR enumerator
- {
- SEPARATOR118=(Token)match(input,SEPARATOR,FOLLOW_SEPARATOR_in_enumeratorList2539); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_SEPARATOR.add(SEPARATOR118);
-
- pushFollow(FOLLOW_enumerator_in_enumeratorList2541);
- enumerator119=enumerator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_enumerator.add(enumerator119.getTree());
- }
- break;
-
- default :
- break loop35;
- }
- }
-
- // AST REWRITE
- // elements: enumerator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 477:40: -> ( ^( ENUM_ENUMERATOR enumerator ) )+
- {
- if ( !(stream_enumerator.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_enumerator.hasNext() ) {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:477:44: ^( ENUM_ENUMERATOR enumerator )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_ENUMERATOR, "ENUM_ENUMERATOR"), root_1);
- adaptor.addChild(root_1, stream_enumerator.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
- stream_enumerator.reset();
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumeratorList"
-
-
- public static class enumerator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumerator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:480:1: enumerator : enumConstant ( enumeratorValue )? ;
- public final CTFParser.enumerator_return enumerator() throws RecognitionException {
- CTFParser.enumerator_return retval = new CTFParser.enumerator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope enumConstant120 =null;
- ParserRuleReturnScope enumeratorValue121 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:3: ( enumConstant ( enumeratorValue )? )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:5: enumConstant ( enumeratorValue )?
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_enumConstant_in_enumerator2567);
- enumConstant120=enumConstant();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, enumConstant120.getTree());
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:18: ( enumeratorValue )?
- int alt36=2;
- int LA36_0 = input.LA(1);
- if ( (LA36_0==ASSIGNMENT) ) {
- alt36=1;
- }
- switch (alt36) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:481:18: enumeratorValue
- {
- pushFollow(FOLLOW_enumeratorValue_in_enumerator2569);
- enumeratorValue121=enumeratorValue();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, enumeratorValue121.getTree());
-
- }
- break;
-
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumerator"
-
-
- public static class enumeratorValue_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "enumeratorValue"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:484:1: enumeratorValue : ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) ) ;
- public final CTFParser.enumeratorValue_return enumeratorValue() throws RecognitionException {
- CTFParser.enumeratorValue_return retval = new CTFParser.enumeratorValue_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token ASSIGNMENT122=null;
- Token ELIPSES123=null;
- ParserRuleReturnScope e1 =null;
- ParserRuleReturnScope e2 =null;
-
- CommonTree ASSIGNMENT122_tree=null;
- CommonTree ELIPSES123_tree=null;
- RewriteRuleTokenStream stream_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token ASSIGNMENT");
- RewriteRuleTokenStream stream_ELIPSES=new RewriteRuleTokenStream(adaptor,"token ELIPSES");
- RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:485:3: ( ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:485:5: ASSIGNMENT e1= unaryExpression ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) )
- {
- ASSIGNMENT122=(Token)match(input,ASSIGNMENT,FOLLOW_ASSIGNMENT_in_enumeratorValue2583); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ASSIGNMENT.add(ASSIGNMENT122);
-
- pushFollow(FOLLOW_unaryExpression_in_enumeratorValue2587);
- e1=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_unaryExpression.add(e1.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:486:7: ( -> ^( ENUM_VALUE $e1) | ELIPSES e2= unaryExpression -> ^( ENUM_VALUE_RANGE $e1 $e2) )
- int alt37=2;
- int LA37_0 = input.LA(1);
- if ( (LA37_0==RCURL||LA37_0==SEPARATOR) ) {
- alt37=1;
- }
- else if ( (LA37_0==ELIPSES) ) {
- alt37=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 37, 0, input);
- throw nvae;
- }
-
- switch (alt37) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:487:11:
- {
- // AST REWRITE
- // elements: e1
- // token labels:
- // rule labels: retval, e1
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
- RewriteRuleSubtreeStream stream_e1=new RewriteRuleSubtreeStream(adaptor,"rule e1",e1!=null?e1.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 487:11: -> ^( ENUM_VALUE $e1)
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:487:14: ^( ENUM_VALUE $e1)
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_VALUE, "ENUM_VALUE"), root_1);
- adaptor.addChild(root_1, stream_e1.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:488:9: ELIPSES e2= unaryExpression
- {
- ELIPSES123=(Token)match(input,ELIPSES,FOLLOW_ELIPSES_in_enumeratorValue2626); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ELIPSES.add(ELIPSES123);
-
- pushFollow(FOLLOW_unaryExpression_in_enumeratorValue2630);
- e2=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_unaryExpression.add(e2.getTree());
- // AST REWRITE
- // elements: e1, e2
- // token labels:
- // rule labels: retval, e1, e2
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
- RewriteRuleSubtreeStream stream_e1=new RewriteRuleSubtreeStream(adaptor,"rule e1",e1!=null?e1.getTree():null);
- RewriteRuleSubtreeStream stream_e2=new RewriteRuleSubtreeStream(adaptor,"rule e2",e2!=null?e2.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 489:11: -> ^( ENUM_VALUE_RANGE $e1 $e2)
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:489:14: ^( ENUM_VALUE_RANGE $e1 $e2)
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(ENUM_VALUE_RANGE, "ENUM_VALUE_RANGE"), root_1);
- adaptor.addChild(root_1, stream_e1.nextTree());
- adaptor.addChild(root_1, stream_e2.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "enumeratorValue"
-
-
- public static class declarator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "declarator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:493:1: declarator : ( pointer )* directDeclarator -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator ) ;
- public final CTFParser.declarator_return declarator() throws RecognitionException {
- CTFParser.declarator_return retval = new CTFParser.declarator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope pointer124 =null;
- ParserRuleReturnScope directDeclarator125 =null;
-
- RewriteRuleSubtreeStream stream_directDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule directDeclarator");
- RewriteRuleSubtreeStream stream_pointer=new RewriteRuleSubtreeStream(adaptor,"rule pointer");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:3: ( ( pointer )* directDeclarator -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: ( pointer )* directDeclarator
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: ( pointer )*
- loop38:
- while (true) {
- int alt38=2;
- int LA38_0 = input.LA(1);
- if ( (LA38_0==POINTER) ) {
- alt38=1;
- }
-
- switch (alt38) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:494:5: pointer
- {
- pushFollow(FOLLOW_pointer_in_declarator2673);
- pointer124=pointer();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_pointer.add(pointer124.getTree());
- }
- break;
-
- default :
- break loop38;
- }
- }
-
- pushFollow(FOLLOW_directDeclarator_in_declarator2676);
- directDeclarator125=directDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_directDeclarator.add(directDeclarator125.getTree());
- // AST REWRITE
- // elements: directDeclarator, pointer
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 495:7: -> ^( TYPE_DECLARATOR ( pointer )* directDeclarator )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:495:10: ^( TYPE_DECLARATOR ( pointer )* directDeclarator )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:495:28: ( pointer )*
- while ( stream_pointer.hasNext() ) {
- adaptor.addChild(root_1, stream_pointer.nextTree());
- }
- stream_pointer.reset();
-
- adaptor.addChild(root_1, stream_directDeclarator.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "declarator"
-
-
- public static class directDeclarator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "directDeclarator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:498:1: directDeclarator : ( IDENTIFIER ) ( directDeclaratorSuffix )* ;
- public final CTFParser.directDeclarator_return directDeclarator() throws RecognitionException {
- CTFParser.directDeclarator_return retval = new CTFParser.directDeclarator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER126=null;
- ParserRuleReturnScope directDeclaratorSuffix127 =null;
-
- CommonTree IDENTIFIER126_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:3: ( ( IDENTIFIER ) ( directDeclaratorSuffix )* )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:5: ( IDENTIFIER ) ( directDeclaratorSuffix )*
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:499:5: ( IDENTIFIER )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:500:7: IDENTIFIER
- {
- IDENTIFIER126=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_directDeclarator2714); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- IDENTIFIER126_tree = (CommonTree)adaptor.create(IDENTIFIER126);
- adaptor.addChild(root_0, IDENTIFIER126_tree);
- }
-
- if ( state.backtracking==0 ) { if (inTypedef()) addTypeName((IDENTIFIER126!=null?IDENTIFIER126.getText():null)); }
- if ( state.backtracking==0 ) { debug_print((IDENTIFIER126!=null?IDENTIFIER126.getText():null)); }
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:505:5: ( directDeclaratorSuffix )*
- loop39:
- while (true) {
- int alt39=2;
- int LA39_0 = input.LA(1);
- if ( (LA39_0==OPENBRAC) ) {
- alt39=1;
- }
-
- switch (alt39) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:505:5: directDeclaratorSuffix
- {
- pushFollow(FOLLOW_directDeclaratorSuffix_in_directDeclarator2754);
- directDeclaratorSuffix127=directDeclaratorSuffix();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, directDeclaratorSuffix127.getTree());
-
- }
- break;
-
- default :
- break loop39;
- }
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "directDeclarator"
-
-
- public static class directDeclaratorSuffix_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "directDeclaratorSuffix"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:508:1: directDeclaratorSuffix : OPENBRAC directDeclaratorLength CLOSEBRAC -> ^( LENGTH directDeclaratorLength ) ;
- public final CTFParser.directDeclaratorSuffix_return directDeclaratorSuffix() throws RecognitionException {
- CTFParser.directDeclaratorSuffix_return retval = new CTFParser.directDeclaratorSuffix_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token OPENBRAC128=null;
- Token CLOSEBRAC130=null;
- ParserRuleReturnScope directDeclaratorLength129 =null;
-
- CommonTree OPENBRAC128_tree=null;
- CommonTree CLOSEBRAC130_tree=null;
- RewriteRuleTokenStream stream_OPENBRAC=new RewriteRuleTokenStream(adaptor,"token OPENBRAC");
- RewriteRuleTokenStream stream_CLOSEBRAC=new RewriteRuleTokenStream(adaptor,"token CLOSEBRAC");
- RewriteRuleSubtreeStream stream_directDeclaratorLength=new RewriteRuleSubtreeStream(adaptor,"rule directDeclaratorLength");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:509:3: ( OPENBRAC directDeclaratorLength CLOSEBRAC -> ^( LENGTH directDeclaratorLength ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:509:5: OPENBRAC directDeclaratorLength CLOSEBRAC
- {
- OPENBRAC128=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_directDeclaratorSuffix2768); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_OPENBRAC.add(OPENBRAC128);
-
- pushFollow(FOLLOW_directDeclaratorLength_in_directDeclaratorSuffix2770);
- directDeclaratorLength129=directDeclaratorLength();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_directDeclaratorLength.add(directDeclaratorLength129.getTree());
- CLOSEBRAC130=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_directDeclaratorSuffix2772); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_CLOSEBRAC.add(CLOSEBRAC130);
-
- // AST REWRITE
- // elements: directDeclaratorLength
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 510:7: -> ^( LENGTH directDeclaratorLength )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:510:10: ^( LENGTH directDeclaratorLength )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(LENGTH, "LENGTH"), root_1);
- adaptor.addChild(root_1, stream_directDeclaratorLength.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "directDeclaratorSuffix"
-
-
- public static class directDeclaratorLength_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "directDeclaratorLength"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:513:1: directDeclaratorLength : unaryExpression ;
- public final CTFParser.directDeclaratorLength_return directDeclaratorLength() throws RecognitionException {
- CTFParser.directDeclaratorLength_return retval = new CTFParser.directDeclaratorLength_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope unaryExpression131 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:514:3: ( unaryExpression )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:514:5: unaryExpression
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_unaryExpression_in_directDeclaratorLength2800);
- unaryExpression131=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression131.getTree());
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "directDeclaratorLength"
-
-
- public static class abstractDeclarator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "abstractDeclarator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:517:1: abstractDeclarator : ( ( pointer )+ ( directAbstractDeclarator )? -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? ) | directAbstractDeclarator -> ^( TYPE_DECLARATOR directAbstractDeclarator ) );
- public final CTFParser.abstractDeclarator_return abstractDeclarator() throws RecognitionException {
- CTFParser.abstractDeclarator_return retval = new CTFParser.abstractDeclarator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope pointer132 =null;
- ParserRuleReturnScope directAbstractDeclarator133 =null;
- ParserRuleReturnScope directAbstractDeclarator134 =null;
-
- RewriteRuleSubtreeStream stream_pointer=new RewriteRuleSubtreeStream(adaptor,"rule pointer");
- RewriteRuleSubtreeStream stream_directAbstractDeclarator=new RewriteRuleSubtreeStream(adaptor,"rule directAbstractDeclarator");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:3: ( ( pointer )+ ( directAbstractDeclarator )? -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? ) | directAbstractDeclarator -> ^( TYPE_DECLARATOR directAbstractDeclarator ) )
- int alt42=2;
- int LA42_0 = input.LA(1);
- if ( (LA42_0==POINTER) ) {
- alt42=1;
- }
- else if ( (LA42_0==IDENTIFIER||LA42_0==LPAREN) ) {
- alt42=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 42, 0, input);
- throw nvae;
- }
-
- switch (alt42) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: ( pointer )+ ( directAbstractDeclarator )?
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: ( pointer )+
- int cnt40=0;
- loop40:
- while (true) {
- int alt40=2;
- int LA40_0 = input.LA(1);
- if ( (LA40_0==POINTER) ) {
- alt40=1;
- }
-
- switch (alt40) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:5: pointer
- {
- pushFollow(FOLLOW_pointer_in_abstractDeclarator2813);
- pointer132=pointer();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_pointer.add(pointer132.getTree());
- }
- break;
-
- default :
- if ( cnt40 >= 1 ) break loop40;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(40, input);
- throw eee;
- }
- cnt40++;
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:14: ( directAbstractDeclarator )?
- int alt41=2;
- int LA41_0 = input.LA(1);
- if ( (LA41_0==IDENTIFIER||LA41_0==LPAREN) ) {
- alt41=1;
- }
- switch (alt41) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:518:14: directAbstractDeclarator
- {
- pushFollow(FOLLOW_directAbstractDeclarator_in_abstractDeclarator2816);
- directAbstractDeclarator133=directAbstractDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_directAbstractDeclarator.add(directAbstractDeclarator133.getTree());
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: pointer, directAbstractDeclarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 519:7: -> ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:519:10: ^( TYPE_DECLARATOR ( pointer )+ ( directAbstractDeclarator )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
- if ( !(stream_pointer.hasNext()) ) {
- throw new RewriteEarlyExitException();
- }
- while ( stream_pointer.hasNext() ) {
- adaptor.addChild(root_1, stream_pointer.nextTree());
- }
- stream_pointer.reset();
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:519:37: ( directAbstractDeclarator )?
- if ( stream_directAbstractDeclarator.hasNext() ) {
- adaptor.addChild(root_1, stream_directAbstractDeclarator.nextTree());
- }
- stream_directAbstractDeclarator.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:520:5: directAbstractDeclarator
- {
- pushFollow(FOLLOW_directAbstractDeclarator_in_abstractDeclarator2841);
- directAbstractDeclarator134=directAbstractDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_directAbstractDeclarator.add(directAbstractDeclarator134.getTree());
- // AST REWRITE
- // elements: directAbstractDeclarator
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 521:7: -> ^( TYPE_DECLARATOR directAbstractDeclarator )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:521:10: ^( TYPE_DECLARATOR directAbstractDeclarator )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_DECLARATOR, "TYPE_DECLARATOR"), root_1);
- adaptor.addChild(root_1, stream_directAbstractDeclarator.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "abstractDeclarator"
-
-
- public static class directAbstractDeclarator_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "directAbstractDeclarator"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:529:1: directAbstractDeclarator : ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )? ;
- public final CTFParser.directAbstractDeclarator_return directAbstractDeclarator() throws RecognitionException {
- CTFParser.directAbstractDeclarator_return retval = new CTFParser.directAbstractDeclarator_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER135=null;
- Token LPAREN136=null;
- Token RPAREN138=null;
- Token OPENBRAC139=null;
- Token CLOSEBRAC141=null;
- ParserRuleReturnScope abstractDeclarator137 =null;
- ParserRuleReturnScope unaryExpression140 =null;
-
- CommonTree IDENTIFIER135_tree=null;
- CommonTree LPAREN136_tree=null;
- CommonTree RPAREN138_tree=null;
- CommonTree OPENBRAC139_tree=null;
- CommonTree CLOSEBRAC141_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:3: ( ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )? )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:5: ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) ) ( OPENBRAC ( unaryExpression )? CLOSEBRAC )?
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:530:5: ( IDENTIFIER | ( LPAREN abstractDeclarator RPAREN ) )
- int alt43=2;
- int LA43_0 = input.LA(1);
- if ( (LA43_0==IDENTIFIER) ) {
- alt43=1;
- }
- else if ( (LA43_0==LPAREN) ) {
- alt43=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 43, 0, input);
- throw nvae;
- }
-
- switch (alt43) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:531:7: IDENTIFIER
- {
- IDENTIFIER135=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_directAbstractDeclarator2878); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- IDENTIFIER135_tree = (CommonTree)adaptor.create(IDENTIFIER135);
- adaptor.addChild(root_0, IDENTIFIER135_tree);
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:9: ( LPAREN abstractDeclarator RPAREN )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:9: ( LPAREN abstractDeclarator RPAREN )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:532:10: LPAREN abstractDeclarator RPAREN
- {
- LPAREN136=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_directAbstractDeclarator2889); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- LPAREN136_tree = (CommonTree)adaptor.create(LPAREN136);
- adaptor.addChild(root_0, LPAREN136_tree);
- }
-
- pushFollow(FOLLOW_abstractDeclarator_in_directAbstractDeclarator2891);
- abstractDeclarator137=abstractDeclarator();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclarator137.getTree());
-
- RPAREN138=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_directAbstractDeclarator2893); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- RPAREN138_tree = (CommonTree)adaptor.create(RPAREN138);
- adaptor.addChild(root_0, RPAREN138_tree);
- }
-
- }
-
- }
- break;
-
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:533:5: ( OPENBRAC ( unaryExpression )? CLOSEBRAC )?
- int alt45=2;
- int LA45_0 = input.LA(1);
- if ( (LA45_0==OPENBRAC) ) {
- alt45=1;
- }
- switch (alt45) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:7: OPENBRAC ( unaryExpression )? CLOSEBRAC
- {
- OPENBRAC139=(Token)match(input,OPENBRAC,FOLLOW_OPENBRAC_in_directAbstractDeclarator2908); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- OPENBRAC139_tree = (CommonTree)adaptor.create(OPENBRAC139);
- adaptor.addChild(root_0, OPENBRAC139_tree);
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:16: ( unaryExpression )?
- int alt44=2;
- int LA44_0 = input.LA(1);
- if ( (LA44_0==ALIGNTOK||(LA44_0 >= CALLSITETOK && LA44_0 <= CHARACTER_LITERAL)||LA44_0==CLOCKTOK||LA44_0==DECIMAL_LITERAL||LA44_0==ENVTOK||LA44_0==EVENTTOK||LA44_0==HEX_LITERAL||LA44_0==IDENTIFIER||LA44_0==OCTAL_LITERAL||(LA44_0 >= SIGN && LA44_0 <= SIGNEDTOK)||LA44_0==STREAMTOK||LA44_0==STRINGTOK||LA44_0==STRING_LITERAL||LA44_0==TRACETOK) ) {
- alt44=1;
- }
- switch (alt44) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:534:16: unaryExpression
- {
- pushFollow(FOLLOW_unaryExpression_in_directAbstractDeclarator2910);
- unaryExpression140=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, unaryExpression140.getTree());
-
- }
- break;
-
- }
-
- CLOSEBRAC141=(Token)match(input,CLOSEBRAC,FOLLOW_CLOSEBRAC_in_directAbstractDeclarator2913); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- CLOSEBRAC141_tree = (CommonTree)adaptor.create(CLOSEBRAC141);
- adaptor.addChild(root_0, CLOSEBRAC141_tree);
- }
-
- }
- break;
-
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "directAbstractDeclarator"
-
-
- public static class pointer_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "pointer"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:538:1: pointer : POINTER ( typeQualifierList )? -> ^( POINTER ( typeQualifierList )? ) ;
- public final CTFParser.pointer_return pointer() throws RecognitionException {
- CTFParser.pointer_return retval = new CTFParser.pointer_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token POINTER142=null;
- ParserRuleReturnScope typeQualifierList143 =null;
-
- CommonTree POINTER142_tree=null;
- RewriteRuleTokenStream stream_POINTER=new RewriteRuleTokenStream(adaptor,"token POINTER");
- RewriteRuleSubtreeStream stream_typeQualifierList=new RewriteRuleSubtreeStream(adaptor,"rule typeQualifierList");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:3: ( POINTER ( typeQualifierList )? -> ^( POINTER ( typeQualifierList )? ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:5: POINTER ( typeQualifierList )?
- {
- POINTER142=(Token)match(input,POINTER,FOLLOW_POINTER_in_pointer2931); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_POINTER.add(POINTER142);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:13: ( typeQualifierList )?
- int alt46=2;
- int LA46_0 = input.LA(1);
- if ( (LA46_0==CONSTTOK) ) {
- alt46=1;
- }
- switch (alt46) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:13: typeQualifierList
- {
- pushFollow(FOLLOW_typeQualifierList_in_pointer2933);
- typeQualifierList143=typeQualifierList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeQualifierList.add(typeQualifierList143.getTree());
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: POINTER, typeQualifierList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 539:32: -> ^( POINTER ( typeQualifierList )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:35: ^( POINTER ( typeQualifierList )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot(stream_POINTER.nextNode(), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:539:45: ( typeQualifierList )?
- if ( stream_typeQualifierList.hasNext() ) {
- adaptor.addChild(root_1, stream_typeQualifierList.nextTree());
- }
- stream_typeQualifierList.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "pointer"
-
-
- public static class typeQualifierList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typeQualifierList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:542:1: typeQualifierList : ( typeQualifier )+ ;
- public final CTFParser.typeQualifierList_return typeQualifierList() throws RecognitionException {
- CTFParser.typeQualifierList_return retval = new CTFParser.typeQualifierList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope typeQualifier144 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:3: ( ( typeQualifier )+ )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: ( typeQualifier )+
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: ( typeQualifier )+
- int cnt47=0;
- loop47:
- while (true) {
- int alt47=2;
- int LA47_0 = input.LA(1);
- if ( (LA47_0==CONSTTOK) ) {
- alt47=1;
- }
-
- switch (alt47) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:543:5: typeQualifier
- {
- pushFollow(FOLLOW_typeQualifier_in_typeQualifierList2956);
- typeQualifier144=typeQualifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, typeQualifier144.getTree());
-
- }
- break;
-
- default :
- if ( cnt47 >= 1 ) break loop47;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(47, input);
- throw eee;
- }
- cnt47++;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typeQualifierList"
-
-
- public static class typedefName_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typedefName"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:546:1: typedefName :{...}? IDENTIFIER ;
- public final CTFParser.typedefName_return typedefName() throws RecognitionException {
- CTFParser.typedefName_return retval = new CTFParser.typedefName_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token IDENTIFIER145=null;
-
- CommonTree IDENTIFIER145_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:547:3: ({...}? IDENTIFIER )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:547:5: {...}? IDENTIFIER
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- if ( !((inTypealiasAlias() || isTypeName(input.LT(1).getText()))) ) {
- if (state.backtracking>0) {state.failed=true; return retval;}
- throw new FailedPredicateException(input, "typedefName", "inTypealiasAlias() || isTypeName(input.LT(1).getText())");
- }
- IDENTIFIER145=(Token)match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_typedefName2972); if (state.failed) return retval;
- if ( state.backtracking==0 ) {
- IDENTIFIER145_tree = (CommonTree)adaptor.create(IDENTIFIER145);
- adaptor.addChild(root_0, IDENTIFIER145_tree);
- }
-
- if ( state.backtracking==0 ) { if ((inTypedef() || inTypealiasAlias()) && !isTypeName((IDENTIFIER145!=null?IDENTIFIER145.getText():null))) { addTypeName((IDENTIFIER145!=null?IDENTIFIER145.getText():null)); } }
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typedefName"
-
-
- public static class typealiasTarget_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typealiasTarget"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:556:1: typealiasTarget : declarationSpecifiers ( abstractDeclaratorList )? ;
- public final CTFParser.typealiasTarget_return typealiasTarget() throws RecognitionException {
- CTFParser.typealiasTarget_return retval = new CTFParser.typealiasTarget_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope declarationSpecifiers146 =null;
- ParserRuleReturnScope abstractDeclaratorList147 =null;
-
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:3: ( declarationSpecifiers ( abstractDeclaratorList )? )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:5: declarationSpecifiers ( abstractDeclaratorList )?
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_declarationSpecifiers_in_typealiasTarget2989);
- declarationSpecifiers146=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, declarationSpecifiers146.getTree());
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:27: ( abstractDeclaratorList )?
- int alt48=2;
- int LA48_0 = input.LA(1);
- if ( (LA48_0==IDENTIFIER||LA48_0==LPAREN||LA48_0==POINTER) ) {
- alt48=1;
- }
- switch (alt48) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:557:27: abstractDeclaratorList
- {
- pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasTarget2991);
- abstractDeclaratorList147=abstractDeclaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList147.getTree());
-
- }
- break;
-
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typealiasTarget"
-
-
- public static class typealiasAlias_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typealiasAlias"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:566:1: typealiasAlias : ( abstractDeclaratorList | declarationSpecifiers ( abstractDeclaratorList )? );
- public final CTFParser.typealiasAlias_return typealiasAlias() throws RecognitionException {
- CTFParser.typealiasAlias_return retval = new CTFParser.typealiasAlias_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope abstractDeclaratorList148 =null;
- ParserRuleReturnScope declarationSpecifiers149 =null;
- ParserRuleReturnScope abstractDeclaratorList150 =null;
-
-
-
- typealiasAliasOn();
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:573:3: ( abstractDeclaratorList | declarationSpecifiers ( abstractDeclaratorList )? )
- int alt50=2;
- switch ( input.LA(1) ) {
- case LPAREN:
- case POINTER:
- {
- alt50=1;
- }
- break;
- case IDENTIFIER:
- {
- int LA50_2 = input.LA(2);
- if ( (!(((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))))) ) {
- alt50=1;
- }
- else if ( ((( inTypealiasAlias() || isTypeName(input.LT(1).getText()) )&&(inTypealiasAlias() || isTypeName(input.LT(1).getText())))) ) {
- alt50=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 50, 2, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
-
- }
- break;
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case TYPEDEFTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt50=2;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 50, 0, input);
- throw nvae;
- }
- switch (alt50) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:573:5: abstractDeclaratorList
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasAlias3017);
- abstractDeclaratorList148=abstractDeclaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList148.getTree());
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:5: declarationSpecifiers ( abstractDeclaratorList )?
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_declarationSpecifiers_in_typealiasAlias3023);
- declarationSpecifiers149=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, declarationSpecifiers149.getTree());
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:27: ( abstractDeclaratorList )?
- int alt49=2;
- int LA49_0 = input.LA(1);
- if ( (LA49_0==IDENTIFIER||LA49_0==LPAREN||LA49_0==POINTER) ) {
- alt49=1;
- }
- switch (alt49) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:574:27: abstractDeclaratorList
- {
- pushFollow(FOLLOW_abstractDeclaratorList_in_typealiasAlias3025);
- abstractDeclaratorList150=abstractDeclaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, abstractDeclaratorList150.getTree());
-
- }
- break;
-
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- if ( state.backtracking==0 ) {
- typealiasAliasOff();
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typealiasAlias"
-
-
- public static class typealiasDecl_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "typealiasDecl"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:577:1: typealiasDecl : TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) ) ;
- public final CTFParser.typealiasDecl_return typealiasDecl() throws RecognitionException {
- CTFParser.typealiasDecl_return retval = new CTFParser.typealiasDecl_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token TYPEALIASTOK151=null;
- Token TYPE_ASSIGNMENT153=null;
- ParserRuleReturnScope typealiasTarget152 =null;
- ParserRuleReturnScope typealiasAlias154 =null;
-
- CommonTree TYPEALIASTOK151_tree=null;
- CommonTree TYPE_ASSIGNMENT153_tree=null;
- RewriteRuleTokenStream stream_TYPE_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token TYPE_ASSIGNMENT");
- RewriteRuleTokenStream stream_TYPEALIASTOK=new RewriteRuleTokenStream(adaptor,"token TYPEALIASTOK");
- RewriteRuleSubtreeStream stream_typealiasAlias=new RewriteRuleSubtreeStream(adaptor,"rule typealiasAlias");
- RewriteRuleSubtreeStream stream_typealiasTarget=new RewriteRuleSubtreeStream(adaptor,"rule typealiasTarget");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:578:3: ( TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) ) )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:578:5: TYPEALIASTOK typealiasTarget TYPE_ASSIGNMENT typealiasAlias
- {
- TYPEALIASTOK151=(Token)match(input,TYPEALIASTOK,FOLLOW_TYPEALIASTOK_in_typealiasDecl3039); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TYPEALIASTOK.add(TYPEALIASTOK151);
-
- pushFollow(FOLLOW_typealiasTarget_in_typealiasDecl3041);
- typealiasTarget152=typealiasTarget();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typealiasTarget.add(typealiasTarget152.getTree());
- TYPE_ASSIGNMENT153=(Token)match(input,TYPE_ASSIGNMENT,FOLLOW_TYPE_ASSIGNMENT_in_typealiasDecl3043); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TYPE_ASSIGNMENT.add(TYPE_ASSIGNMENT153);
-
- pushFollow(FOLLOW_typealiasAlias_in_typealiasDecl3045);
- typealiasAlias154=typealiasAlias();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typealiasAlias.add(typealiasAlias154.getTree());
- // AST REWRITE
- // elements: typealiasTarget, typealiasAlias
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 579:7: -> ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:579:10: ^( TYPEALIAS ^( TYPEALIAS_TARGET typealiasTarget ) ^( TYPEALIAS_ALIAS typealiasAlias ) )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS, "TYPEALIAS"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:580:14: ^( TYPEALIAS_TARGET typealiasTarget )
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS_TARGET, "TYPEALIAS_TARGET"), root_2);
- adaptor.addChild(root_2, stream_typealiasTarget.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:581:14: ^( TYPEALIAS_ALIAS typealiasAlias )
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEALIAS_ALIAS, "TYPEALIAS_ALIAS"), root_2);
- adaptor.addChild(root_2, stream_typealiasAlias.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "typealiasDecl"
-
-
- public static class ctfKeyword_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfKeyword"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:587:1: ctfKeyword : ( ALIGNTOK | EVENTTOK | SIGNEDTOK | STRINGTOK );
- public final CTFParser.ctfKeyword_return ctfKeyword() throws RecognitionException {
- CTFParser.ctfKeyword_return retval = new CTFParser.ctfKeyword_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token set155=null;
-
- CommonTree set155_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:588:3: ( ALIGNTOK | EVENTTOK | SIGNEDTOK | STRINGTOK )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- set155=input.LT(1);
- if ( input.LA(1)==ALIGNTOK||input.LA(1)==EVENTTOK||input.LA(1)==SIGNEDTOK||input.LA(1)==STRINGTOK ) {
- input.consume();
- if ( state.backtracking==0 ) adaptor.addChild(root_0, (CommonTree)adaptor.create(set155));
- state.errorRecovery=false;
- state.failed=false;
- }
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- MismatchedSetException mse = new MismatchedSetException(null,input);
- throw mse;
- }
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfKeyword"
-
-
- public static class ctfSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:594:1: ctfSpecifier : ( ctfSpecifierHead ctfBody -> ^( ctfSpecifierHead ctfBody ) | typealiasDecl -> ^( DECLARATION typealiasDecl ) );
- public final CTFParser.ctfSpecifier_return ctfSpecifier() throws RecognitionException {
- CTFParser.ctfSpecifier_return retval = new CTFParser.ctfSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- ParserRuleReturnScope ctfSpecifierHead156 =null;
- ParserRuleReturnScope ctfBody157 =null;
- ParserRuleReturnScope typealiasDecl158 =null;
-
- RewriteRuleSubtreeStream stream_ctfSpecifierHead=new RewriteRuleSubtreeStream(adaptor,"rule ctfSpecifierHead");
- RewriteRuleSubtreeStream stream_typealiasDecl=new RewriteRuleSubtreeStream(adaptor,"rule typealiasDecl");
- RewriteRuleSubtreeStream stream_ctfBody=new RewriteRuleSubtreeStream(adaptor,"rule ctfBody");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:3: ( ctfSpecifierHead ctfBody -> ^( ctfSpecifierHead ctfBody ) | typealiasDecl -> ^( DECLARATION typealiasDecl ) )
- int alt51=2;
- int LA51_0 = input.LA(1);
- if ( (LA51_0==CALLSITETOK||LA51_0==CLOCKTOK||LA51_0==ENVTOK||LA51_0==EVENTTOK||LA51_0==STREAMTOK||LA51_0==TRACETOK) ) {
- alt51=1;
- }
- else if ( (LA51_0==TYPEALIASTOK) ) {
- alt51=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 51, 0, input);
- throw nvae;
- }
-
- switch (alt51) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:5: ctfSpecifierHead ctfBody
- {
- pushFollow(FOLLOW_ctfSpecifierHead_in_ctfSpecifier3145);
- ctfSpecifierHead156=ctfSpecifierHead();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfSpecifierHead.add(ctfSpecifierHead156.getTree());
- pushFollow(FOLLOW_ctfBody_in_ctfSpecifier3147);
- ctfBody157=ctfBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody157.getTree());
- // AST REWRITE
- // elements: ctfSpecifierHead, ctfBody
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 596:30: -> ^( ctfSpecifierHead ctfBody )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:596:33: ^( ctfSpecifierHead ctfBody )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot(stream_ctfSpecifierHead.nextNode(), root_1);
- adaptor.addChild(root_1, stream_ctfBody.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:598:5: typealiasDecl
- {
- pushFollow(FOLLOW_typealiasDecl_in_ctfSpecifier3164);
- typealiasDecl158=typealiasDecl();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typealiasDecl.add(typealiasDecl158.getTree());
- // AST REWRITE
- // elements: typealiasDecl
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 598:19: -> ^( DECLARATION typealiasDecl )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:598:22: ^( DECLARATION typealiasDecl )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DECLARATION, "DECLARATION"), root_1);
- adaptor.addChild(root_1, stream_typealiasDecl.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfSpecifier"
-
-
- public static class ctfSpecifierHead_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfSpecifierHead"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:601:1: ctfSpecifierHead : ( EVENTTOK -> EVENT | STREAMTOK -> STREAM | TRACETOK -> TRACE | ENVTOK -> ENV | CLOCKTOK -> CLOCK | CALLSITETOK -> CALLSITE );
- public final CTFParser.ctfSpecifierHead_return ctfSpecifierHead() throws RecognitionException {
- CTFParser.ctfSpecifierHead_return retval = new CTFParser.ctfSpecifierHead_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token EVENTTOK159=null;
- Token STREAMTOK160=null;
- Token TRACETOK161=null;
- Token ENVTOK162=null;
- Token CLOCKTOK163=null;
- Token CALLSITETOK164=null;
-
- CommonTree EVENTTOK159_tree=null;
- CommonTree STREAMTOK160_tree=null;
- CommonTree TRACETOK161_tree=null;
- CommonTree ENVTOK162_tree=null;
- CommonTree CLOCKTOK163_tree=null;
- CommonTree CALLSITETOK164_tree=null;
- RewriteRuleTokenStream stream_EVENTTOK=new RewriteRuleTokenStream(adaptor,"token EVENTTOK");
- RewriteRuleTokenStream stream_CALLSITETOK=new RewriteRuleTokenStream(adaptor,"token CALLSITETOK");
- RewriteRuleTokenStream stream_STREAMTOK=new RewriteRuleTokenStream(adaptor,"token STREAMTOK");
- RewriteRuleTokenStream stream_ENVTOK=new RewriteRuleTokenStream(adaptor,"token ENVTOK");
- RewriteRuleTokenStream stream_CLOCKTOK=new RewriteRuleTokenStream(adaptor,"token CLOCKTOK");
- RewriteRuleTokenStream stream_TRACETOK=new RewriteRuleTokenStream(adaptor,"token TRACETOK");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:602:3: ( EVENTTOK -> EVENT | STREAMTOK -> STREAM | TRACETOK -> TRACE | ENVTOK -> ENV | CLOCKTOK -> CLOCK | CALLSITETOK -> CALLSITE )
- int alt52=6;
- switch ( input.LA(1) ) {
- case EVENTTOK:
- {
- alt52=1;
- }
- break;
- case STREAMTOK:
- {
- alt52=2;
- }
- break;
- case TRACETOK:
- {
- alt52=3;
- }
- break;
- case ENVTOK:
- {
- alt52=4;
- }
- break;
- case CLOCKTOK:
- {
- alt52=5;
- }
- break;
- case CALLSITETOK:
- {
- alt52=6;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 52, 0, input);
- throw nvae;
- }
- switch (alt52) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:602:5: EVENTTOK
- {
- EVENTTOK159=(Token)match(input,EVENTTOK,FOLLOW_EVENTTOK_in_ctfSpecifierHead3185); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_EVENTTOK.add(EVENTTOK159);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 602:14: -> EVENT
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(EVENT, "EVENT"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:603:5: STREAMTOK
- {
- STREAMTOK160=(Token)match(input,STREAMTOK,FOLLOW_STREAMTOK_in_ctfSpecifierHead3195); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_STREAMTOK.add(STREAMTOK160);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 603:15: -> STREAM
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(STREAM, "STREAM"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:604:5: TRACETOK
- {
- TRACETOK161=(Token)match(input,TRACETOK,FOLLOW_TRACETOK_in_ctfSpecifierHead3205); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TRACETOK.add(TRACETOK161);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 604:14: -> TRACE
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(TRACE, "TRACE"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 4 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:605:5: ENVTOK
- {
- ENVTOK162=(Token)match(input,ENVTOK,FOLLOW_ENVTOK_in_ctfSpecifierHead3215); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ENVTOK.add(ENVTOK162);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 605:12: -> ENV
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(ENV, "ENV"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 5 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:606:5: CLOCKTOK
- {
- CLOCKTOK163=(Token)match(input,CLOCKTOK,FOLLOW_CLOCKTOK_in_ctfSpecifierHead3225); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_CLOCKTOK.add(CLOCKTOK163);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 606:14: -> CLOCK
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(CLOCK, "CLOCK"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 6 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:607:5: CALLSITETOK
- {
- CALLSITETOK164=(Token)match(input,CALLSITETOK,FOLLOW_CALLSITETOK_in_ctfSpecifierHead3235); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_CALLSITETOK.add(CALLSITETOK164);
-
- // AST REWRITE
- // elements:
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 607:17: -> CALLSITE
- {
- adaptor.addChild(root_0, (CommonTree)adaptor.create(CALLSITE, "CALLSITE"));
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfSpecifierHead"
-
-
- public static class ctfTypeSpecifier_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfTypeSpecifier"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:610:1: ctfTypeSpecifier : ( FLOATINGPOINTTOK ctfBody -> ^( FLOATING_POINT ( ctfBody )? ) | INTEGERTOK ctfBody -> ^( INTEGER ( ctfBody )? ) | STRINGTOK ( ctfBody )? -> ^( STRING ( ctfBody )? ) );
- public final CTFParser.ctfTypeSpecifier_return ctfTypeSpecifier() throws RecognitionException {
- CTFParser.ctfTypeSpecifier_return retval = new CTFParser.ctfTypeSpecifier_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token FLOATINGPOINTTOK165=null;
- Token INTEGERTOK167=null;
- Token STRINGTOK169=null;
- ParserRuleReturnScope ctfBody166 =null;
- ParserRuleReturnScope ctfBody168 =null;
- ParserRuleReturnScope ctfBody170 =null;
-
- CommonTree FLOATINGPOINTTOK165_tree=null;
- CommonTree INTEGERTOK167_tree=null;
- CommonTree STRINGTOK169_tree=null;
- RewriteRuleTokenStream stream_FLOATINGPOINTTOK=new RewriteRuleTokenStream(adaptor,"token FLOATINGPOINTTOK");
- RewriteRuleTokenStream stream_STRINGTOK=new RewriteRuleTokenStream(adaptor,"token STRINGTOK");
- RewriteRuleTokenStream stream_INTEGERTOK=new RewriteRuleTokenStream(adaptor,"token INTEGERTOK");
- RewriteRuleSubtreeStream stream_ctfBody=new RewriteRuleSubtreeStream(adaptor,"rule ctfBody");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:3: ( FLOATINGPOINTTOK ctfBody -> ^( FLOATING_POINT ( ctfBody )? ) | INTEGERTOK ctfBody -> ^( INTEGER ( ctfBody )? ) | STRINGTOK ( ctfBody )? -> ^( STRING ( ctfBody )? ) )
- int alt54=3;
- switch ( input.LA(1) ) {
- case FLOATINGPOINTTOK:
- {
- alt54=1;
- }
- break;
- case INTEGERTOK:
- {
- alt54=2;
- }
- break;
- case STRINGTOK:
- {
- alt54=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 54, 0, input);
- throw nvae;
- }
- switch (alt54) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:5: FLOATINGPOINTTOK ctfBody
- {
- FLOATINGPOINTTOK165=(Token)match(input,FLOATINGPOINTTOK,FOLLOW_FLOATINGPOINTTOK_in_ctfTypeSpecifier3258); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_FLOATINGPOINTTOK.add(FLOATINGPOINTTOK165);
-
- pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3260);
- ctfBody166=ctfBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody166.getTree());
- // AST REWRITE
- // elements: ctfBody
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 612:30: -> ^( FLOATING_POINT ( ctfBody )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:33: ^( FLOATING_POINT ( ctfBody )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FLOATING_POINT, "FLOATING_POINT"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:612:50: ( ctfBody )?
- if ( stream_ctfBody.hasNext() ) {
- adaptor.addChild(root_1, stream_ctfBody.nextTree());
- }
- stream_ctfBody.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:5: INTEGERTOK ctfBody
- {
- INTEGERTOK167=(Token)match(input,INTEGERTOK,FOLLOW_INTEGERTOK_in_ctfTypeSpecifier3275); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_INTEGERTOK.add(INTEGERTOK167);
-
- pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3277);
- ctfBody168=ctfBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody168.getTree());
- // AST REWRITE
- // elements: ctfBody
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 613:24: -> ^( INTEGER ( ctfBody )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:27: ^( INTEGER ( ctfBody )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(INTEGER, "INTEGER"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:613:37: ( ctfBody )?
- if ( stream_ctfBody.hasNext() ) {
- adaptor.addChild(root_1, stream_ctfBody.nextTree());
- }
- stream_ctfBody.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:5: STRINGTOK ( ctfBody )?
- {
- STRINGTOK169=(Token)match(input,STRINGTOK,FOLLOW_STRINGTOK_in_ctfTypeSpecifier3292); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_STRINGTOK.add(STRINGTOK169);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:15: ( ctfBody )?
- int alt53=2;
- int LA53_0 = input.LA(1);
- if ( (LA53_0==LCURL) ) {
- alt53=1;
- }
- switch (alt53) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:15: ctfBody
- {
- pushFollow(FOLLOW_ctfBody_in_ctfTypeSpecifier3294);
- ctfBody170=ctfBody();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfBody.add(ctfBody170.getTree());
- }
- break;
-
- }
-
- // AST REWRITE
- // elements: ctfBody
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 614:24: -> ^( STRING ( ctfBody )? )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:27: ^( STRING ( ctfBody )? )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(STRING, "STRING"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:614:36: ( ctfBody )?
- if ( stream_ctfBody.hasNext() ) {
- adaptor.addChild(root_1, stream_ctfBody.nextTree());
- }
- stream_ctfBody.reset();
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfTypeSpecifier"
-
-
- public static class ctfBody_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfBody"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:617:1: ctfBody : LCURL ( ctfAssignmentExpressionList )? RCURL -> ( ctfAssignmentExpressionList )? ;
- public final CTFParser.ctfBody_return ctfBody() throws RecognitionException {
- Symbols_stack.push(new Symbols_scope());
-
- CTFParser.ctfBody_return retval = new CTFParser.ctfBody_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token LCURL171=null;
- Token RCURL173=null;
- ParserRuleReturnScope ctfAssignmentExpressionList172 =null;
-
- CommonTree LCURL171_tree=null;
- CommonTree RCURL173_tree=null;
- RewriteRuleTokenStream stream_LCURL=new RewriteRuleTokenStream(adaptor,"token LCURL");
- RewriteRuleTokenStream stream_RCURL=new RewriteRuleTokenStream(adaptor,"token RCURL");
- RewriteRuleSubtreeStream stream_ctfAssignmentExpressionList=new RewriteRuleSubtreeStream(adaptor,"rule ctfAssignmentExpressionList");
-
-
- Symbols_stack.peek().types = new HashSet<String>();
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:3: ( LCURL ( ctfAssignmentExpressionList )? RCURL -> ( ctfAssignmentExpressionList )? )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:5: LCURL ( ctfAssignmentExpressionList )? RCURL
- {
- LCURL171=(Token)match(input,LCURL,FOLLOW_LCURL_in_ctfBody3327); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_LCURL.add(LCURL171);
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:11: ( ctfAssignmentExpressionList )?
- int alt55=2;
- int LA55_0 = input.LA(1);
- if ( (LA55_0==ALIGNTOK||(LA55_0 >= BOOLTOK && LA55_0 <= CHARTOK)||LA55_0==CLOCKTOK||(LA55_0 >= COMPLEXTOK && LA55_0 <= DECIMAL_LITERAL)||LA55_0==DOUBLETOK||(LA55_0 >= ENUMTOK && LA55_0 <= ENVTOK)||(LA55_0 >= EVENTTOK && LA55_0 <= FLOATTOK)||LA55_0==HEX_LITERAL||(LA55_0 >= IDENTIFIER && LA55_0 <= IMAGINARYTOK)||LA55_0==INTEGERTOK||LA55_0==INTTOK||LA55_0==LONGTOK||LA55_0==OCTAL_LITERAL||(LA55_0 >= SHORTTOK && LA55_0 <= SIGNEDTOK)||LA55_0==STREAMTOK||LA55_0==STRINGTOK||(LA55_0 >= STRING_LITERAL && LA55_0 <= STRUCTTOK)||(LA55_0 >= TRACETOK && LA55_0 <= TYPEDEFTOK)||(LA55_0 >= UNSIGNEDTOK && LA55_0 <= VOIDTOK)) ) {
- alt55=1;
- }
- switch (alt55) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:11: ctfAssignmentExpressionList
- {
- pushFollow(FOLLOW_ctfAssignmentExpressionList_in_ctfBody3329);
- ctfAssignmentExpressionList172=ctfAssignmentExpressionList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ctfAssignmentExpressionList.add(ctfAssignmentExpressionList172.getTree());
- }
- break;
-
- }
-
- RCURL173=(Token)match(input,RCURL,FOLLOW_RCURL_in_ctfBody3332); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_RCURL.add(RCURL173);
-
- // AST REWRITE
- // elements: ctfAssignmentExpressionList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 622:46: -> ( ctfAssignmentExpressionList )?
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:622:49: ( ctfAssignmentExpressionList )?
- if ( stream_ctfAssignmentExpressionList.hasNext() ) {
- adaptor.addChild(root_0, stream_ctfAssignmentExpressionList.nextTree());
- }
- stream_ctfAssignmentExpressionList.reset();
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- Symbols_stack.pop();
-
- }
- return retval;
- }
- // $ANTLR end "ctfBody"
-
-
- public static class ctfAssignmentExpressionList_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfAssignmentExpressionList"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:625:1: ctfAssignmentExpressionList : ( ctfAssignmentExpression TERM !)+ ;
- public final CTFParser.ctfAssignmentExpressionList_return ctfAssignmentExpressionList() throws RecognitionException {
- CTFParser.ctfAssignmentExpressionList_return retval = new CTFParser.ctfAssignmentExpressionList_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token TERM175=null;
- ParserRuleReturnScope ctfAssignmentExpression174 =null;
-
- CommonTree TERM175_tree=null;
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:3: ( ( ctfAssignmentExpression TERM !)+ )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:5: ( ctfAssignmentExpression TERM !)+
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:5: ( ctfAssignmentExpression TERM !)+
- int cnt56=0;
- loop56:
- while (true) {
- int alt56=2;
- int LA56_0 = input.LA(1);
- if ( (LA56_0==ALIGNTOK||(LA56_0 >= BOOLTOK && LA56_0 <= CHARTOK)||LA56_0==CLOCKTOK||(LA56_0 >= COMPLEXTOK && LA56_0 <= DECIMAL_LITERAL)||LA56_0==DOUBLETOK||(LA56_0 >= ENUMTOK && LA56_0 <= ENVTOK)||(LA56_0 >= EVENTTOK && LA56_0 <= FLOATTOK)||LA56_0==HEX_LITERAL||(LA56_0 >= IDENTIFIER && LA56_0 <= IMAGINARYTOK)||LA56_0==INTEGERTOK||LA56_0==INTTOK||LA56_0==LONGTOK||LA56_0==OCTAL_LITERAL||(LA56_0 >= SHORTTOK && LA56_0 <= SIGNEDTOK)||LA56_0==STREAMTOK||LA56_0==STRINGTOK||(LA56_0 >= STRING_LITERAL && LA56_0 <= STRUCTTOK)||(LA56_0 >= TRACETOK && LA56_0 <= TYPEDEFTOK)||(LA56_0 >= UNSIGNEDTOK && LA56_0 <= VOIDTOK)) ) {
- alt56=1;
- }
-
- switch (alt56) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:626:6: ctfAssignmentExpression TERM !
- {
- pushFollow(FOLLOW_ctfAssignmentExpression_in_ctfAssignmentExpressionList3351);
- ctfAssignmentExpression174=ctfAssignmentExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, ctfAssignmentExpression174.getTree());
-
- TERM175=(Token)match(input,TERM,FOLLOW_TERM_in_ctfAssignmentExpressionList3353); if (state.failed) return retval;
- }
- break;
-
- default :
- if ( cnt56 >= 1 ) break loop56;
- if (state.backtracking>0) {state.failed=true; return retval;}
- EarlyExitException eee = new EarlyExitException(56, input);
- throw eee;
- }
- cnt56++;
- }
-
- }
-
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfAssignmentExpressionList"
-
-
- public static class ctfAssignmentExpression_return extends ParserRuleReturnScope {
- CommonTree tree;
- @Override
- public CommonTree getTree() { return tree; }
- };
-
-
- // $ANTLR start "ctfAssignmentExpression"
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:629:1: ctfAssignmentExpression : (left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) ) | ( declarationSpecifiers {...}? declaratorList ) -> ^( TYPEDEF declaratorList declarationSpecifiers ) | typealiasDecl );
- public final CTFParser.ctfAssignmentExpression_return ctfAssignmentExpression() throws RecognitionException {
- CTFParser.ctfAssignmentExpression_return retval = new CTFParser.ctfAssignmentExpression_return();
- retval.start = input.LT(1);
-
- CommonTree root_0 = null;
-
- Token assignment=null;
- Token type_assignment=null;
- ParserRuleReturnScope left =null;
- ParserRuleReturnScope right1 =null;
- ParserRuleReturnScope right2 =null;
- ParserRuleReturnScope declarationSpecifiers176 =null;
- ParserRuleReturnScope declaratorList177 =null;
- ParserRuleReturnScope typealiasDecl178 =null;
-
- CommonTree assignment_tree=null;
- CommonTree type_assignment_tree=null;
- RewriteRuleTokenStream stream_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token ASSIGNMENT");
- RewriteRuleTokenStream stream_TYPE_ASSIGNMENT=new RewriteRuleTokenStream(adaptor,"token TYPE_ASSIGNMENT");
- RewriteRuleSubtreeStream stream_declaratorList=new RewriteRuleSubtreeStream(adaptor,"rule declaratorList");
- RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
- RewriteRuleSubtreeStream stream_declarationSpecifiers=new RewriteRuleSubtreeStream(adaptor,"rule declarationSpecifiers");
- RewriteRuleSubtreeStream stream_typeSpecifier=new RewriteRuleSubtreeStream(adaptor,"rule typeSpecifier");
-
- try {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:635:3: (left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) ) | ( declarationSpecifiers {...}? declaratorList ) -> ^( TYPEDEF declaratorList declarationSpecifiers ) | typealiasDecl )
- int alt58=3;
- switch ( input.LA(1) ) {
- case IDENTIFIER:
- {
- int LA58_1 = input.LA(2);
- if ( ((LA58_1 >= ARROW && LA58_1 <= ASSIGNMENT)||LA58_1==DOT||LA58_1==OPENBRAC||LA58_1==TYPE_ASSIGNMENT) ) {
- alt58=1;
- }
- else if ( (LA58_1==BOOLTOK||LA58_1==CHARTOK||(LA58_1 >= COMPLEXTOK && LA58_1 <= CONSTTOK)||LA58_1==DOUBLETOK||LA58_1==ENUMTOK||(LA58_1 >= FLOATINGPOINTTOK && LA58_1 <= FLOATTOK)||(LA58_1 >= IDENTIFIER && LA58_1 <= IMAGINARYTOK)||LA58_1==INTEGERTOK||LA58_1==INTTOK||LA58_1==LONGTOK||LA58_1==POINTER||LA58_1==SHORTTOK||LA58_1==SIGNEDTOK||LA58_1==STRINGTOK||LA58_1==STRUCTTOK||LA58_1==TYPEDEFTOK||(LA58_1 >= UNSIGNEDTOK && LA58_1 <= VOIDTOK)) && (( inTypealiasAlias() || isTypeName(input.LT(1).getText()) ))) {
- alt58=2;
- }
-
- }
- break;
- case ALIGNTOK:
- case CALLSITETOK:
- case CHARACTER_LITERAL:
- case CLOCKTOK:
- case DECIMAL_LITERAL:
- case ENVTOK:
- case EVENTTOK:
- case HEX_LITERAL:
- case OCTAL_LITERAL:
- case SIGN:
- case STREAMTOK:
- case STRING_LITERAL:
- case TRACETOK:
- {
- alt58=1;
- }
- break;
- case SIGNEDTOK:
- {
- switch ( input.LA(2) ) {
- case ARROW:
- case ASSIGNMENT:
- case DOT:
- case OPENBRAC:
- case TYPE_ASSIGNMENT:
- {
- alt58=1;
- }
- break;
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IDENTIFIER:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case POINTER:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt58=2;
- }
- break;
- case TYPEDEFTOK:
- {
- alt58=2;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 58, 3, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
- }
- break;
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LONGTOK:
- case SHORTTOK:
- case STRUCTTOK:
- case TYPEDEFTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt58=2;
- }
- break;
- case STRINGTOK:
- {
- switch ( input.LA(2) ) {
- case ARROW:
- case ASSIGNMENT:
- case DOT:
- case OPENBRAC:
- case TYPE_ASSIGNMENT:
- {
- alt58=1;
- }
- break;
- case BOOLTOK:
- case CHARTOK:
- case COMPLEXTOK:
- case CONSTTOK:
- case DOUBLETOK:
- case ENUMTOK:
- case FLOATINGPOINTTOK:
- case FLOATTOK:
- case IDENTIFIER:
- case IMAGINARYTOK:
- case INTEGERTOK:
- case INTTOK:
- case LCURL:
- case LONGTOK:
- case POINTER:
- case SHORTTOK:
- case SIGNEDTOK:
- case STRINGTOK:
- case STRUCTTOK:
- case UNSIGNEDTOK:
- case VARIANTTOK:
- case VOIDTOK:
- {
- alt58=2;
- }
- break;
- case TYPEDEFTOK:
- {
- alt58=2;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- int nvaeMark = input.mark();
- try {
- input.consume();
- NoViableAltException nvae =
- new NoViableAltException("", 58, 5, input);
- throw nvae;
- } finally {
- input.rewind(nvaeMark);
- }
- }
- }
- break;
- case TYPEALIASTOK:
- {
- alt58=3;
- }
- break;
- default:
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 58, 0, input);
- throw nvae;
- }
- switch (alt58) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:635:5: left= unaryExpression (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) )
- {
- pushFollow(FOLLOW_unaryExpression_in_ctfAssignmentExpression3376);
- left=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_unaryExpression.add(left.getTree());
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:636:7: (assignment= ASSIGNMENT right1= unaryExpression -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) ) |type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) ) )
- int alt57=2;
- int LA57_0 = input.LA(1);
- if ( (LA57_0==ASSIGNMENT) ) {
- alt57=1;
- }
- else if ( (LA57_0==TYPE_ASSIGNMENT) ) {
- alt57=2;
- }
-
- else {
- if (state.backtracking>0) {state.failed=true; return retval;}
- NoViableAltException nvae =
- new NoViableAltException("", 57, 0, input);
- throw nvae;
- }
-
- switch (alt57) {
- case 1 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:636:9: assignment= ASSIGNMENT right1= unaryExpression
- {
- assignment=(Token)match(input,ASSIGNMENT,FOLLOW_ASSIGNMENT_in_ctfAssignmentExpression3388); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_ASSIGNMENT.add(assignment);
-
- pushFollow(FOLLOW_unaryExpression_in_ctfAssignmentExpression3392);
- right1=unaryExpression();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_unaryExpression.add(right1.getTree());
- // AST REWRITE
- // elements: right1, left
- // token labels:
- // rule labels: retval, left, right1
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
- RewriteRuleSubtreeStream stream_left=new RewriteRuleSubtreeStream(adaptor,"rule left",left!=null?left.getTree():null);
- RewriteRuleSubtreeStream stream_right1=new RewriteRuleSubtreeStream(adaptor,"rule right1",right1!=null?right1.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 637:11: -> ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:637:14: ^( CTF_EXPRESSION_VAL ^( CTF_LEFT $left) ^( CTF_RIGHT $right1) )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_EXPRESSION_VAL, "CTF_EXPRESSION_VAL"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:638:18: ^( CTF_LEFT $left)
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_LEFT, "CTF_LEFT"), root_2);
- adaptor.addChild(root_2, stream_left.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:639:18: ^( CTF_RIGHT $right1)
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_RIGHT, "CTF_RIGHT"), root_2);
- adaptor.addChild(root_2, stream_right1.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:640:9: type_assignment= TYPE_ASSIGNMENT right2= typeSpecifier
- {
- type_assignment=(Token)match(input,TYPE_ASSIGNMENT,FOLLOW_TYPE_ASSIGNMENT_in_ctfAssignmentExpression3468); if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_TYPE_ASSIGNMENT.add(type_assignment);
-
- pushFollow(FOLLOW_typeSpecifier_in_ctfAssignmentExpression3472);
- right2=typeSpecifier();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_typeSpecifier.add(right2.getTree());
- // AST REWRITE
- // elements: right2, left
- // token labels:
- // rule labels: retval, left, right2
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
- RewriteRuleSubtreeStream stream_left=new RewriteRuleSubtreeStream(adaptor,"rule left",left!=null?left.getTree():null);
- RewriteRuleSubtreeStream stream_right2=new RewriteRuleSubtreeStream(adaptor,"rule right2",right2!=null?right2.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 641:11: -> ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:641:14: ^( CTF_EXPRESSION_TYPE ^( CTF_LEFT $left) ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) ) )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_EXPRESSION_TYPE, "CTF_EXPRESSION_TYPE"), root_1);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:642:18: ^( CTF_LEFT $left)
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_LEFT, "CTF_LEFT"), root_2);
- adaptor.addChild(root_2, stream_left.nextTree());
- adaptor.addChild(root_1, root_2);
- }
-
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:643:18: ^( CTF_RIGHT ^( TYPE_SPECIFIER_LIST $right2) )
- {
- CommonTree root_2 = (CommonTree)adaptor.nil();
- root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(CTF_RIGHT, "CTF_RIGHT"), root_2);
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:643:30: ^( TYPE_SPECIFIER_LIST $right2)
- {
- CommonTree root_3 = (CommonTree)adaptor.nil();
- root_3 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPE_SPECIFIER_LIST, "TYPE_SPECIFIER_LIST"), root_3);
- adaptor.addChild(root_3, stream_right2.nextTree());
- adaptor.addChild(root_2, root_3);
- }
-
- adaptor.addChild(root_1, root_2);
- }
-
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
-
- }
-
- }
- break;
- case 2 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:5: ( declarationSpecifiers {...}? declaratorList )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:5: ( declarationSpecifiers {...}? declaratorList )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:645:6: declarationSpecifiers {...}? declaratorList
- {
- pushFollow(FOLLOW_declarationSpecifiers_in_ctfAssignmentExpression3555);
- declarationSpecifiers176=declarationSpecifiers();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declarationSpecifiers.add(declarationSpecifiers176.getTree());
- if ( !((inTypedef())) ) {
- if (state.backtracking>0) {state.failed=true; return retval;}
- throw new FailedPredicateException(input, "ctfAssignmentExpression", "inTypedef()");
- }
- pushFollow(FOLLOW_declaratorList_in_ctfAssignmentExpression3559);
- declaratorList177=declaratorList();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) stream_declaratorList.add(declaratorList177.getTree());
- }
-
- // AST REWRITE
- // elements: declarationSpecifiers, declaratorList
- // token labels:
- // rule labels: retval
- // token list labels:
- // rule list labels:
- // wildcard labels:
- if ( state.backtracking==0 ) {
- retval.tree = root_0;
- RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
-
- root_0 = (CommonTree)adaptor.nil();
- // 646:7: -> ^( TYPEDEF declaratorList declarationSpecifiers )
- {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:646:10: ^( TYPEDEF declaratorList declarationSpecifiers )
- {
- CommonTree root_1 = (CommonTree)adaptor.nil();
- root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TYPEDEF, "TYPEDEF"), root_1);
- adaptor.addChild(root_1, stream_declaratorList.nextTree());
- adaptor.addChild(root_1, stream_declarationSpecifiers.nextTree());
- adaptor.addChild(root_0, root_1);
- }
-
- }
-
-
- retval.tree = root_0;
- }
-
- }
- break;
- case 3 :
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:647:5: typealiasDecl
- {
- root_0 = (CommonTree)adaptor.nil();
-
-
- pushFollow(FOLLOW_typealiasDecl_in_ctfAssignmentExpression3582);
- typealiasDecl178=typealiasDecl();
- state._fsp--;
- if (state.failed) return retval;
- if ( state.backtracking==0 ) adaptor.addChild(root_0, typealiasDecl178.getTree());
-
- }
- break;
-
- }
- retval.stop = input.LT(-1);
-
- if ( state.backtracking==0 ) {
- retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
- adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
- }
- if ( state.backtracking==0 ) {
- if (inTypedef()) {
- typedefOff();
- }
- }
- }
-
- catch (RecognitionException e) {
- throw e;
- }
-
- finally {
- // do for sure before leaving
- }
- return retval;
- }
- // $ANTLR end "ctfAssignmentExpression"
-
- // $ANTLR start synpred1_CTFParser
- public final void synpred1_CTFParser_fragment() throws RecognitionException {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:5: ( IDENTIFIER )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:209:6: IDENTIFIER
- {
- match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_synpred1_CTFParser560); if (state.failed) return;
-
- }
-
- }
- // $ANTLR end synpred1_CTFParser
-
- // $ANTLR start synpred2_CTFParser
- public final void synpred2_CTFParser_fragment() throws RecognitionException {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:5: ( ctfKeyword )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:211:6: ctfKeyword
- {
- pushFollow(FOLLOW_ctfKeyword_in_synpred2_CTFParser586);
- ctfKeyword();
- state._fsp--;
- if (state.failed) return;
-
- }
-
- }
- // $ANTLR end synpred2_CTFParser
-
- // $ANTLR start synpred3_CTFParser
- public final void synpred3_CTFParser_fragment() throws RecognitionException {
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:5: ( STRING_LITERAL )
- // org/eclipse/tracecompass/ctf/parser/CTFParser.g:212:6: STRING_LITERAL
- {
- match(input,STRING_LITERAL,FOLLOW_STRING_LITERAL_in_synpred3_CTFParser606); if (state.failed) return;
-
- }
-
- }
- // $ANTLR end synpred3_CTFParser
-
- // Delegated rules
-
- public final boolean synpred2_CTFParser() {
- state.backtracking++;
- int start = input.mark();
- try {
- synpred2_CTFParser_fragment(); // can never throw exception
- } catch (RecognitionException re) {
- System.err.println("impossible: "+re);
- }
- boolean success = !state.failed;
- input.rewind(start);
- state.backtracking--;
- state.failed=false;
- return success;
- }
- public final boolean synpred1_CTFParser() {
- state.backtracking++;
- int start = input.mark();
- try {
- synpred1_CTFParser_fragment(); // can never throw exception
- } catch (RecognitionException re) {
- System.err.println("impossible: "+re);
- }
- boolean success = !state.failed;
- input.rewind(start);
- state.backtracking--;
- state.failed=false;
- return success;
- }
- public final boolean synpred3_CTFParser() {
- state.backtracking++;
- int start = input.mark();
- try {
- synpred3_CTFParser_fragment(); // can never throw exception
- } catch (RecognitionException re) {
- System.err.println("impossible: "+re);
- }
- boolean success = !state.failed;
- input.rewind(start);
- state.backtracking--;
- state.failed=false;
- return success;
- }
-
-
- protected DFA23 dfa23 = new DFA23(this);
- static final String DFA23_eotS =
- "\10\uffff";
- static final String DFA23_eofS =
- "\10\uffff";
- static final String DFA23_minS =
- "\1\46\1\24\1\0\1\24\1\0\2\uffff\1\0";
- static final String DFA23_maxS =
- "\2\72\1\0\1\72\1\0\2\uffff\1\0";
- static final String DFA23_acceptS =
- "\5\uffff\1\1\1\2\1\uffff";
- static final String DFA23_specialS =
- "\2\uffff\1\2\1\uffff\1\1\2\uffff\1\0}>";
- static final String[] DFA23_transitionS = {
- "\1\2\23\uffff\1\1",
- "\1\3\21\uffff\1\4\23\uffff\1\1",
- "\1\uffff",
- "\1\3\21\uffff\1\7\23\uffff\1\1",
- "\1\uffff",
- "",
- "",
- "\1\uffff"
- };
-
- static final short[] DFA23_eot = DFA.unpackEncodedString(DFA23_eotS);
- static final short[] DFA23_eof = DFA.unpackEncodedString(DFA23_eofS);
- static final char[] DFA23_min = DFA.unpackEncodedStringToUnsignedChars(DFA23_minS);
- static final char[] DFA23_max = DFA.unpackEncodedStringToUnsignedChars(DFA23_maxS);
- static final short[] DFA23_accept = DFA.unpackEncodedString(DFA23_acceptS);
- static final short[] DFA23_special = DFA.unpackEncodedString(DFA23_specialS);
- static final short[][] DFA23_transition;
-
- static {
- int numStates = DFA23_transitionS.length;
- DFA23_transition = new short[numStates][];
- for (int i=0; i<numStates; i++) {
- DFA23_transition[i] = DFA.unpackEncodedString(DFA23_transitionS[i]);
- }
- }
-
- protected class DFA23 extends DFA {
-
- public DFA23(BaseRecognizer recognizer) {
- this.recognizer = recognizer;
- this.decisionNumber = 23;
- this.eot = DFA23_eot;
- this.eof = DFA23_eof;
- this.min = DFA23_min;
- this.max = DFA23_max;
- this.accept = DFA23_accept;
- this.special = DFA23_special;
- this.transition = DFA23_transition;
- }
- @Override
- public String getDescription() {
- return "368:10: ({...}? => declaratorList -> ^( TYPEDEF declaratorList declarationSpecifiers ) | structOrVariantDeclaratorList -> ^( SV_DECLARATION declarationSpecifiers structOrVariantDeclaratorList ) )";
- }
- @Override
- public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
- TokenStream input = (TokenStream)_input;
- int _s = s;
- switch ( s ) {
- case 0 :
- int LA23_7 = input.LA(1);
-
- int index23_7 = input.index();
- input.rewind();
- s = -1;
- if ( ((inTypedef())) ) {s = 5;}
- else if ( (true) ) {s = 6;}
-
- input.seek(index23_7);
- if ( s>=0 ) return s;
- break;
-
- case 1 :
- int LA23_4 = input.LA(1);
-
- int index23_4 = input.index();
- input.rewind();
- s = -1;
- if ( ((inTypedef())) ) {s = 5;}
- else if ( (true) ) {s = 6;}
-
- input.seek(index23_4);
- if ( s>=0 ) return s;
- break;
-
- case 2 :
- int LA23_2 = input.LA(1);
-
- int index23_2 = input.index();
- input.rewind();
- s = -1;
- if ( ((inTypedef())) ) {s = 5;}
- else if ( (true) ) {s = 6;}
-
- input.seek(index23_2);
- if ( s>=0 ) return s;
- break;
- }
- if (state.backtracking>0) {state.failed=true; return -1;}
- NoViableAltException nvae =
- new NoViableAltException(getDescription(), 23, _s, input);
- error(nvae);
- throw nvae;
- }
- }
-
- public static final BitSet FOLLOW_declaration_in_parse449 = new BitSet(new long[]{0x40004AC1DA182B00L,0x000000000001CE95L});
- public static final BitSet FOLLOW_EOF_in_parse452 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_SIGN_in_numberLiteral474 = new BitSet(new long[]{0x8040001000200000L});
- public static final BitSet FOLLOW_HEX_LITERAL_in_numberLiteral485 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_DECIMAL_LITERAL_in_numberLiteral506 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_OCTAL_LITERAL_in_numberLiteral527 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_primaryExpression565 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfKeyword_in_primaryExpression591 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_LITERAL_in_primaryExpression611 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_numberLiteral_in_primaryExpression636 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumConstant_in_primaryExpression642 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_CHARACTER_LITERAL_in_primaryExpression648 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_OPENBRAC_in_postfixExpressionSuffix661 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_postfixExpressionSuffix663 = new BitSet(new long[]{0x0000000000004000L});
- public static final BitSet FOLLOW_CLOSEBRAC_in_postfixExpressionSuffix665 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_DOT_in_postfixExpressionSuffix675 = new BitSet(new long[]{0x0000004000000000L});
- public static final BitSet FOLLOW_ARROW_in_postfixExpressionSuffix681 = new BitSet(new long[]{0x0000004000000000L});
- public static final BitSet FOLLOW_IDENTIFIER_in_postfixExpressionSuffix684 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_primaryExpression_in_postfixExpression716 = new BitSet(new long[]{0x0200000000800022L});
- public static final BitSet FOLLOW_postfixExpressionSuffix_in_postfixExpression718 = new BitSet(new long[]{0x0200000000800022L});
- public static final BitSet FOLLOW_ctfSpecifierHead_in_postfixExpression725 = new BitSet(new long[]{0x0200000000800020L});
- public static final BitSet FOLLOW_postfixExpressionSuffix_in_postfixExpression727 = new BitSet(new long[]{0x0200000000800022L});
- public static final BitSet FOLLOW_postfixExpression_in_unaryExpression743 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_LITERAL_in_enumConstant760 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_enumConstant774 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfKeyword_in_enumConstant788 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_declaration816 = new BitSet(new long[]{0x0400004000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_declaratorList_in_declaration818 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_TERM_in_declaration821 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfSpecifier_in_declaration889 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_TERM_in_declaration891 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_storageClassSpecifier_in_declarationSpecifiers929 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
- public static final BitSet FOLLOW_typeQualifier_in_declarationSpecifiers939 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
- public static final BitSet FOLLOW_typeSpecifier_in_declarationSpecifiers949 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C891L});
- public static final BitSet FOLLOW_declarator_in_declaratorList979 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_SEPARATOR_in_declaratorList982 = new BitSet(new long[]{0x0400004000000000L});
- public static final BitSet FOLLOW_declarator_in_declaratorList984 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_abstractDeclarator_in_abstractDeclaratorList1014 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_SEPARATOR_in_abstractDeclaratorList1017 = new BitSet(new long[]{0x0400804000000000L});
- public static final BitSet FOLLOW_abstractDeclarator_in_abstractDeclaratorList1019 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_TYPEDEFTOK_in_storageClassSpecifier1049 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOATTOK_in_typeSpecifier1065 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INTTOK_in_typeSpecifier1071 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LONGTOK_in_typeSpecifier1077 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_SHORTTOK_in_typeSpecifier1083 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_SIGNEDTOK_in_typeSpecifier1089 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_UNSIGNEDTOK_in_typeSpecifier1095 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_CHARTOK_in_typeSpecifier1101 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_DOUBLETOK_in_typeSpecifier1107 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VOIDTOK_in_typeSpecifier1113 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_BOOLTOK_in_typeSpecifier1119 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_COMPLEXTOK_in_typeSpecifier1125 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IMAGINARYTOK_in_typeSpecifier1131 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_structSpecifier_in_typeSpecifier1137 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variantSpecifier_in_typeSpecifier1143 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumSpecifier_in_typeSpecifier1149 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfTypeSpecifier_in_typeSpecifier1155 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_typedefName_in_typeSpecifier1165 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_CONSTTOK_in_typeQualifier1178 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ALIGNTOK_in_alignAttribute1191 = new BitSet(new long[]{0x0000800000000000L});
- public static final BitSet FOLLOW_LPAREN_in_alignAttribute1193 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_alignAttribute1195 = new BitSet(new long[]{0x1000000000000000L});
- public static final BitSet FOLLOW_RPAREN_in_alignAttribute1197 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LCURL_in_structBody1231 = new BitSet(new long[]{0x48004AC18A180900L,0x000000000001CC91L});
- public static final BitSet FOLLOW_structOrVariantDeclarationList_in_structBody1233 = new BitSet(new long[]{0x0800000000000000L});
- public static final BitSet FOLLOW_RCURL_in_structBody1236 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRUCTTOK_in_structSpecifier1264 = new BitSet(new long[]{0x0000104000000000L});
- public static final BitSet FOLLOW_structName_in_structSpecifier1289 = new BitSet(new long[]{0x0000100000000012L});
- public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1311 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_structBody_in_structSpecifier1347 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1378 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_structBody_in_structSpecifier1494 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_alignAttribute_in_structSpecifier1512 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_structName1578 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_structOrVariantDeclaration_in_structOrVariantDeclarationList1599 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001CC91L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_structOrVariantDeclaration1632 = new BitSet(new long[]{0x0400004000000000L});
- public static final BitSet FOLLOW_declaratorList_in_structOrVariantDeclaration1673 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_structOrVariantDeclaratorList_in_structOrVariantDeclaration1713 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_typealiasDecl_in_structOrVariantDeclaration1772 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_TERM_in_structOrVariantDeclaration1784 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_typeQualifier_in_specifierQualifierList1798 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C091L});
- public static final BitSet FOLLOW_typeSpecifier_in_specifierQualifierList1802 = new BitSet(new long[]{0x40004AC18A180902L,0x000000000001C091L});
- public static final BitSet FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1835 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_SEPARATOR_in_structOrVariantDeclaratorList1838 = new BitSet(new long[]{0x0400004000000000L});
- public static final BitSet FOLLOW_structOrVariantDeclarator_in_structOrVariantDeclaratorList1840 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_declarator_in_structOrVariantDeclarator1879 = new BitSet(new long[]{0x0000000000008002L});
- public static final BitSet FOLLOW_COLON_in_structOrVariantDeclarator1882 = new BitSet(new long[]{0x8040001000200000L});
- public static final BitSet FOLLOW_numberLiteral_in_structOrVariantDeclarator1884 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_VARIANTTOK_in_variantSpecifier1908 = new BitSet(new long[]{0x0001104000000000L});
- public static final BitSet FOLLOW_variantName_in_variantSpecifier1926 = new BitSet(new long[]{0x0001100000000000L});
- public static final BitSet FOLLOW_variantTag_in_variantSpecifier1956 = new BitSet(new long[]{0x0000100000000002L});
- public static final BitSet FOLLOW_variantBody_in_variantSpecifier1982 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variantBody_in_variantSpecifier2050 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variantTag_in_variantSpecifier2071 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_variantBody_in_variantSpecifier2073 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_variantBody_in_variantSpecifier2080 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_variantName2112 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LCURL_in_variantBody2143 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001CC91L});
- public static final BitSet FOLLOW_structOrVariantDeclarationList_in_variantBody2145 = new BitSet(new long[]{0x0800000000000000L});
- public static final BitSet FOLLOW_RCURL_in_variantBody2147 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LT_in_variantTag2174 = new BitSet(new long[]{0x0000004000000000L});
- public static final BitSet FOLLOW_IDENTIFIER_in_variantTag2176 = new BitSet(new long[]{0x0000000200000000L});
- public static final BitSet FOLLOW_GT_in_variantTag2178 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ENUMTOK_in_enumSpecifier2199 = new BitSet(new long[]{0x0000104000008000L});
- public static final BitSet FOLLOW_enumName_in_enumSpecifier2238 = new BitSet(new long[]{0x0000100000008002L});
- public static final BitSet FOLLOW_enumContainerType_in_enumSpecifier2270 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_enumBody_in_enumSpecifier2272 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumBody_in_enumSpecifier2302 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumContainerType_in_enumSpecifier2394 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_enumBody_in_enumSpecifier2396 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumBody_in_enumSpecifier2420 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_enumName2464 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LCURL_in_enumBody2485 = new BitSet(new long[]{0x0000004040000010L,0x0000000000000051L});
- public static final BitSet FOLLOW_enumeratorList_in_enumBody2487 = new BitSet(new long[]{0x2800000000000000L});
- public static final BitSet FOLLOW_SEPARATOR_in_enumBody2489 = new BitSet(new long[]{0x0800000000000000L});
- public static final BitSet FOLLOW_RCURL_in_enumBody2492 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_COLON_in_enumContainerType2513 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001C891L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_enumContainerType2515 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_enumerator_in_enumeratorList2536 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_SEPARATOR_in_enumeratorList2539 = new BitSet(new long[]{0x0000004040000010L,0x0000000000000051L});
- public static final BitSet FOLLOW_enumerator_in_enumeratorList2541 = new BitSet(new long[]{0x2000000000000002L});
- public static final BitSet FOLLOW_enumConstant_in_enumerator2567 = new BitSet(new long[]{0x0000000000000042L});
- public static final BitSet FOLLOW_enumeratorValue_in_enumerator2569 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ASSIGNMENT_in_enumeratorValue2583 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_enumeratorValue2587 = new BitSet(new long[]{0x0000000004000002L});
- public static final BitSet FOLLOW_ELIPSES_in_enumeratorValue2626 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_enumeratorValue2630 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_pointer_in_declarator2673 = new BitSet(new long[]{0x0400004000000000L});
- public static final BitSet FOLLOW_directDeclarator_in_declarator2676 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_directDeclarator2714 = new BitSet(new long[]{0x0200000000000002L});
- public static final BitSet FOLLOW_directDeclaratorSuffix_in_directDeclarator2754 = new BitSet(new long[]{0x0200000000000002L});
- public static final BitSet FOLLOW_OPENBRAC_in_directDeclaratorSuffix2768 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_directDeclaratorLength_in_directDeclaratorSuffix2770 = new BitSet(new long[]{0x0000000000004000L});
- public static final BitSet FOLLOW_CLOSEBRAC_in_directDeclaratorSuffix2772 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_unaryExpression_in_directDeclaratorLength2800 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_pointer_in_abstractDeclarator2813 = new BitSet(new long[]{0x0400804000000002L});
- public static final BitSet FOLLOW_directAbstractDeclarator_in_abstractDeclarator2816 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_directAbstractDeclarator_in_abstractDeclarator2841 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_directAbstractDeclarator2878 = new BitSet(new long[]{0x0200000000000002L});
- public static final BitSet FOLLOW_LPAREN_in_directAbstractDeclarator2889 = new BitSet(new long[]{0x0400804000000000L});
- public static final BitSet FOLLOW_abstractDeclarator_in_directAbstractDeclarator2891 = new BitSet(new long[]{0x1000000000000000L});
- public static final BitSet FOLLOW_RPAREN_in_directAbstractDeclarator2893 = new BitSet(new long[]{0x0200000000000002L});
- public static final BitSet FOLLOW_OPENBRAC_in_directAbstractDeclarator2908 = new BitSet(new long[]{0x8040005050206610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_directAbstractDeclarator2910 = new BitSet(new long[]{0x0000000000004000L});
- public static final BitSet FOLLOW_CLOSEBRAC_in_directAbstractDeclarator2913 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_POINTER_in_pointer2931 = new BitSet(new long[]{0x0000000000100002L});
- public static final BitSet FOLLOW_typeQualifierList_in_pointer2933 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_typeQualifier_in_typeQualifierList2956 = new BitSet(new long[]{0x0000000000100002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_typedefName2972 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_typealiasTarget2989 = new BitSet(new long[]{0x0400804000000002L});
- public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasTarget2991 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasAlias3017 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_typealiasAlias3023 = new BitSet(new long[]{0x0400804000000002L});
- public static final BitSet FOLLOW_abstractDeclaratorList_in_typealiasAlias3025 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_TYPEALIASTOK_in_typealiasDecl3039 = new BitSet(new long[]{0x40004AC18A180900L,0x000000000001C891L});
- public static final BitSet FOLLOW_typealiasTarget_in_typealiasDecl3041 = new BitSet(new long[]{0x0000000000000000L,0x0000000000001000L});
- public static final BitSet FOLLOW_TYPE_ASSIGNMENT_in_typealiasDecl3043 = new BitSet(new long[]{0x4400CAC18A180900L,0x000000000001C891L});
- public static final BitSet FOLLOW_typealiasAlias_in_typealiasDecl3045 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfSpecifierHead_in_ctfSpecifier3145 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_ctfBody_in_ctfSpecifier3147 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_typealiasDecl_in_ctfSpecifier3164 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_EVENTTOK_in_ctfSpecifierHead3185 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STREAMTOK_in_ctfSpecifierHead3195 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_TRACETOK_in_ctfSpecifierHead3205 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ENVTOK_in_ctfSpecifierHead3215 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_CLOCKTOK_in_ctfSpecifierHead3225 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_CALLSITETOK_in_ctfSpecifierHead3235 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOATINGPOINTTOK_in_ctfTypeSpecifier3258 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3260 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INTEGERTOK_in_ctfTypeSpecifier3275 = new BitSet(new long[]{0x0000100000000000L});
- public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3277 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRINGTOK_in_ctfTypeSpecifier3292 = new BitSet(new long[]{0x0000100000000002L});
- public static final BitSet FOLLOW_ctfBody_in_ctfTypeSpecifier3294 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_LCURL_in_ctfBody3327 = new BitSet(new long[]{0xC8404AD1DA382F10L,0x000000000001CED5L});
- public static final BitSet FOLLOW_ctfAssignmentExpressionList_in_ctfBody3329 = new BitSet(new long[]{0x0800000000000000L});
- public static final BitSet FOLLOW_RCURL_in_ctfBody3332 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfAssignmentExpression_in_ctfAssignmentExpressionList3351 = new BitSet(new long[]{0x0000000000000000L,0x0000000000000100L});
- public static final BitSet FOLLOW_TERM_in_ctfAssignmentExpressionList3353 = new BitSet(new long[]{0xC0404AD1DA382F12L,0x000000000001CED5L});
- public static final BitSet FOLLOW_unaryExpression_in_ctfAssignmentExpression3376 = new BitSet(new long[]{0x0000000000000040L,0x0000000000001000L});
- public static final BitSet FOLLOW_ASSIGNMENT_in_ctfAssignmentExpression3388 = new BitSet(new long[]{0x8040005050202610L,0x0000000000000255L});
- public static final BitSet FOLLOW_unaryExpression_in_ctfAssignmentExpression3392 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_TYPE_ASSIGNMENT_in_ctfAssignmentExpression3468 = new BitSet(new long[]{0x40004AC18A080900L,0x000000000001C091L});
- public static final BitSet FOLLOW_typeSpecifier_in_ctfAssignmentExpression3472 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_declarationSpecifiers_in_ctfAssignmentExpression3555 = new BitSet(new long[]{0x0400004000000000L});
- public static final BitSet FOLLOW_declaratorList_in_ctfAssignmentExpression3559 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_typealiasDecl_in_ctfAssignmentExpression3582 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_IDENTIFIER_in_synpred1_CTFParser560 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ctfKeyword_in_synpred2_CTFParser586 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_LITERAL_in_synpred3_CTFParser606 = new BitSet(new long[]{0x0000000000000002L});
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.ctf</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-bin.includes = feature.xml,\
- feature.properties,\
- p2.inf
-src.includes = sourceTemplateFeature/p2.inf
+++ /dev/null
-###############################################################################
-# Copyright (c) 2008, 2015 Red Hat, Inc., Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-featureName=CTF (Common Trace Format) Parser
-
-description=Plug-ins to integrate a Common Trace Format (CTF) Parser into the workbench.
-
-featureProvider=Eclipse Trace Compass
-
-copyright=Copyright 2015 Ericsson
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.tracecompass.ctf"
- label="%featureName"
- version="1.0.0.qualifier"
- provider-name="%featureProvider"
- license-feature="org.eclipse.license"
- license-feature-version="0.0.0">
-
- <description url="http://www.example.com/description">
- %description
- </description>
-
- <copyright url="http://www.example.com/copyright">
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <requires>
- <import plugin="org.antlr.runtime" version="3.2.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.core.runtime"/>
- </requires>
-
- <plugin
- id="org.eclipse.tracecompass.ctf.parser"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.tracecompass.ctf.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
+++ /dev/null
-instructions.configure=\
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tracecompass/master/repository,type:0,name:Trace Compass,enabled:false); \
-org.eclipse.equinox.p2.touchpoint.eclipse.addRepository(location:http${#58}//download.eclipse.org/tracecompass/master/repository,type:1,name:Trace Compass,enabled:false);
-
-update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.ctf.feature.group' || pc.name == 'org.eclipse.tracecompass.ctf.feature.group'))
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <name>Trace Compass CTF (Common Trace Format) Feature</name>
- <artifactId>org.eclipse.tracecompass.ctf</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
-
- <packaging>eclipse-feature</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho.extras</groupId>
- <artifactId>tycho-source-feature-plugin</artifactId>
- <executions>
- <execution>
- <id>source-feature</id>
- <phase>package</phase>
- <goals>
- <goal>source-feature</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-p2-plugin</artifactId>
- <version>${tycho-version}</version>
- <executions>
- <execution>
- <id>attached-p2-metadata</id>
- <phase>package</phase>
- <goals>
- <goal>p2-metadata</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.ctf.source.feature.group' || pc.name == 'org.eclipse.tracecompass.ctf.source.feature.group'))
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="perf"/>
- <classpathentry kind="src" path="shared"/>
- <classpathentry kind="src" path="stubs"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.tmf.ctf.core.tests</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=2
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.core.tests;singleton:=true
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.junit;bundle-version="4.0.0",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.tracecompass.tmf.core,
- org.eclipse.tracecompass.tmf.core.tests,
- org.eclipse.tracecompass.tmf.ctf.core,
- org.eclipse.tracecompass.ctf.core,
- org.eclipse.tracecompass.ctf.core.tests
-Export-Package: org.eclipse.tracecompass.tmf.ctf.core.tests,
- org.eclipse.tracecompass.tmf.ctf.core.tests.perf,
- org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;x-internal:=true,
- org.eclipse.tracecompass.tmf.ctf.core.tests.shared,
- org.eclipse.tracecompass.tmf.ctf.core.tests.stubs,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;x-internal:=true,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;x-internal:=true,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;x-internal:=true,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;x-internal:=true
-Import-Package: com.google.common.collect,
- org.eclipse.test.performance
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = src/,\
- perf/,\
- shared/,\
- stubs
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- plugin.xml,\
- about.html
-src.includes = about.html
-additional.bundles = org.eclipse.jdt.annotation
-jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial implementation and API
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.perf;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * The class <code>AllPerformanceTests</code> builds a suite that can be used to
- * run all of the performance tests within its package as well as within any
- * subpackages of its package.
- *
- * @author Geneviève Bastien
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment.AllPerfTests.class
-})
-public class AllPerfTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ExperimentBenchmark.class
-})
-public class AllPerfTests {
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Geneviève Bastien - Convert to JUnit performance test
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.perf.experiment;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.test.performance.Dimension;
-import org.eclipse.test.performance.Performance;
-import org.eclipse.test.performance.PerformanceMeter;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest.ExecutionType;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfExperimentStub;
-import org.junit.Test;
-
-/**
- * Coalescing benchmark
- *
- * @author Matthew Khouzam
- */
-public class ExperimentBenchmark {
-
- private static final String TEST_ID = "org.eclipse.linuxtools#Experiment benchmark#";
- private static final int MAX_TRACES = 160;
- private static final int BLOCK_SIZE = 100;
- private static final String TRACES_ROOT_PATH = CtfTestTrace.TRACE_EXPERIMENT.getPath();
- private static final int SAMPLE_SIZE_SLOW = 20;
- private static final int SAMPLE_SIZE = 100;
-
- private TmfExperimentStub fExperiment;
-
- /**
- * Run the benchmark
- */
- @Test
- public void benchmarkExperimentSizeRequest() {
- Performance perf = Performance.getDefault();
-
- for (int numTraces = 1; numTraces < MAX_TRACES; numTraces = (int) (1.6 * (numTraces + 1))) {
- PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + numTraces + " traces");
- perf.tagAsSummary(pm, "Experiment Benchmark:" + numTraces + " traces", Dimension.CPU_TIME);
- if ((int) (1.6 * (numTraces + 1)) > MAX_TRACES) {
- perf.tagAsGlobalSummary(pm, "Experiment Benchmark:" + numTraces + " traces", Dimension.CPU_TIME);
- }
-
- int sampleSize = SAMPLE_SIZE;
- if (numTraces > 20) {
- sampleSize = SAMPLE_SIZE_SLOW;
- }
-
- for (int s = 0; s < sampleSize; s++) {
-
- InnerEventRequest expReq = new InnerEventRequest(ITmfEvent.class, 0, ITmfEventRequest.ALL_DATA, ExecutionType.BACKGROUND);
- InnerEventRequest traceReq[] = new InnerEventRequest[numTraces];
-
- init(numTraces);
- fExperiment.sendRequest(expReq);
- List<ITmfTrace> traces = fExperiment.getTraces();
- for (int i = 0; i < numTraces; i++) {
- traceReq[i] = new InnerEventRequest(ITmfEvent.class, 0, ITmfEventRequest.ALL_DATA, ExecutionType.BACKGROUND);
- traces.get(i).sendRequest(traceReq[i]);
- }
-
- pm.start();
- waitForRequest(expReq, traceReq);
- pm.stop();
-
- for (int i = 0; i < traces.size(); i++) {
- if (!expReq.isTraceHandled(traces.get(i))) {
- System.err.println("Trace " + i + " not handled!");
- }
- }
-
- fExperiment.dispose();
- }
- pm.commit();
- }
- }
-
- /**
- * Initialization
- *
- * @param maxTraces
- * maximum number of traces to open
- */
- private void init(int maxTraces) {
- try {
- File parentDir = new File(TRACES_ROOT_PATH);
- File[] traceFiles = parentDir.listFiles();
- ITmfTrace[] traces = new CtfTmfTrace[Math.min(maxTraces, traceFiles.length)];
- for (int i = 0; i < traces.length; i++) {
- traces[i] = new CtfTmfTrace();
- }
- fExperiment = new TmfExperimentStub("MegaExperiment", traces, BLOCK_SIZE);
- int j = 0;
- for (int i = 0; i < (traces.length) && (j < traces.length); i++) {
- String absolutePath = traceFiles[j].getAbsolutePath();
- if (traces[i].validate(null, absolutePath).isOK()) {
- traces[i].initTrace(null, absolutePath, ITmfEvent.class);
- } else {
- i--;
- }
- j++;
- }
- if (traces[traces.length - 1].getPath() == null) {
- throw new TmfTraceException("Insufficient valid traces in directory");
- }
- } catch (TmfTraceException e) {
- System.out.println(e.getMessage());
- }
- }
-
- private static void waitForRequest(InnerEventRequest expReq, InnerEventRequest[] traceReqs) {
- try {
- expReq.waitForCompletion();
- List<InnerEventRequest> reqs = Arrays.asList(traceReqs);
- for (InnerEventRequest traceReq : reqs) {
- traceReq.waitForCompletion();
- }
- } catch (InterruptedException e) {
- }
- }
-
- private static class InnerEventRequest extends TmfEventRequest {
- private Set<String> fTraces = new HashSet<>();
-
- public InnerEventRequest(Class<? extends ITmfEvent> dataType, long index, int nbRequested, ExecutionType priority) {
- super(dataType, index, nbRequested, priority);
- }
-
- @Override
- public void handleData(ITmfEvent event) {
- super.handleData(event);
- if (!fTraces.contains(event.getTrace().getName())) {
- fTraces.add(event.getTrace().getName());
- }
- }
-
- public boolean isTraceHandled(ITmfTrace trace) {
- return fTraces.contains(trace.getName());
- }
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = CTF support for TMF Core Tests Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.linuxtools.tmf.core.tracetype">
- <type
- category="org.eclipse.linuxtools.tmf.core.tests.category"
- event_type="org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent"
- id="org.eclipse.linuxtools.tmf.ctf.core.tests.ctf.tracetype"
- isDirectory="true"
- name="CTF Test Trace"
- trace_type="org.eclipse.tracecompass.tmf.ctf.core.tests.stubs.CtfTmfTraceStub">
- </type>
- </extension>
-
-</plugin>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.tracecompass.tmf.ctf.core.tests</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <name>CTF Support for TMF Core Tests Plug-in</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <id>prepare</id>
- <phase>validate</phase>
- <configuration>
- <target>
- <echo message="prepare phase" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <includes>
- <include>**/AllTests.*</include>
- </includes>
- <useUIHarness>false</useUIHarness>
- <useUIThread>false</useUIThread>
- <product>org.eclipse.platform.ide</product>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <groupId>org.eclipse.tracecompass</groupId>
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.shared;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.stubs.CtfTmfTraceStub;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
- *
- * To run tests using these, you first need to run the "get-traces.[xml|sh]"
- * script located under lttng/org.eclipse.tracecompass.ctf.core.tests/traces/ .
- *
- * @author Alexandre Montplaisir
- */
-@NonNullByDefault
-public enum CtfTmfTestTrace {
- /** Example kernel trace */
- KERNEL,
- /** Another kernel trace */
- TRACE2,
- /** Kernel trace with event contexts */
- KERNEL_VM,
- /** Trace synchronization: source trace */
- SYNC_SRC,
- /** Trace synchronization: destination trace */
- SYNC_DEST,
- /** Trace synchronization (case 2): django client trace */
- DJANGO_CLIENT,
- /** Trace synchronization (case 2): django db trace */
- DJANGO_DB,
- /** Trace synchronization (case 2): django web server trace */
- DJANGO_HTTPD,
- /** UST trace with lots of lost events */
- HELLO_LOST,
- /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
- CYG_PROFILE,
- /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
- CYG_PROFILE_FAST,
- /** Autogenerated Syntetic trace */
- SYNTHETIC_TRACE,
- /** Trace with non-standard field sizes */
- FUNKY_TRACE;
-
-
- private final String fPath;
- private @Nullable CtfTmfTraceStub fTrace = null;
-
- private CtfTmfTestTrace() {
- @SuppressWarnings("null")
- @NonNull String path = CtfTestTrace.valueOf(this.name()).getPath();
- fPath = path;
- }
-
- /**
- * @return The path of this trace
- */
- public String getPath() {
- return fPath;
- }
-
- /**
- * Return a CtfTmfTraceStub object of this test trace. It will be already
- * initTrace()'ed.
- *
- * Make sure you call {@link #exists()} before calling this!
- *
- * After being used by unit tests, traces must be properly disposed of by
- * calling the {@link CtfTmfTestTrace#dispose()} method.
- *
- * @return A CtfTmfTrace reference to this trace
- */
- public synchronized CtfTmfTrace getTrace() {
- CtfTmfTraceStub trace = fTrace;
- if (trace != null) {
- trace.close();
- }
- trace = new CtfTmfTraceStub();
- try {
- trace.initTrace(null, fPath, CtfTmfEvent.class);
- } catch (TmfTraceException e) {
- /* Should not happen if tracesExist() passed */
- throw new RuntimeException(e);
- }
- fTrace = trace;
- return trace;
- }
-
- /**
- * Check if the trace actually exists on disk or not.
- *
- * @return If the trace is present
- */
- public boolean exists() {
- return CtfTestTrace.valueOf(this.name()).exists();
- }
-
- /**
- * Dispose of the trace
- */
- public void dispose() {
- if (fTrace != null) {
- fTrace.dispose();
- fTrace = null;
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests;
-
-import org.eclipse.tracecompass.tmf.core.tests.shared.DebugSuite;
-import org.junit.runner.RunWith;
-
-/**
- * The class <code>TestAll</code> builds a suite that can be used to run all of
- * the tests within its package as well as within any subpackages of its
- * package.
- *
- * @author ematkho
- */
-@RunWith(DebugSuite.class)
-@DebugSuite.SuiteClasses({
- org.eclipse.tracecompass.tmf.ctf.core.tests.context.AllTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.event.AllTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.iterator.AllTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.trace.AllTests.class,
-
- /* Tests in other packages (that are there because of CTF) */
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request.AllTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics.AllTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager.AllTests.class
-})
-public class AllTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfLocationDataTest.class,
- CtfLocationTest.class,
- CtfTmfContextTest.class
-})
-public class AllTests {
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Collection of tests for the {@link CtfLocationInfo}
- *
- * @author alexmont
- */
-public class CtfLocationDataTest {
-
- private CtfLocationInfo fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new CtfLocationInfo(1, 0);
- }
-
- /**
- * Test for the .getTimestamp() and .getIndex() methods
- */
- @Test
- public void testGetters() {
- long timestamp = fixture.getTimestamp();
- long index = fixture.getIndex();
-
- assertEquals(1, timestamp);
- assertEquals(0, index);
- }
-
- /**
- * Test for the .hashCode() method
- */
- @Test
- public void testHashCode() {
- int code = fixture.hashCode();
- assertEquals(962, code);
- }
-
- /**
- * Test for the .equals() method
- */
- @Test
- public void testEquals() {
- CtfLocationInfo same = new CtfLocationInfo(1, 0);
- CtfLocationInfo diff1 = new CtfLocationInfo(100, 0);
- CtfLocationInfo diff2 = new CtfLocationInfo(1, 10);
-
- assertTrue(fixture.equals(same));
- assertFalse(fixture.equals(diff1));
- assertFalse(fixture.equals(diff2));
- }
-
- /**
- * Test for the .compareTo() method
- */
- @Test
- public void testCompareTo() {
- CtfLocationInfo same = new CtfLocationInfo(1, 0);
- CtfLocationInfo smaller = new CtfLocationInfo(0, 0);
- CtfLocationInfo bigger1 = new CtfLocationInfo(1000, 500);
- CtfLocationInfo bigger2 = new CtfLocationInfo(1, 1);
-
- assertEquals(0, same.compareTo(fixture));
- assertEquals(-1, smaller.compareTo(fixture));
- assertEquals(1, bigger1.compareTo(fixture));
- assertEquals(1, bigger2.compareTo(fixture));
- }
-
- /**
- * Test for the .toString() method
- */
- @Test
- public void testToString() {
- String expected = "Element [1/0]";
- assertEquals(expected, fixture.toString());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfLocationTest</code> contains tests for the class
- * <code>{@link CtfLocation}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfLocationTest {
-
- private CtfLocation fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- fixture = new CtfLocation(new CtfLocationInfo(1, 0));
- }
-
- /**
- * Run the CtfLocation(Long) constructor test.
- */
- @Test
- public void testCtfLocation_long() {
- CtfLocationInfo location = new CtfLocationInfo(1, 0);
- CtfLocation result = new CtfLocation(location);
-
- assertNotNull(result);
- assertEquals(1L, result.getLocationInfo().getTimestamp());
- }
-
- /**
- * Run the CtfLocation(ITmfTimestamp) constructor test.
- */
- @Test
- public void testCtfLocation_timestamp() {
- ITmfTimestamp timestamp = new TmfTimestamp();
- CtfLocation result = new CtfLocation(timestamp);
-
- assertNotNull(result);
- assertEquals(0L, result.getLocationInfo().getTimestamp());
- }
-
- /**
- * Run the Long getLocation() method test.
- */
- @Test
- public void testGetLocation() {
- CtfLocationInfo location = fixture.getLocationInfo();
- long result = location.getTimestamp();
- assertEquals(1L, result);
- }
-
- /**
- * Run the void setLocation(Long) method test.
- */
- @Test
- public void testSetLocation() {
- CtfLocationInfo location = new CtfLocationInfo(1337, 7331);
- fixture = new CtfLocation(location);
- }
-
- /**
- * Test the toString() method with a valid location.
- */
- @Test
- public void testToString_valid(){
- CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(1337, 7331));
- assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2.toString());
- }
-
- /**
- * Test the toString() method with an invalid location.
- */
- @Test
- public void testToString_invalid(){
- CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(-1, -1));
- assertEquals("CtfLocation [INVALID]", fixture2.toString());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial implementation
- * Alexandre Montplaisir
- * Patrick Tasse - Updated for removal of context clone
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.context;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for the CtfTmfLightweightContext class
- *
- * @author Matthew Khouzam
- * @version 1.1
- */
-public class CtfTmfContextTest {
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
- private static final long begin = 1332170682440133097L; /* Trace start time */
- private static final long end = 1332170692664579801L; /* Trace end time */
-
- private CtfTmfTrace trace;
-
- private class SeekerThread extends Thread {
- long val;
-
- public void setVal(long val) {
- this.val = val;
- }
- }
-
- /**
- * Pre-test initialization
- *
- * @throws TmfTraceException
- * If the trace couldn't be init'ed, which shouldn't happen.
- */
- @Before
- public void setUp() throws TmfTraceException {
- assumeTrue(testTrace.exists());
- trace = new CtfTmfTrace();
- String path = testTrace.getPath();
- trace.initTrace((IResource) null, path, CtfTmfEvent.class);
- }
-
- /**
- * Index all the events in the test trace.
- */
- @Test
- public void testIndexing() {
- CtfTmfContext context = new CtfTmfContext(trace);
- context.seek(0);
-
- int count = 0;
- while (trace.getNext(context) != null) {
- count++;
- }
- assertTrue(count > 0);
- }
-
- /**
- * Context fuzzer. Use an amount of contexts greater than the size of the
- * iterator cache and have them access the trace in parallel.
- *
- * @throws InterruptedException
- * Would fail the test
- */
- @Test
- public void testTooManyContexts() throws InterruptedException {
- final int lwcCount = 101;
- double increment = (end - begin) / lwcCount;
- final ArrayList<Long> vals = new ArrayList<>();
- final ArrayList<Thread> threads = new ArrayList<>();
- final ArrayList<CtfTmfContext> tooManyContexts = new ArrayList<>();
-
- for (double i = begin; i < end; i += increment) {
- SeekerThread thread = new SeekerThread() {
- @Override
- public void run() {
- CtfTmfContext lwc = new CtfTmfContext(trace);
- lwc.seek(val);
- trace.getNext(lwc);
- synchronized(trace){
- if (lwc.getCurrentEvent() != null) {
- vals.add(lwc.getCurrentEvent().getTimestamp().getValue());
- }
- tooManyContexts.add(lwc);
- }
- }
- };
- thread.setVal((long)i);
- threads.add(thread);
- thread.start();
- }
-
- for (Thread t: threads){
- t.join();
- }
-
- for (long val : vals){
- assertTrue(val >= begin);
- assertTrue(val <= end);
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfTmfEventFieldTest.class,
- CtfTmfEventTest.class,
- CtfTmfEventTypeTest.class,
- CtfTmfLostEventStatisticsTest.class,
- CtfTmfLostEventsTest.class,
- EventContextTest.class
-})
-public class AllTests {
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer;
-import org.eclipse.tracecompass.ctf.core.event.types.Encoding;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.StructDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDeclaration;
-import org.eclipse.tracecompass.internal.ctf.core.event.types.SequenceDeclaration;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventField;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventFieldTest</code> contains tests for the class
- * <code>{@link CtfTmfEventField}</code>.
- *
- * @author Matthew Khouzam
- * @version 1.0
- */
-public class CtfTmfEventFieldTest {
-
- private static final @NonNull String ROOT = "root";
- private static final String SEQ = "seq";
- private static final @NonNull String ARRAY_STR = "array_str";
- private static final @NonNull String ARRAY_FLOAT = "array_float";
- private static final @NonNull String ARRAY_INT = "array_int";
- private static final @NonNull String ARRAY_STRUCT = "array_struct";
- private static final @NonNull String ARRAY_VARIANT = "array_variant";
- private static final @NonNull String ARRAY_ENUM = "array_enum";
- private static final String STR = "str";
- private static final String FLOAT = "float";
- private static final String LEN = "len";
- private static final String INT = "int";
- private static final String NAME = "test";
- private static final String STRUCT = "struct";
- private static final String VARIANT = "variant";
- private static final String ENUM = "enum";
-
- private static final byte TEST_NUMBER = 2;
- private static final String TEST_STRING = "two";
-
- private static final int ARRAY_SIZE = 2;
-
- private StructDefinition fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws UnsupportedEncodingException
- * Thrown when UTF-8 encoding is not available.
- * @throws CTFException
- * error
- */
- @Before
- public void setUp() throws UnsupportedEncodingException, CTFException {
- final byte[] testStringBytes = TEST_STRING.getBytes("UTF-8");
-
- int capacity = 2048;
- ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
-
- StructDeclaration sDec = new StructDeclaration(1l);
- StringDeclaration strDec = StringDeclaration.getStringDeclaration(Encoding.UTF8);
- IntegerDeclaration intDec = IntegerDeclaration.UINT_8_DECL;
- FloatDeclaration flDec = new FloatDeclaration(8, 24,
- ByteOrder.BIG_ENDIAN, 8);
- SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
- StructDeclaration structDec = new StructDeclaration(8);
- EnumDeclaration enumDec = new EnumDeclaration(intDec);
- VariantDeclaration varDec = new VariantDeclaration();
- ArrayDeclaration arrStrDec = new ArrayDeclaration(ARRAY_SIZE, strDec);
- ArrayDeclaration arrFloatDec = new ArrayDeclaration(ARRAY_SIZE, flDec);
- ArrayDeclaration arrIntDec = new ArrayDeclaration(ARRAY_SIZE, intDec);
- ArrayDeclaration arrStructDec = new ArrayDeclaration(ARRAY_SIZE, structDec);
- ArrayDeclaration arrVariantDec = new ArrayDeclaration(ARRAY_SIZE, varDec);
- ArrayDeclaration arrEnumDec = new ArrayDeclaration(ARRAY_SIZE, enumDec);
-
- sDec.addField(INT, intDec);
- bb.put(TEST_NUMBER);
-
- sDec.addField(ARRAY_INT, arrIntDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.put(TEST_NUMBER);
- }
-
- sDec.addField(LEN, intDec);
- bb.put(TEST_NUMBER);
-
- sDec.addField(FLOAT, flDec);
- bb.putFloat(TEST_NUMBER);
-
- sDec.addField(ARRAY_FLOAT, arrFloatDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.putFloat(TEST_NUMBER);
- }
-
- sDec.addField(STR, strDec);
- bb.put(testStringBytes);
- bb.put((byte) 0);
-
- sDec.addField(ARRAY_STR, arrStrDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.put(testStringBytes);
- bb.put((byte) 0);
- }
-
- sDec.addField(SEQ, seqDec);
- bb.put(TEST_NUMBER);
- bb.put(TEST_NUMBER);
-
- structDec.addField(STR, strDec);
- structDec.addField(INT, intDec);
- sDec.addField(STRUCT, structDec);
- bb.put(testStringBytes);
- bb.put((byte) 0);
- bb.put(TEST_NUMBER);
-
- sDec.addField(ARRAY_STRUCT, arrStructDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.put(testStringBytes);
- bb.put((byte) 0);
- bb.put(TEST_NUMBER);
- }
-
- enumDec.add(0, 1, LEN);
- enumDec.add(2, 3, FLOAT);
- sDec.addField(ENUM, enumDec);
- bb.put(TEST_NUMBER);
-
- sDec.addField(ARRAY_ENUM, arrEnumDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.put(TEST_NUMBER);
- }
-
- varDec.addField(LEN, intDec);
- varDec.addField(FLOAT, flDec);
- varDec.setTag(ENUM);
- sDec.addField(VARIANT, varDec);
- bb.putFloat(TEST_NUMBER);
-
- sDec.addField(ARRAY_VARIANT, arrVariantDec);
- for (int i = 0; i < ARRAY_SIZE; ++i) {
- bb.putFloat(TEST_NUMBER);
- }
-
- fixture = sDec.createDefinition(fixture, ROOT, new BitBuffer(bb));
-
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_float() {
- FloatDefinition fieldDef = (FloatDefinition) fixture.lookupDefinition(FLOAT);
- CtfTmfEventField result = CtfTmfEventField.parseField((IDefinition)fieldDef, "_" + NAME);
- assertEquals("test=2.0", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of floats field.
- */
- @Test
- public void testParseField_array_float() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_FLOAT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[2.0, 2.0]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_int() {
- IDefinition fieldDef = fixture.lookupDefinition(INT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=2", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of integers field.
- */
- @Test
- public void testParseField_array_int() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_INT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[2, 2]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_sequence() {
- IDefinition fieldDef = fixture.lookupDefinition(SEQ);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[2, 2]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_sequence_value() {
- IDefinition fieldDef = fixture.lookupDefinition(SEQ);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- long[] values = (long[]) result.getValue();
- long[] expected = new long[] { 2, 2 };
- assertArrayEquals(expected, values);
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_string() {
- IDefinition fieldDef = fixture.lookupDefinition(STR);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=two", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of strings field.
- */
- @Test
- public void testParseField_array_string() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_STR);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[two, two]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_struct() {
- IDefinition fieldDef = fixture.lookupDefinition(STRUCT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[str=two, int=2]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of structs field.
- */
- @Test
- public void testParseField_array_struct() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_STRUCT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[[str=two, int=2], [str=two, int=2]]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_enum() {
- IDefinition fieldDef = fixture.lookupDefinition(ENUM);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=float", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of enums field.
- */
- @Test
- public void testParseField_array_enum() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_ENUM);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[float, float]", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test.
- */
- @Test
- public void testParseField_variant() {
- IDefinition fieldDef = fixture.lookupDefinition(VARIANT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=float=2.0", result.toString());
- }
-
- /**
- * Run the CtfTmfEventField parseField(Definition,String) method test for an
- * array of variants field.
- */
- @Test
- public void testParseField_array_variant() {
- IDefinition fieldDef = fixture.lookupArrayDefinition(ARRAY_VARIANT);
- CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("test=[float=2.0, float=2.0]", result.toString());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- * Patrick Tasse - Remove getSubField
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventTest</code> contains tests for the class
- * <code>{@link CtfTmfEvent}</code>.
- *
- * @author ematkho
- * @version $Revision: 1.0 $
- */
-public class CtfTmfEventTest {
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
- private static CtfTmfEvent nullEvent;
- private CtfTmfEvent fixture;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- assumeTrue(testTrace.exists());
- try (CtfTmfTrace trace = testTrace.getTrace();
- CtfIterator tr = (CtfIterator) trace.createIterator();) {
- tr.advance();
- fixture = tr.getCurrentEvent();
- nullEvent = CtfTmfEventFactory.getNullEvent(trace);
- }
- }
-
- /**
- * Run the CTFEvent(EventDefinition,StreamInputReader) constructor test.
- */
- @Test
- public void testCTFEvent_read() {
- assertNotNull(fixture);
- }
-
- /**
- * Run the int getCPU() method test.
- */
- @Test
- public void testGetCPU() {
- int result = nullEvent.getCPU();
- assertEquals(-1, result);
- }
-
- /**
- * Run the String getEventName() method test.
- */
- @Test
- public void testGetEventName() {
- String result = nullEvent.getType().getName();
- assertEquals("Empty CTF event", result);
- }
-
- /**
- * Run the ArrayList<String> getFieldNames() method test.
- */
- @Test
- public void testGetFieldNames() {
- Collection<String> result = fixture.getContent().getFieldNames();
- assertNotNull(result);
- }
-
- /**
- * Run the Object getFieldValue(String) method test.
- */
- @Test
- public void testGetFieldValue() {
- String fieldName = "pid";
- ITmfEventField result = fixture.getContent().getField(fieldName);
-
- assertNotNull(result);
- assertNotNull(result.getValue());
- }
-
- /**
- * Run the HashMap<String, CTFEventField> getFields() method test.
- */
- @Test
- public void testGetFields() {
- Collection<? extends ITmfEventField> fields = nullEvent.getContent().getFields();
- assertEquals(0, fields.size());
- }
-
- /**
- * Run the ITmfEventField getSubFieldValue(String[]) method test.
- */
- @Test
- public void testGetSubFieldValue() {
- /* Field exists */
- String[] names = { "pid" };
- assertNotNull(fixture.getContent().getField(names));
-
- /* First field exists, not the second */
- String[] names2 = { "pid", "abcd" };
- assertNull(fixture.getContent().getField(names2));
-
- /* Both field do not exist */
- String[] names3 = { "pfid", "abcd" };
- assertNull(fixture.getContent().getField(names3));
-
- /* TODO Missing case of embedded field, need event for it */
- }
-
- /**
- * Run the long getID() method test.
- */
- @Test
- public void testGetID() {
- long result = nullEvent.getID();
- assertEquals(-1L, result);
- }
-
- /**
- * Run the long getTimestamp() method test.
- */
- @Test
- public void testGetTimestamp() {
- long result = nullEvent.getTimestamp().getValue();
- assertEquals(-1L, result);
- }
-
- /**
- * Test the getters for the reference, source and type.
- */
- @Test
- public void testGetters() {
- long rank = fixture.getRank();
- try (CtfTmfTrace trace = fixture.getTrace();) {
- assertEquals("kernel", trace.getName());
- }
- String reference = fixture.getReference();
- int cpu = fixture.getCPU();
- ITmfEventType type = fixture.getType();
- assertEquals(ITmfContext.UNKNOWN_RANK, rank);
-
- assertEquals("channel0_1", reference);
- assertEquals(1, cpu);
- assertEquals("lttng_statedump_vm_map", type.toString());
- }
-
- /**
- * Test the custom CTF attributes methods. The test trace doesn't have any,
- * so the list of attributes should be empty.
- */
- @Test
- public void testCustomAttributes() {
- Set<String> attributes = fixture.listCustomAttributes();
- assertEquals(0, attributes.size());
-
- String attrib = fixture.getCustomAttribute("bozo");
- assertNull(attrib);
- }
-
- /**
- * Test the toString() method
- */
- @Test
- public void testToString() {
- String s = fixture.getContent().toString();
- assertEquals("pid=1922, start=0xb73ea000, end=0xb73ec000, flags=0x8000075, inode=917738, pgoff=0", s);
- }
-
- /**
- * Test the {@link CtfTmfEventFactory#getNullEvent(CtfTmfTrace)} method, and
- * the nullEvent's values.
- */
- @Test
- public void testNullEvent() {
- CtfTmfEvent nullEvent2 = CtfTmfEventFactory.getNullEvent(fixture.getTrace());
- assertSame(nullEvent2, nullEvent);
- assertNotNull(nullEvent);
- assertEquals(-1, nullEvent.getCPU());
- assertEquals("Empty CTF event", nullEvent.getType().getName());
- assertNull(nullEvent.getReference());
- assertEquals(0, nullEvent.getContent().getFields().size());
- assertEquals(-1L, nullEvent.getID());
- assertEquals(-1L, nullEvent.getTimestamp().getValue());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfEventTypeTest</code> contains tests for the class
- * <code>{@link CtfTmfEventType}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfEventTypeTest {
-
- /**
- * Run the CtfTmfEventType(String,String,ITmfEventField) constructor test.
- */
- @Test
- public void testCtfTmfEventType() {
- String eventName = "";
- ITmfEventField content = new TmfEventField("", null, new ITmfEventField[] {});
- CtfTmfEventType result = new CtfTmfEventType(eventName, content);
-
- assertNotNull(result);
- assertEquals("", result.toString());
- assertEquals("", result.getName());
- }
-
- /**
- * Run the String toString() method test.
- */
- @Test
- public void testToString() {
- ITmfEventField emptyField = new TmfEventField("", null, new ITmfEventField[] {});
- CtfTmfEventType fixture = new CtfTmfEventType("" , emptyField);
-
- String result = fixture.toString();
-
- assertEquals("", result);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Map;
-
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Unit tests for handling of lost events by the statistics backends.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfTmfLostEventStatisticsTest {
-
- /** Time-out tests after 30 seconds */
- @Rule
- public TestRule globalTimeout= new Timeout(30000);
-
- /**Test trace with lost events */
- private static final CtfTmfTestTrace lostEventsTrace = CtfTmfTestTrace.HELLO_LOST;
-
- private ITmfTrace fTrace;
-
- /** The statistics back-end object for the trace with lost events */
- private ITmfStatistics fStats;
-
- /* The two analysis modules needed for fStats */
- private TmfStatisticsTotalsModule fTotalsMod;
- private TmfStatisticsEventTypesModule fEventTypesMod;
-
- // ------------------------------------------------------------------------
- // Maintenance
- // ------------------------------------------------------------------------
-
- /**
- * Class setup
- */
- @BeforeClass
- public static void setUpClass() {
- assumeTrue(lostEventsTrace.exists());
- }
-
- /**
- * Test setup
- */
- @Before
- public void setUp() {
- ITmfTrace trace = lostEventsTrace.getTrace();
- fTrace = trace;
-
- /* Prepare the two analysis-backed state systems */
- fTotalsMod = new TmfStatisticsTotalsModule();
- fEventTypesMod = new TmfStatisticsEventTypesModule();
- try {
- fTotalsMod.setTrace(trace);
- fEventTypesMod.setTrace(trace);
- } catch (TmfAnalysisException e) {
- fail();
- }
-
- fTotalsMod.schedule();
- fEventTypesMod.schedule();
- assertTrue(fTotalsMod.waitForCompletion());
- assertTrue(fEventTypesMod.waitForCompletion());
-
- ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
- ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
- assertNotNull(totalsSS);
- assertNotNull(eventTypesSS);
-
- fStats = new TmfStateStatistics(totalsSS, eventTypesSS);
- }
-
- /**
- * Test cleanup
- */
- @After
- public void tearDown() {
- fStats.dispose();
- fTotalsMod.dispose();
- fEventTypesMod.dispose();
- fTrace.dispose();
- }
-
- // ------------------------------------------------------------------------
- // Test methods
- // ------------------------------------------------------------------------
-
- /*
- * Trace start = 1376592664828559410
- * Trace end = 1376592665108210547
- */
-
- private static final long rangeStart = 1376592664900000000L;
- private static final long rangeEnd = 1376592665000000000L;
-
- /**
- * Test the total number of "real" events. Make sure the lost events aren't
- * counted in the total.
- */
- @Test
- public void testLostEventsTotals() {
- long realEvents = fStats.getEventsTotal();
- assertEquals(32300, realEvents);
- }
-
- /**
- * Test the number of real events in a given range. Lost events shouldn't be
- * counted.
- */
- @Test
- public void testLostEventsTotalInRange() {
- long realEventsInRange = fStats.getEventsInRange(rangeStart, rangeEnd);
- assertEquals(11209L, realEventsInRange);
- }
-
- /**
- * Test the total number of lost events reported in the trace.
- */
- @Test
- public void testLostEventsTypes() {
- Map<String, Long> events = fStats.getEventTypesTotal();
- Long lostEvents = events.get(CTFStrings.LOST_EVENT_NAME);
- assertEquals(Long.valueOf(967700L), lostEvents);
- }
-
- /**
- * Test the number of lost events reported in a given range.
- */
- @Test
- public void testLostEventsTypesInRange() {
- Map<String, Long> eventsInRange = fStats.getEventTypesInRange(rangeStart, rangeEnd);
- long lostEventsInRange = eventsInRange.get(CTFStrings.LOST_EVENT_NAME);
- assertEquals(363494L, lostEventsInRange);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests to verify that lost events are handled correctly.
- *
- * Be wary if you are using Babeltrace to cross-check those values. There could
- * be a bug in Babeltrace with regards to lost events. See
- * http://bugs.lttng.org/issues/589
- *
- * It's not 100% sure at this point which implementation is correct, so for now
- * these tests assume the Java implementation is the right one.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfTmfLostEventsTest {
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.HELLO_LOST;
-
- private CtfTmfTrace fixture = null;
-
- /**
- * Class setup
- */
- @Before
- public void setUp() {
- assumeTrue(testTrace.exists());
- fixture = testTrace.getTrace();
- fixture.indexTrace(true);
- }
-
- /**
- * Clean-up
- */
- @After
- public void tearDown() {
- if (fixture != null) {
- fixture.dispose();
- }
- }
-
- // ------------------------------------------------------------------------
- // Test methods
- // ------------------------------------------------------------------------
-
- /**
- * Test that the number of events is reported correctly (a range of lost
- * events is counted as one event).
- */
- @Test
- public void testNbEvents() {
- final long expectedReal = 32300;
- final long expectedLost = 562;
-
- EventCountRequest req = new EventCountRequest();
- fixture.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- assertEquals(expectedReal, req.getReal());
- assertEquals(expectedLost, req.getLost());
- }
-
- /**
- * Test getting the first lost event from the trace.
- */
- @Test
- public void testFirstLostEvent() {
- final long rank = 153;
- final ITmfTimestamp start = new TmfNanoTimestamp(1376592664828848222L);
- final ITmfTimestamp end = new TmfNanoTimestamp(1376592664828848540L);
- final long nbLost = 859;
-
- final CtfTmfEvent ev = getOneEventTime(start);
- /* Make sure seeking by rank yields the same event */
- final CtfTmfEvent ev2 = getOneEventRank(rank);
- assertEquals(ev, ev2);
-
- assertTrue(ev instanceof ITmfLostEvent);
- ITmfLostEvent event = (ITmfLostEvent) ev;
-
- assertEquals(start, event.getTimestamp());
- assertEquals(start, event.getTimeRange().getStartTime());
- assertEquals(end, event.getTimeRange().getEndTime());
- assertEquals(nbLost, event.getNbLostEvents());
- }
-
- /**
- * Test getting the second lost event from the trace.
- */
- @Test
- public void testSecondLostEvent() {
- final long rank = 191;
- final ITmfTimestamp start = new TmfNanoTimestamp(1376592664829402521L);
- final ITmfTimestamp end = new TmfNanoTimestamp(1376592664829403076L);
- final long nbLost = 488;
-
- final CtfTmfEvent ev = getOneEventTime(start);
- /* Make sure seeking by rank yields the same event */
- final CtfTmfEvent ev2 = getOneEventRank(rank);
- assertEquals(ev, ev2);
-
- assertTrue(ev instanceof ITmfLostEvent);
- ITmfLostEvent event = (ITmfLostEvent) ev;
-
- assertEquals(start, event.getTimestamp());
- assertEquals(start, event.getTimeRange().getStartTime());
- assertEquals(end, event.getTimeRange().getEndTime());
- assertEquals(nbLost, event.getNbLostEvents());
- }
-
- /**
- * Test getting one normal event from the trace (lost events should not
- * interfere).
- */
- @Test
- public void testNormalEvent() {
- final long rank = 200;
- final ITmfTimestamp ts = new TmfNanoTimestamp(1376592664829423928L);
-
- final CtfTmfEvent event = getOneEventTime(ts);
- /* Make sure seeking by rank yields the same event */
- final CtfTmfEvent event2 = getOneEventRank(rank);
- assertEquals(event, event2);
-
- assertFalse(event instanceof ITmfLostEvent);
- assertEquals(ts, event.getTimestamp());
- }
-
- // ------------------------------------------------------------------------
- // Event requests
- // ------------------------------------------------------------------------
-
- private CtfTmfEvent getOneEventRank(long rank) {
- OneEventRequestPerRank req = new OneEventRequestPerRank(rank);
- fixture.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return req.getEvent();
- }
-
- private CtfTmfEvent getOneEventTime(@NonNull ITmfTimestamp ts) {
- OneEventRequestPerTs req = new OneEventRequestPerTs(ts);
- fixture.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- return req.getEvent();
- }
-
- private class OneEventRequestPerRank extends TmfEventRequest {
-
- private CtfTmfEvent event = null;
-
- public OneEventRequestPerRank(long rank) {
- super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, rank, 1, ExecutionType.FOREGROUND);
- }
-
- @Override
- public void handleData(ITmfEvent ev) {
- /* Type is checked by the request, cast should be safe */
- event = (CtfTmfEvent) ev;
- }
-
- public CtfTmfEvent getEvent() {
- return event;
- }
- }
-
- private class OneEventRequestPerTs extends TmfEventRequest {
-
- private CtfTmfEvent event = null;
-
- public OneEventRequestPerTs(@NonNull ITmfTimestamp ts) {
- super(CtfTmfEvent.class,
- new TmfTimeRange(ts, TmfTimestamp.BIG_CRUNCH),
- 0, 1, ExecutionType.FOREGROUND);
- }
-
- @Override
- public void handleData(ITmfEvent ev) {
- event = (CtfTmfEvent) ev;
- }
-
- public CtfTmfEvent getEvent() {
- return event;
- }
- }
-
- private class EventCountRequest extends TmfEventRequest {
-
- private long nbReal = 0;
- private long nbLost = 0;
-
- public EventCountRequest() {
- super(CtfTmfEvent.class, TmfTimeRange.ETERNITY, 0,
- ITmfEventRequest.ALL_DATA, ExecutionType.FOREGROUND);
- }
-
- @Override
- public void handleData(ITmfEvent event) {
- if (event instanceof ITmfLostEvent) {
- nbLost++;
- } else {
- nbReal++;
- }
- }
-
- public long getReal() {
- return nbReal;
- }
-
- public long getLost() {
- return nbLost;
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.event;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Tests for reading event contexts from a CtfTmfTrace.
- *
- * @author Alexandre Montplaisir
- */
-public class EventContextTest {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /* We use test trace #2, kernel_vm, which has event contexts */
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL_VM;
-
- private CtfTmfTrace fixture;
- private long startTime;
- private long endTime;
-
- // ------------------------------------------------------------------------
- // Class methods
- // ------------------------------------------------------------------------
-
- /**
- * Perform pre-class initialization.
- *
- * @throws TmfTraceException
- * If the test trace is not found
- */
- @Before
- public void setUp() throws TmfTraceException {
- assumeTrue(testTrace.exists());
- fixture = new CtfTmfTrace();
- fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
- fixture.indexTrace(true);
-
- startTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- endTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- }
-
- /**
- * Perform post-class clean-up.
- */
- @After
- public void tearDown() {
- if (fixture != null) {
- fixture.dispose();
- }
- }
-
- // ------------------------------------------------------------------------
- // Test methods
- // ------------------------------------------------------------------------
-
- /**
- * Make sure the trace is the correct one, and its timestamps are read
- * correctly.
- */
- @Test
- public void testTrace() {
- assertEquals(1363700740555978750L, startTime);
- assertEquals(1363700770550261288L, endTime);
- }
-
- /**
- * Test the context of the very first event of the trace.
- */
- @Test
- public void testContextStart() {
- CtfTmfEvent firstEvent = getEventAt(startTime);
- long perfPageFault = (Long) firstEvent.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) firstEvent.getContent().getField("context._procname").getValue();
- long tid = (Long) firstEvent.getContent().getField("context._tid").getValue();
-
- assertEquals(613, perfPageFault);
- assertEquals("lttng-sessiond", procname);
- assertEquals(1230, tid);
- }
-
- /**
- * Test the context of the event at 1363700745.559739078.
- */
- @Test
- public void testContext1() {
- long time = startTime + 5000000000L; // 1363700745.559739078
- CtfTmfEvent event = getEventAt(time);
- long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) event.getContent().getField("context._procname").getValue();
- long tid = (Long) event.getContent().getField("context._tid").getValue();
-
- assertEquals(6048, perfPageFault);
- assertEquals("swapper/0", procname);
- assertEquals(0, tid);
- }
-
- /**
- * Test the context of the event at 1363700750.559707062.
- */
- @Test
- public void testContext2() {
- long time = startTime + 2 * 5000000000L; // 1363700750.559707062
- CtfTmfEvent event = getEventAt(time);
- long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) event.getContent().getField("context._procname").getValue();
- long tid = (Long) event.getContent().getField("context._tid").getValue();
-
- assertEquals(13258, perfPageFault);
- assertEquals("swapper/0", procname);
- assertEquals(0, tid);
- }
-
- /**
- * Test the context of the event at 1363700755.555723128, which is roughly
- * mid-way through the trace.
- */
- @Test
- public void testContextMiddle() {
- long midTime = startTime + (endTime - startTime) / 2L; // 1363700755.555723128
- CtfTmfEvent midEvent = getEventAt(midTime);
- long perfPageFault = (Long) midEvent.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) midEvent.getContent().getField("context._procname").getValue();
- long tid = (Long) midEvent.getContent().getField("context._tid").getValue();
-
- assertEquals(19438, perfPageFault);
- assertEquals("swapper/0", procname);
- assertEquals(0, tid);
- }
-
- /**
- * Test the context of the event at 1363700760.559719724.
- */
- @Test
- public void testContext3() {
- long time = startTime + 4 * 5000000000L; // 1363700760.559719724
- CtfTmfEvent event = getEventAt(time);
- long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) event.getContent().getField("context._procname").getValue();
- long tid = (Long) event.getContent().getField("context._tid").getValue();
-
- assertEquals(21507, perfPageFault);
- assertEquals("swapper/0", procname);
- assertEquals(0, tid);
- }
-
- /**
- * Test the context of the event at 1363700765.559714634.
- */
- @Test
- public void testContext4() {
- long time = startTime + 5 * 5000000000L; // 1363700765.559714634
- CtfTmfEvent event = getEventAt(time);
- long perfPageFault = (Long) event.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) event.getContent().getField("context._procname").getValue();
- long tid = (Long) event.getContent().getField("context._tid").getValue();
-
- assertEquals(21507, perfPageFault);
- assertEquals("swapper/0", procname);
- assertEquals(0, tid);
- }
-
- /**
- * Test the context of the last event of the trace.
- */
- @Test
- public void testContextEnd() {
- CtfTmfEvent lastEvent = getEventAt(endTime);
- long perfPageFault = (Long) lastEvent.getContent().getField("context._perf_page_fault").getValue();
- String procname = (String) lastEvent.getContent().getField("context._procname").getValue();
- long tid = (Long) lastEvent.getContent().getField("context._tid").getValue();
-
- assertEquals(22117, perfPageFault);
- assertEquals("lttng-sessiond", procname);
- assertEquals(1230, tid);
- }
-
- // ------------------------------------------------------------------------
- // Private stuff
- // ------------------------------------------------------------------------
-
- private synchronized CtfTmfEvent getEventAt(long timestamp) {
- EventContextTestRequest req = new EventContextTestRequest(timestamp);
- fixture.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- return null;
- }
- return req.getEvent();
- }
-
- private class EventContextTestRequest extends TmfEventRequest {
-
- private CtfTmfEvent retEvent = null;
-
- public EventContextTestRequest(long timestamp) {
- super(CtfTmfEvent.class,
- new TmfTimeRange(new TmfNanoTimestamp(timestamp), TmfTimestamp.BIG_CRUNCH),
- 0, 1, ExecutionType.FOREGROUND);
- }
-
- @Override
- public void handleData(ITmfEvent event) {
- retEvent = (CtfTmfEvent) event;
- }
-
- public CtfTmfEvent getEvent() {
- return retEvent;
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.iterator;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfIteratorTest.class
-})
-public class AllTests {
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.iterator;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfIteratorTest</code> contains tests for the class
- * <code>{@link CtfIterator}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfIteratorTest {
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
- private CtfTmfTrace trace;
- private CtfIterator iterator;
-
- /**
- * Perform pre-test initialization.
- */
- @Before
- public void setUp() {
- assumeTrue(testTrace.exists());
- trace = testTrace.getTrace();
- iterator = (CtfIterator) trace.createIterator();
- CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
- iterator.setLocation(ctfLocation);
- iterator.increaseRank();
- }
-
- /**
- * Perform post-test clean-up.
- */
- @After
- public void tearDown() {
- if (trace != null) {
- trace.dispose();
- }
- if (iterator != null) {
- iterator.dispose();
- }
- }
-
- /**
- * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
- */
- @Test
- public void testCtfIterator_noinit() {
- try (CtfIterator result = (CtfIterator) trace.createIterator();) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
- */
- @Test
- public void testCtfIterator_init() {
- trace.init("test");
- try (CtfIterator result = (CtfIterator) trace.createIterator();) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
- * specifies an initial position for the iterator.
- */
- @Test
- public void testCtfIterator_position() {
- long timestampValue = 1L;
- long rank = 1L;
- try (CtfIterator result = (CtfIterator) trace.createIterator(new CtfLocationInfo(timestampValue, 0), rank);) {
- assertNotNull(result);
- }
- }
-
-
- /**
- * Run the boolean advance() method test.
- */
- @Test
- public void testAdvance() {
- boolean result = iterator.advance();
- assertTrue(result);
- }
-
- /**
- * Run the int compareTo(CtfIterator) method test.
- */
- @Test
- public void testCompareTo() {
- try (CtfIterator o = (CtfIterator) trace.createIterator();) {
- int result = iterator.compareTo(o);
- assertEquals(1L, result);
- }
- }
-
- /**
- * Run the boolean equals(Object) method test. Compare with another iterator
- * on the same trace.
- */
- @Test
- public void testEquals_other() {
- try (CtfIterator obj = (CtfIterator) trace.createIterator();) {
- assertNotNull(obj);
- CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
- obj.setLocation(ctfLocation1);
- obj.increaseRank();
-
- boolean result = iterator.equals(obj);
- assertTrue(result);
- }
- }
-
- /**
- * Run the boolean equals(Object) method test. Compare with an empty object.
- */
- @Test
- public void testEquals_empty() {
- Object obj = new Object();
- boolean result = iterator.equals(obj);
-
- assertFalse(result);
- }
-
- /**
- * Run the CtfTmfTrace getCtfTmfTrace() method test.
- */
- @Test
- public void testGetCtfTmfTrace() {
- try (CtfTmfTrace result = iterator.getCtfTmfTrace();) {
- assertNotNull(result);
- }
- }
-
- /**
- * Run the CtfTmfEvent getCurrentEvent() method test.
- */
- @Test
- public void testGetCurrentEvent() {
- CtfTmfEvent result = iterator.getCurrentEvent();
- assertNotNull(result);
- }
-
- /**
- * Run the CtfLocation getLocation() method test.
- */
- @Test
- public void testGetLocation() {
- CtfLocation result = iterator.getLocation();
- assertNotNull(result);
- }
-
- /**
- * Run the long getRank() method test.
- */
- @Test
- public void testGetRank() {
- long result = iterator.getRank();
- assertEquals(1L, result);
- }
-
- /**
- * Run the boolean hasValidRank() method test.
- */
- @Test
- public void testHasValidRank() {
- boolean result = iterator.hasValidRank();
- assertTrue(result);
- }
-
- /**
- * Run the int hashCode() method test.
- */
- @Test
- public void testHashCode() {
- int result = iterator.hashCode();
- int result2 = iterator.hashCode();
- assertEquals(result, result2);
- }
-
- /**
- * Run the void increaseRank() method test.
- */
- @Test
- public void testIncreaseRank() {
- iterator.increaseRank();
- }
-
- /**
- * Run the boolean seek(long) method test.
- */
- @Test
- public void testSeek() {
- long timestamp = 1L;
- boolean result = iterator.seek(timestamp);
- assertTrue(result);
- }
-
- /**
- * Run the void setLocation(ITmfLocation<?>) method test.
- */
- @Test
- public void testSetLocation() {
- CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
- iterator.setLocation(location);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;
-
-import java.util.Vector;
-
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Test and benchmark reading a CTF LTTng kernel trace.
- *
- * @author Matthew Khouzam
- */
-public class Benchmark {
-
- /**
- * Run the benchmark.
- *
- * @param args The command-line arguments
- */
- public static void main(final String[] args) {
- final String TRACE_PATH = "testfiles/kernel";
- final int NUM_LOOPS = 100;
-
- // Change this to enable text output
- final boolean USE_TEXT = true;
-
- // Work variables
- long nbEvent = 0L;
- final Vector<Double> benchs = new Vector<>();
- long start, stop;
- for (int loops = 0; loops < NUM_LOOPS; loops++) {
- nbEvent = 0L;
- try (CtfTmfTrace trace = new CtfTmfTrace();) {
- try {
- trace.initTrace(null, TRACE_PATH, CtfTmfEvent.class);
- } catch (final TmfTraceException e) {
- loops = NUM_LOOPS + 1;
- break;
- }
-
- start = System.nanoTime();
- if (nbEvent != -1) {
- final CtfTmfContext traceReader = (CtfTmfContext) trace.seekEvent(0);
-
- start = System.nanoTime();
- CtfTmfEvent current = traceReader.getCurrentEvent();
- while (current != null) {
- nbEvent++;
- if (USE_TEXT) {
-
- System.out.println("Event " + nbEvent + " Time "
- + current.getTimestamp().toString() + " type " + current.getType().getName()
- + " on CPU " + current.getCPU() + " " + current.getContent().toString());
- }
- // advance the trace to the next event.
- boolean hasMore = traceReader.advance();
- if (hasMore) {
- // you can know the trace has more events.
- }
- current = traceReader.getCurrentEvent();
- }
- }
- stop = System.nanoTime();
- System.out.print('.');
- final double time = (stop - start) / (double) nbEvent;
- benchs.add(time);
- } // trace.close()
- }
- System.out.println("");
- double avg = 0;
- for (final double val : benchs) {
- avg += val;
- }
- avg /= benchs.size();
- System.out.println("Time to read = " + avg + " events/ns");
- for (final Double val : benchs) {
- System.out.print(val);
- System.out.print(", ");
- }
-
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2015 Ericsson
- *
- * 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:
- * William Bourque <wbourque@gmail.com> - Initial API and implementation
- * Matthew Khouzam - Update to CtfTmf trace and events
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.headless;
-
-import java.util.Vector;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Benchmark the event request subsystem of TMF.
- */
-public class RequestBenchmark extends TmfEventRequest {
-
- private RequestBenchmark(final Class<? extends ITmfEvent> dataType,
- final TmfTimeRange range, final int nbRequested) {
- super(dataType, range, 0, nbRequested, ExecutionType.FOREGROUND);
- }
-
- // Path of the trace
- private static final String TRACE_PATH = "../org.eclipse.tracecompass.ctf.core.tests/traces/kernel";
-
- // Change this to run several time over the same trace
- private static final int NB_OF_PASS = 100;
-
- // Work variables
- private static int nbEvent = 0;
- private static TmfExperiment fExperiment = null;
- private static Vector<Double> benchs = new Vector<>();
-
- /**
- * Run the benchmark
- *
- * @param args
- * The command-line arguments
- */
- public static void main(final String[] args) {
-
- try {
- /* Our experiment will contains ONE trace */
- final ITmfTrace[] traces = new ITmfTrace[1];
- traces[0] = new CtfTmfTrace();
- traces[0].initTrace(null, TRACE_PATH, CtfTmfEvent.class);
- /* Create our new experiment */
- fExperiment = new TmfExperiment(CtfTmfEvent.class, "Headless", traces,
- TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
-
- /*
- * We will issue a request for each "pass". TMF will then process
- * them synchronously.
- */
- RequestBenchmark request = null;
- for (int x = 0; x < NB_OF_PASS; x++) {
- request = new RequestBenchmark(CtfTmfEvent.class,
- TmfTimeRange.ETERNITY, Integer.MAX_VALUE);
- fExperiment.sendRequest(request);
- }
- prev = System.nanoTime();
- } catch (final NullPointerException e) {
- /*
- * Silently dismiss Null pointer exception The only way to "finish"
- * the threads in TMF is by crashing them with null.
- */
- } catch (final Exception e) {
- e.printStackTrace();
- }
-
- }
-
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- nbEvent++;
-
- }
-
- static long prev;
- static long done = 0;
- @Override
- public void handleCompleted() {
- final long next = System.nanoTime();
- double val = next - prev;
- final int nbEvent2 = nbEvent;
- val /= nbEvent2;
-
- nbEvent = 0;
- prev = next;
- benchs.add(val);
- if (benchs.size() == NB_OF_PASS) {
- try {
- System.out.println("Nb events : " + nbEvent2);
-
- for (final double value : benchs) {
- System.out.print(value + ", ");
- }
- fExperiment.sendRequest(null);
-
- } catch (final Exception e) {
- }
- }
- }
-
- @Override
- public void handleSuccess() {
- }
-
- @Override
- public void handleFailure() {
- }
-
- @Override
- public void handleCancel() {
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- TmfSchedulerTest.class
-})
-public class AllTests {}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Simon Delisle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
-
-import java.io.PrintWriter;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Benchmark for the request scheduler
- *
- * The benchmark has three tests. The first one is the latency (time between the
- * creation of the request and the beginning of its execution). The second one
- * is the average waiting time for a request. The last one is the total
- * completion time.
- */
-public class TmfSchedulerBenchmark {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- private static final int NUM_LOOPS = 10;
- private static final int NANOSECONDS_IN_MILLISECONDS = 1000000;
- private static final int NANOSECONDS_IN_SECONDS = 1000000000;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static CtfTmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace();
- private static ForegroundRequest lastForegroundRequest = null;
- private static BackgroundRequest lastBackgroundRequest = null;
-
- private static PrintWriter pw = new PrintWriter(System.out, true);
-
- /**
- * Start the benchmark
- *
- * @param args
- * The command-line arguments
- */
- public static void main(final String[] args) {
- trace.indexTrace(true);
- pw.println("---------- Benchmark started ----------");
- latencyBenchmark();
- averageWaitingTime();
- completedTime();
- benchmarkResults();
- trace.dispose();
- }
-
- private static void latencyBenchmark() {
- long averageLatency = 0;
-
- pw.println("----- Latency -----");
- for (int i = 0; i < NUM_LOOPS; i++) {
- try {
- ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground1);
- foreground1.waitForCompletion();
- averageLatency += foreground1.getLatency();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- pw.println((averageLatency / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
- }
-
- private static void averageWaitingTime() {
- long averageWaitingBackground = 0;
- long averageWaitingForeground1 = 0;
- long averageWaitingForeground2 = 0;
-
- pw.println("----- Average waiting time with 3 requests -----");
- for (int i = 0; i < NUM_LOOPS; i++) {
- ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(background1);
- trace.sendRequest(foreground1);
- trace.sendRequest(foreground2);
- try {
- foreground1.waitForCompletion();
- foreground2.waitForCompletion();
- background1.waitForCompletion();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- averageWaitingBackground += background1.getAverageWaitingTime();
- averageWaitingForeground1 += foreground1.getAverageWaitingTime();
- averageWaitingForeground2 += foreground2.getAverageWaitingTime();
- }
- pw.print("-- Background : ");
- pw.println((averageWaitingBackground / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-
- pw.print("-- First foreground : ");
- pw.println((averageWaitingForeground1 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
-
- pw.print("-- Second foreground : ");
- pw.println((averageWaitingForeground2 / NUM_LOOPS) / NANOSECONDS_IN_MILLISECONDS + " ms");
- }
-
- private static void completedTime() {
- long averageCompletedTime1 = 0;
- long averageCompletedTime2 = 0;
- long averageCompletedTime3 = 0;
- long averageCompletedTime4 = 0;
- long averageCompletedTime5 = 0;
- long averageCompletedTime6 = 0;
-
- pw.println("----- Time to complete request -----");
- for (int i = 0; i < NUM_LOOPS; i++) {
- try {
- ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground1);
- foreground1.waitForCompletion();
- averageCompletedTime1 += foreground1.getCompletedTime();
-
- ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground2);
- trace.sendRequest(foreground3);
- foreground2.waitForCompletion();
- foreground3.waitForCompletion();
- averageCompletedTime2 += (foreground2.getCompletedTime() + foreground3.getCompletedTime());
-
- ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground4);
- trace.sendRequest(background1);
- foreground4.waitForCompletion();
- background1.waitForCompletion();
- averageCompletedTime3 += (foreground4.getCompletedTime() + background1.getCompletedTime());
-
- ForegroundRequest foreground5 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground5);
- trace.sendRequest(foreground6);
- trace.sendRequest(background2);
- foreground5.waitForCompletion();
- foreground6.waitForCompletion();
- background2.waitForCompletion();
- averageCompletedTime4 += (foreground5.getCompletedTime() + foreground6.getCompletedTime() + background2.getCompletedTime());
-
- ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground8 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background3 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground7);
- trace.sendRequest(foreground8);
- trace.sendRequest(foreground9);
- trace.sendRequest(background3);
- foreground7.waitForCompletion();
- foreground8.waitForCompletion();
- foreground9.waitForCompletion();
- background3.waitForCompletion();
- averageCompletedTime5 += (foreground7.getCompletedTime() + foreground8.getCompletedTime() + foreground9.getCompletedTime() + background3.getCompletedTime());
-
- ForegroundRequest foreground10 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground11 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground12 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground13 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background4 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- trace.sendRequest(foreground10);
- trace.sendRequest(foreground11);
- trace.sendRequest(foreground12);
- trace.sendRequest(foreground13);
- trace.sendRequest(background4);
- foreground10.waitForCompletion();
- foreground11.waitForCompletion();
- foreground12.waitForCompletion();
- foreground13.waitForCompletion();
- background4.waitForCompletion();
- averageCompletedTime6 += (foreground10.getCompletedTime() + foreground11.getCompletedTime() + foreground12.getCompletedTime() + foreground13.getCompletedTime() + background4.getCompletedTime());
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- pw.print("-- Time to complete one request : ");
- pw.println((averageCompletedTime1 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
- pw.print("-- Time to complete 2 requests (2 foreground) : ");
- pw.println((averageCompletedTime2 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
- pw.print("-- Time to complete 2 requests (1 foreground, 1 background) : ");
- pw.println((averageCompletedTime3 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
- pw.print("-- Time to complete 3 requests (2 foreground, 1 background) : ");
- pw.println((averageCompletedTime4 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
- pw.print("-- Time to complete 4 requests (3 foreground, 1 background) : ");
- pw.println((averageCompletedTime5 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
-
- pw.print("-- Time to complete 5 requests (4 foreground, 1 background) : ");
- pw.println((averageCompletedTime6 / NUM_LOOPS) / NANOSECONDS_IN_SECONDS + " s");
- }
-
- /**
- * The benchmark results
- */
- public static void benchmarkResults() {
- pw.println("---------- Benchmark completed ----------");
- }
-
- // ------------------------------------------------------------------------
- // Helper methods
- // ------------------------------------------------------------------------
-
- private static class BackgroundRequest extends TmfEventRequest {
- private long startTime;
- private long endTimeLatency = -1;
- private long completedTime = 0;
- private long waitingTimeStart = 0;
- private long waitingTimeEnd = 0;
- private long waitingTime = 0;
- private int waitingCounter = 0;
- private boolean isWaiting = false;
-
- BackgroundRequest(TmfTimeRange timeRange) {
- super(trace.getEventType(),
- timeRange,
- 0,
- ITmfEventRequest.ALL_DATA,
- ExecutionType.BACKGROUND);
- startTime = System.nanoTime();
- }
-
- @Override
- public void handleData(final ITmfEvent event) {
- if (endTimeLatency == -1) {
- endTimeLatency = System.nanoTime();
- }
- super.handleData(event);
- if (lastForegroundRequest == null && lastBackgroundRequest == null) {
- lastBackgroundRequest = this;
- }
- if (isWaiting) {
- waitingTimeEnd = System.nanoTime();
- waitingTime += waitingTimeEnd - waitingTimeStart;
- ++waitingCounter;
- isWaiting = false;
- }
- if (lastForegroundRequest != null) {
- lastForegroundRequest.waitingTimeStart = System.nanoTime();
- lastForegroundRequest.isWaiting = true;
- lastForegroundRequest = null;
- lastBackgroundRequest = this;
- }
- if (lastBackgroundRequest != this) {
- lastBackgroundRequest.waitingTimeStart = System.nanoTime();
- lastBackgroundRequest.isWaiting = true;
- lastBackgroundRequest = this;
- }
- }
-
- @Override
- public void handleCompleted() {
- completedTime = System.nanoTime();
- super.handleCompleted();
- }
-
- public long getCompletedTime() {
- return completedTime - startTime;
- }
-
- public long getAverageWaitingTime() {
- if (waitingCounter == 0) {
- return 0;
- }
- return waitingTime / waitingCounter;
- }
- }
-
- private static class ForegroundRequest extends TmfEventRequest {
- private long startTime = 0;
- private long endTimeLatency = -1;
- private long completedTime = 0;
- private long waitingTimeStart = 0;
- private long waitingTimeEnd = 0;
- private long waitingTime = 0;
- private int waitingCounter = 0;
- private boolean isWaiting = false;
-
- ForegroundRequest(TmfTimeRange timeRange) {
- super(trace.getEventType(),
- timeRange,
- 0,
- ITmfEventRequest.ALL_DATA,
- ExecutionType.FOREGROUND);
- startTime = System.nanoTime();
- }
-
- @Override
- public void handleData(final ITmfEvent event) {
- if (endTimeLatency == -1) {
- endTimeLatency = System.nanoTime();
- }
- super.handleData(event);
- if (lastBackgroundRequest == null && lastForegroundRequest == null) {
- lastForegroundRequest = this;
- }
- if (isWaiting) {
- waitingTimeEnd = System.nanoTime();
- waitingTime += waitingTimeEnd - waitingTimeStart;
- ++waitingCounter;
- isWaiting = false;
- }
- if (lastBackgroundRequest != null) {
- lastBackgroundRequest.waitingTimeStart = System.nanoTime();
- lastBackgroundRequest.isWaiting = true;
- lastBackgroundRequest = null;
- lastForegroundRequest = this;
- }
- if (lastForegroundRequest != this) {
- lastForegroundRequest.waitingTimeStart = System.nanoTime();
- lastForegroundRequest.isWaiting = true;
- lastForegroundRequest = this;
- }
- }
-
- @Override
- public void handleCompleted() {
- completedTime = System.nanoTime();
- super.handleCompleted();
- }
-
- public long getLatency() {
- return endTimeLatency - startTime;
- }
-
- public long getCompletedTime() {
- return completedTime - startTime;
- }
-
- public long getAverageWaitingTime() {
- if (waitingCounter == 0) {
- return 0;
- }
- return waitingTime / waitingCounter;
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Simon Delisle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.request;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Test suite for the scheduler.
- */
-public class TmfSchedulerTest {
-
- /** Time-out tests after 60 seconds */
- @Rule
- public TestRule globalTimeout= new Timeout(60000);
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
- private static final int NB_EVENTS_TRACE = 695319;
- private static final int NB_EVENTS_TIME_RANGE = 155133;
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private CtfTmfTrace fixture;
-
- private long fStartTime;
- private long fEndTime;
- private TmfTimeRange fForegroundTimeRange;
-
- private final List<String> fOrderList = new ArrayList<>();
- private int fForegroundId = 0;
- private int fBackgroundId = 0;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws TmfTraceException
- * If the test trace is not found
- */
- @Before
- public void setUp() throws TmfTraceException {
- assumeTrue(testTrace.exists());
- fixture = new CtfTmfTrace();
- fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
- fixture.indexTrace(true);
- fStartTime = fixture.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- fEndTime = fixture.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
-
- long foregroundStartTime = fStartTime + ((fEndTime - fStartTime) / 4);
- long foregroundEndTime = fStartTime + ((fEndTime - fStartTime) / 2);
- fForegroundTimeRange = new TmfTimeRange(new TmfTimestamp(foregroundStartTime, ITmfTimestamp.NANOSECOND_SCALE),
- new TmfTimestamp(foregroundEndTime, ITmfTimestamp.NANOSECOND_SCALE));
- }
-
- /**
- * Perform post-test clean-up.
- */
- @After
- public void tearDown() {
- if (fixture != null) {
- fixture.dispose();
- }
- }
-
- // ------------------------------------------------------------------------
- // Tests cases
- // ------------------------------------------------------------------------
-
- /**
- * Test one background request
- */
- @Test
- public void backgroundRequest() {
- BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
- fixture.sendRequest(background);
- try {
- background.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
- }
-
- /**
- * Test one foreground request
- */
- @Test
- public void foregroundRequest() {
- ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
- fixture.sendRequest(foreground);
- try {
- foreground.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
- }
-
- /**
- * Test one foreground and one background request for the entire trace at
- * the same time
- */
- @Test
- public void TestMultiRequest1() {
- BackgroundRequest background = new BackgroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
- fixture.sendRequest(background);
- fixture.sendRequest(foreground);
- try {
- background.waitForCompletion();
- foreground.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TRACE, background.getNbEvents());
- assertEquals(NB_EVENTS_TRACE, foreground.getNbEvents());
- }
-
- /**
- * Test one background request for the entire trace and one foreground
- * request for smaller time range
- */
- @Test
- public void TestMultiRequest2() {
- BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground2 = new ForegroundRequest(fForegroundTimeRange);
-
- fixture.sendRequest(background2);
- fixture.sendRequest(foreground2);
- try {
- background2.waitForCompletion();
- foreground2.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TRACE, background2.getNbEvents());
- assertEquals(NB_EVENTS_TIME_RANGE, foreground2.getNbEvents());
- }
-
- /**
- * Test two foreground request, one to select a time range and one to select
- * an event in this time range
- */
- @Test
- public void TestMultiRequest3() {
- ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- fixture.sendRequest(foreground3);
-
- TmfSelectionRangeUpdatedSignal signal3 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fForegroundTimeRange.getStartTime()));
- fixture.broadcast(signal3);
-
- try {
- foreground3.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TRACE, foreground3.getNbEvents());
- }
-
- /**
- * Test two foreground request, one to select a time range and one to select
- * an event before this time range
- */
- @Test
- public void TestMultiRequest4() {
- ForegroundRequest foreground4 = new ForegroundRequest(fForegroundTimeRange);
- fixture.sendRequest(foreground4);
- TmfSelectionRangeUpdatedSignal signal4 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
- fixture.broadcast(signal4);
-
- try {
- foreground4.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TIME_RANGE, foreground4.getNbEvents());
- }
-
- /**
- * Test two foreground request, one to select a time range and one to select
- * an event after this time range
- */
- @Test
- public void TestMultiRequest5() {
- ForegroundRequest foreground5 = new ForegroundRequest(fForegroundTimeRange);
- fixture.sendRequest(foreground5);
- TmfSelectionRangeUpdatedSignal signal5 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fEndTime - ((fEndTime - fStartTime) / 4)));
- fixture.broadcast(signal5);
-
- try {
- foreground5.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TIME_RANGE, foreground5.getNbEvents());
- }
-
- /**
- * Test one background and one foreground request for the entire trace and
- * one foreground request to select an event
- */
- @Test
- public void TestMultiRequest6() {
- BackgroundRequest background6 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground6 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
- fixture.sendRequest(background6);
- fixture.sendRequest(foreground6);
-
- TmfSelectionRangeUpdatedSignal signal6 = new TmfSelectionRangeUpdatedSignal(this, new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 8)));
- fixture.broadcast(signal6);
-
- try {
- background6.waitForCompletion();
- foreground6.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
-
- assertEquals(NB_EVENTS_TRACE, background6.getNbEvents());
- assertEquals(NB_EVENTS_TRACE, foreground6.getNbEvents());
- }
-
- /**
- * Four request, two foreground and two background
- */
- @Test
- public void TestMultiRequest7() {
- ForegroundRequest foreground7 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground8 = new ForegroundRequest(fForegroundTimeRange);
- BackgroundRequest background7 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background8 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- fixture.sendRequest(foreground7);
- fixture.sendRequest(foreground8);
- fixture.sendRequest(background7);
- fixture.sendRequest(background8);
- try {
- foreground7.waitForCompletion();
- foreground8.waitForCompletion();
- background7.waitForCompletion();
- background8.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertEquals(NB_EVENTS_TRACE, foreground7.getNbEvents());
- assertEquals(NB_EVENTS_TIME_RANGE, foreground8.getNbEvents());
- assertEquals(NB_EVENTS_TRACE, background7.getNbEvents());
- assertEquals(NB_EVENTS_TRACE, background8.getNbEvents());
- }
-
- /**
- * One long foreground request and one short foreground request, the short
- * one should finish first
- */
- @Test
- public void preemptedForegroundRequest() {
- ForegroundRequest foreground9 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- TmfTimeRange shortTimeRange = new TmfTimeRange(new TmfTimestamp(fStartTime, ITmfTimestamp.NANOSECOND_SCALE),
- new TmfTimestamp(fStartTime + ((fEndTime - fStartTime) / 16), ITmfTimestamp.NANOSECOND_SCALE));
- ForegroundRequest shortForeground = new ForegroundRequest(shortTimeRange);
- fixture.sendRequest(foreground9);
- try {
- foreground9.waitForStart();
- } catch (InterruptedException e) {
- fail();
- }
- fixture.sendRequest(shortForeground);
- try {
- shortForeground.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertFalse(foreground9.isCompleted());
- }
-
- /**
- * One long background request and one short foreground request, the
- * foreground request should finish first
- */
- @Test
- public void preemptedBackgroundRequest() {
- BackgroundRequest background9 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground10 = new ForegroundRequest(fForegroundTimeRange);
- fixture.sendRequest(background9);
- fixture.sendRequest(foreground10);
- try {
- foreground10.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertTrue(foreground10.isCompleted());
- assertFalse(background9.isCompleted());
- }
-
- /**
- * Test if the scheduler is working as expected
- */
- @Ignore
- @Test
- public void executionOrder() {
- List<String> expectedOrder = new LinkedList<>();
- expectedOrder.add("FOREGROUND1");
- expectedOrder.add("FOREGROUND2");
- expectedOrder.add("FOREGROUND3");
- expectedOrder.add("FOREGROUND4");
- expectedOrder.add("BACKGROUND1");
- expectedOrder.add("FOREGROUND1");
- expectedOrder.add("FOREGROUND2");
- expectedOrder.add("FOREGROUND3");
- expectedOrder.add("FOREGROUND4");
- expectedOrder.add("BACKGROUND2");
-
- fOrderList.clear();
- fForegroundId = 0;
- fBackgroundId = 0;
-
- BackgroundRequest background1 = new BackgroundRequest(TmfTimeRange.ETERNITY);
- BackgroundRequest background2 = new BackgroundRequest(TmfTimeRange.ETERNITY);
-
- ForegroundRequest foreground1 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground2 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground3 = new ForegroundRequest(TmfTimeRange.ETERNITY);
- ForegroundRequest foreground4 = new ForegroundRequest(TmfTimeRange.ETERNITY);
-
- fixture.sendRequest(foreground1);
- fixture.sendRequest(foreground2);
- fixture.sendRequest(foreground3);
- fixture.sendRequest(foreground4);
- fixture.sendRequest(background1);
- fixture.sendRequest(background2);
- try {
- foreground1.waitForCompletion();
- foreground2.waitForCompletion();
- foreground3.waitForCompletion();
- foreground4.waitForCompletion();
- background1.waitForCompletion();
- background2.waitForCompletion();
- } catch (InterruptedException e) {
- fail();
- }
- assertEquals(expectedOrder, fOrderList.subList(0, expectedOrder.size()));
- }
-
- // ------------------------------------------------------------------------
- // Helper methods
- // ------------------------------------------------------------------------
-
- private class BackgroundRequest extends TmfEventRequest {
- private int nbEvents = 0;
- private String backgroundName;
-
- BackgroundRequest(TmfTimeRange timeRange) {
- super(fixture.getEventType(),
- timeRange,
- 0,
- ITmfEventRequest.ALL_DATA,
- ExecutionType.BACKGROUND);
- backgroundName = getExecType().toString() + ++fBackgroundId;
- }
-
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- synchronized (fOrderList) {
- if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(backgroundName)) {
- fOrderList.add(backgroundName);
- }
- }
- ++nbEvents;
- }
-
- public int getNbEvents() {
- return nbEvents;
- }
- }
-
- private class ForegroundRequest extends TmfEventRequest {
- private int nbEvents = 0;
- private String foregroundName;
-
- ForegroundRequest(TmfTimeRange timeRange) {
- super(fixture.getEventType(),
- timeRange,
- 0,
- ITmfEventRequest.ALL_DATA,
- ExecutionType.FOREGROUND);
- foregroundName = getExecType().toString() + ++fForegroundId;
- }
-
- @Override
- public void handleData(final ITmfEvent event) {
- super.handleData(event);
- synchronized (fOrderList) {
- if (fOrderList.isEmpty() || !fOrderList.get(fOrderList.size() - 1).equals(foregroundName)) {
- fOrderList.add(foregroundName);
- }
- }
- ++nbEvents;
- }
-
- public int getNbEvents() {
- return nbEvents;
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- TmfEventsStatisticsTest.class,
- TmfStateStatisticsTest.class
-})
-public class AllTests {}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
-
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.tmf.core.statistics.TmfEventsStatistics;
-import org.junit.BeforeClass;
-
-/**
- * Unit tests for the {@link TmfEventsStatistics}
- *
- * @author Alexandre Montplaisir
- */
-public class TmfEventsStatisticsTest extends TmfStatisticsTest {
-
- /**
- * Set up the fixture once for all tests.
- */
- @BeforeClass
- public static void setUpClass() {
- assumeTrue(testTrace.exists());
- backend = new TmfEventsStatistics(testTrace.getTrace());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-/**
- * Unit tests for the {@link TmfStateStatistics}
- *
- * @author Alexandre Montplaisir
- */
-public class TmfStateStatisticsTest extends TmfStatisticsTest {
-
- private ITmfTrace fTrace;
-
- private TmfStatisticsTotalsModule fTotalsMod;
- private TmfStatisticsEventTypesModule fEventTypesMod;
-
- /**
- * Class setup
- */
- @BeforeClass
- public static void setUpClass() {
- assumeTrue(testTrace.exists());
- }
-
- /**
- * Test setup
- */
- @Before
- public void setUp() {
- ITmfTrace trace = testTrace.getTrace();
- fTrace = trace;
-
- /* Prepare the two analysis-backed state systems */
- fTotalsMod = new TmfStatisticsTotalsModule();
- fEventTypesMod = new TmfStatisticsEventTypesModule();
- try {
- fTotalsMod.setTrace(trace);
- fEventTypesMod.setTrace(trace);
- } catch (TmfAnalysisException e) {
- fail();
- }
-
- fTotalsMod.schedule();
- fEventTypesMod.schedule();
- assertTrue(fTotalsMod.waitForCompletion());
- assertTrue(fEventTypesMod.waitForCompletion());
-
- ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
- ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
- assertNotNull(totalsSS);
- assertNotNull(eventTypesSS);
-
- backend = new TmfStateStatistics(totalsSS, eventTypesSS);
- }
-
- /**
- * Test cleanup
- */
- @After
- public void tearDown() {
- fTotalsMod.dispose();
- fEventTypesMod.dispose();
- fTrace.dispose();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.statistics;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * Base unit test class for any type of ITmfStatistics. Sub-classes should
- * implement a "@BeforeClass" method to setup the 'backend' fixture accordingly.
- *
- * @author Alexandre Montplaisir
- */
-public abstract class TmfStatisticsTest {
-
- /** Time-out tests after 30 seconds */
- @Rule public TestRule globalTimeout= new Timeout(30000);
-
- /** Test trace used for these tests */
- protected static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
- /** The statistics back-end object */
- protected static ITmfStatistics backend;
-
- /* Known values about the trace */
- private static final int totalNbEvents = 695319;
- private static final long tStart = 1332170682440133097L; /* Timestamp of first event */
- private static final long tEnd = 1332170692664579801L; /* Timestamp of last event */
-
- /* Timestamps of interest */
- private static final long t1 = 1332170682490946000L;
- private static final long t2 = 1332170682490947524L; /* event exactly here */
- private static final long t3 = 1332170682490948000L;
- private static final long t4 = 1332170682490949000L;
- private static final long t5 = 1332170682490949270L; /* following event here */
- private static final long t6 = 1332170682490949300L;
-
- private static final String eventType = "lttng_statedump_process_state";
-
-
- // ------------------------------------------------------------------------
- // Tests for histogramQuery()
- // ------------------------------------------------------------------------
-
- /**
- * Test the {@link ITmfStatistics#histogramQuery} method for the small known
- * interval.
- */
- @Test
- public void testHistogramQuerySmall() {
- final int NB_REQ = 10;
- List<Long> results = backend.histogramQuery(t1, t6, NB_REQ);
-
- /* Make sure the returned array has the right size */
- assertEquals(NB_REQ, results.size());
-
- /* Check the contents of each "bucket" */
- assertEquals(0, results.get(0).longValue());
- assertEquals(0, results.get(1).longValue());
- assertEquals(0, results.get(2).longValue());
- assertEquals(0, results.get(3).longValue());
- assertEquals(1, results.get(4).longValue());
- assertEquals(0, results.get(5).longValue());
- assertEquals(0, results.get(6).longValue());
- assertEquals(0, results.get(7).longValue());
- assertEquals(0, results.get(8).longValue());
- assertEquals(1, results.get(9).longValue());
-
- }
-
- /**
- * Test the {@link ITmfStatistics#histogramQuery} method over the whole
- * trace.
- */
- @Test
- public void testHistogramQueryFull() {
- final int NB_REQ = 10;
- List<Long> results = backend.histogramQuery(tStart, tEnd, NB_REQ);
-
- /* Make sure the returned array has the right size */
- assertEquals(NB_REQ, results.size());
-
- /* Check the total number of events */
- long count = 0;
- for (long val : results) {
- count += val;
- }
- assertEquals(totalNbEvents, count);
-
- /* Check the contents of each "bucket" */
- assertEquals(94161, results.get(0).longValue());
- assertEquals(87348, results.get(1).longValue());
- assertEquals(58941, results.get(2).longValue());
- assertEquals(59879, results.get(3).longValue());
- assertEquals(66941, results.get(4).longValue());
- assertEquals(68939, results.get(5).longValue());
- assertEquals(72746, results.get(6).longValue());
- assertEquals(60749, results.get(7).longValue());
- assertEquals(61208, results.get(8).longValue());
- assertEquals(64407, results.get(9).longValue());
- }
-
- // ------------------------------------------------------------------------
- // Test for getEventsTotal()
- // ------------------------------------------------------------------------
-
- /**
- * Basic test for {@link ITmfStatistics#getEventsTotal}
- */
- @Test
- public void testGetEventsTotal() {
- long count = backend.getEventsTotal();
- assertEquals(totalNbEvents, count);
- }
-
- // ------------------------------------------------------------------------
- // Test for getEventTypesTotal()
- // ------------------------------------------------------------------------
-
- /**
- * Basic test for {@link ITmfStatistics#getEventTypesTotal}
- */
- @Test
- public void testEventTypesTotal() {
- Map<String, Long> res = backend.getEventTypesTotal();
- assertEquals(126, res.size()); /* Number of different event types in the trace */
-
- long count = sumOfEvents(res);
- assertEquals(totalNbEvents, count);
- }
-
- // ------------------------------------------------------------------------
- // Tests for getEventsInRange(ITmfTimestamp start, ITmfTimestamp end)
- // ------------------------------------------------------------------------
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} over the whole trace.
- */
- @Test
- public void testGetEventsInRangeWholeRange() {
- long count = backend.getEventsInRange(tStart, tEnd);
- assertEquals(totalNbEvents, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
- * except the start time (there is only one event at the start time).
- */
- @Test
- public void testGetEventsInRangeMinusStart() {
- long count = backend.getEventsInRange(tStart + 1, tEnd);
- assertEquals(totalNbEvents - 1, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} for the whole range,
- * except the end time (there is only one event at the end time).
- */
- @Test
- public void testGetEventsInRangeMinusEnd() {
- long count = backend.getEventsInRange(tStart, tEnd - 1);
- assertEquals(totalNbEvents - 1, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} when both the start and
- * end times don't match an event.
- */
- @Test
- public void testGetEventsInRangeNoEventsAtEdges() {
- long count = backend.getEventsInRange(t1, t6);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} when the *start* of the
- * interval is exactly on an event (that event should be included).
- */
- @Test
- public void testGetEventsInRangeEventAtStart() {
- long count = backend.getEventsInRange(t2, t3);
- assertEquals(1, count);
-
- count = backend.getEventsInRange(t2, t6);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} when the *end* of the
- * interval is exactly on an event (that event should be included).
- */
- @Test
- public void testGetEventsInRangeEventAtEnd() {
- long count = backend.getEventsInRange(t4, t5);
- assertEquals(1, count);
-
- count = backend.getEventsInRange(t1, t5);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} when there are events
- * matching exactly both the start and end times of the range (both should
- * be included).
- */
- @Test
- public void testGetEventsInRangeEventAtBoth() {
- long count = backend.getEventsInRange(t2, t5);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventsInRange} when there are no events
- * in a given range.
- */
- @Test
- public void testGetEventsInRangeNoEvents() {
- long count = backend.getEventsInRange(t3, t4);
- assertEquals(0, count);
- }
-
- // ------------------------------------------------------------------------
- // Tests for getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end)
- // ------------------------------------------------------------------------
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} over the whole trace.
- */
- @Test
- public void testGetEventTypesInRangeWholeRange() {
- Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd);
- /* Number of events of that type in the whole trace */
- assertEquals(new Long(464L), result.get(eventType));
-
- long count = sumOfEvents(result);
- assertEquals(totalNbEvents, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
- * except the start time (there is only one event at the start time).
- */
- @Test
- public void testGetEventTypesInRangeMinusStart() {
- Map<String, Long> result = backend.getEventTypesInRange(tStart + 1, tEnd);
-
- long count = sumOfEvents(result);
- assertEquals(totalNbEvents - 1, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} for the whole range,
- * except the end time (there is only one event at the end time).
- */
- @Test
- public void testGetEventTypesInRangeMinusEnd() {
- Map<String, Long> result = backend.getEventTypesInRange(tStart, tEnd - 1);
-
- long count = sumOfEvents(result);
- assertEquals(totalNbEvents - 1, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} when both the start
- * and end times don't match an event.
- */
- @Test
- public void testGetEventTypesInRangeNoEventsAtEdges() {
- Map<String, Long> result = backend.getEventTypesInRange(t1, t6);
- assertEquals(new Long(2L), result.get(eventType));
-
- long count = sumOfEvents(result);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} when the *start* of
- * the interval is exactly on an event (that event should be included).
- */
- @Test
- public void testGetEventTypesInRangeEventAtStart() {
- Map<String, Long> result = backend.getEventTypesInRange(t2, t3);
- assertEquals(new Long(1L), result.get(eventType));
- long count = sumOfEvents(result);
- assertEquals(1, count);
-
- result = backend.getEventTypesInRange(t2, t6);
- assertEquals(new Long(2L), result.get(eventType));
- count = sumOfEvents(result);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} when the *end* of
- * the interval is exactly on an event (that event should be included).
- */
- @Test
- public void testGetEventTypesInRangeEventAtEnd() {
- Map<String, Long> result = backend.getEventTypesInRange(t4, t5);
- assertEquals(new Long(1L), result.get(eventType));
- long count = sumOfEvents(result);
- assertEquals(1, count);
-
- result = backend.getEventTypesInRange(t1, t5);
- assertEquals(new Long(2L), result.get(eventType));
- count = sumOfEvents(result);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} when there are
- * events matching exactly both the start and end times of the range (both
- * should be included).
- */
- @Test
- public void testGetEventTypesInRangeEventAtBoth() {
- Map<String, Long> result = backend.getEventTypesInRange(t2, t5);
- assertEquals(new Long(2L), result.get(eventType));
- long count = sumOfEvents(result);
- assertEquals(2, count);
- }
-
- /**
- * Test for {@link ITmfStatistics#getEventTypesInRange} when there are no
- * events in a given range.
- */
- @Test
- public void testGetEventTypesInRangeNoEvents() {
- Map<String, Long> result = backend.getEventTypesInRange(t3, t4);
- long count = sumOfEvents(result);
- assertEquals(0, count);
- }
-
- // ------------------------------------------------------------------------
- // Convenience methods
- // ------------------------------------------------------------------------
-
- private static long sumOfEvents(Map<String, Long> map) {
- long count = 0;
- for (long val : map.values()) {
- count += val;
- }
- return count;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- TmfTraceManagerTest.class
-})
-public class AllTests {}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- * Patrick Tasse - Support selection range
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.temp.tracemanager;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assume.assumeTrue;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Test suite for the {@link TmfTraceManager}.
- *
- * @author Alexandre Montplaisir
- */
-public class TmfTraceManagerTest {
-
- private static final int SCALE = ITmfTimestamp.NANOSECOND_SCALE;
-
- private static ITmfTrace trace1;
- private static final long t1start = 1331668247314038062L;
- private static final long t1end = 1331668259054285979L;
-
- private static ITmfTrace trace2;
- private static final long t2start = 1332170682440133097L;
- private static final long t2end = 1332170692664579801L;
-
- private static final long ONE_SECOND = 1000000000L;
-
- private TmfTraceManager tm;
-
-
- /**
- * Test class initialization
- */
- @BeforeClass
- public static void setUpClass() {
- assumeTrue(CtfTmfTestTrace.TRACE2.exists());
- assumeTrue(CtfTmfTestTrace.KERNEL.exists());
- trace1 = CtfTmfTestTrace.TRACE2.getTrace();
- trace2 = CtfTmfTestTrace.KERNEL.getTrace();
-
- trace1.indexTrace(true);
- trace2.indexTrace(true);
-
- // Deregister traces from signal manager so that they don't
- // interfere with the TmfTraceManager tests
- TmfSignalManager.deregister(trace1);
- TmfSignalManager.deregister(trace2);
- }
-
- /**
- * Test initialization
- */
- @Before
- public void setUp() {
- tm = TmfTraceManager.getInstance();
- }
-
- /**
- * Test clean-up
- */
- @After
- public void tearDown() {
- while (tm.getActiveTrace() != null) {
- closeTrace(tm.getActiveTrace());
- }
- }
-
- /**
- * Test class clean-up
- */
- @AfterClass
- public static void tearDownClass() {
- CtfTmfTestTrace.TRACE2.dispose();
- CtfTmfTestTrace.KERNEL.dispose();
- }
-
- // ------------------------------------------------------------------------
- // Dummy actions (fake signals)
- // ------------------------------------------------------------------------
-
- private void openTrace(ITmfTrace trace) {
- if (trace == null) {
- throw new IllegalArgumentException();
- }
- TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null));
- selectTrace(trace);
- }
-
- private void closeTrace(ITmfTrace trace) {
- if (trace == null) {
- throw new IllegalArgumentException();
- }
- TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace));
- /*
- * In TMF, the next tab would now be selected (if there are some), which
- * would select another trace automatically.
- */
- if (tm.getOpenedTraces().size() > 0) {
- selectTrace(tm.getOpenedTraces().toArray(new ITmfTrace[0])[0]);
- }
- }
-
- private void selectTrace(ITmfTrace trace) {
- TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, trace));
- }
-
- private void selectTimestamp(@NonNull ITmfTimestamp ts) {
- TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, ts));
- }
-
- private void selectWindowRange(TmfTimeRange tr) {
- TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, tr));
- }
-
- // ------------------------------------------------------------------------
- // General tests
- // ------------------------------------------------------------------------
-
- /**
- * Test that the manager is correctly initialized
- */
- @Test
- public void testInitialize() {
- TmfTraceManager mgr = TmfTraceManager.getInstance();
- assertNotNull(mgr);
- assertSame(tm, mgr);
- }
-
- /**
- * Test the contents of a trace set with one trace.
- */
- @Test
- public void testTraceSet() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace2);
-
- Collection<ITmfTrace> expected = Collections.singleton(trace2);
- Collection<ITmfTrace> actual = tm.getActiveTraceSet();
-
- assertEquals(1, actual.size());
- assertEquals(expected, actual);
- }
-
- /**
- * Test the contents of a trace set with an experiment.
- */
- @Test
- public void testTraceSetExperiment() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(trace1);
- openTrace(exp);
-
- Collection<ITmfTrace> expected = ImmutableSet.of(trace1, trace2);
- Collection<ITmfTrace> actual = tm.getActiveTraceSet();
-
- assertEquals(2, actual.size());
- assertEquals(expected, actual);
- }
-
- /**
- * Test the contents of the complete trace set.
- */
- @Test
- public void testTraceSetWithExperiment() {
- /* Test with a trace */
- Collection<ITmfTrace> expected = Collections.singleton(trace1);
- Collection<ITmfTrace> actual = TmfTraceManager.getTraceSetWithExperiment(trace1);
- assertEquals(1, actual.size());
- assertEquals(expected, actual);
-
- /* Test with an experiment */
- TmfExperiment exp = createExperiment(trace1, trace2);
- expected = ImmutableSet.of(trace1, trace2, exp);
- actual = TmfTraceManager.getTraceSetWithExperiment(exp);
- assertEquals(3, actual.size());
- assertEquals(expected, actual);
- }
-
- /**
- * Test the {@link TmfTraceManager#getSupplementaryFileDir} method.
- */
- @Test
- public void testSupplementaryFileDir() {
- String name1 = trace1.getName();
- String name2 = trace2.getName();
- String basePath = TmfTraceManager.getTemporaryDirPath() + File.separator;
-
- String expected1 = basePath + name1 + File.separator;
- String expected2 = basePath + name2 + File.separator;
-
- assertEquals(expected1, TmfTraceManager.getSupplementaryFileDir(trace1));
- assertEquals(expected2, TmfTraceManager.getSupplementaryFileDir(trace2));
- }
-
- // ------------------------------------------------------------------------
- // Test a single trace
- // ------------------------------------------------------------------------
-
- /**
- * Test the initial range of a single trace.
- */
- @Test
- public void testTraceInitialRange() {
- openTrace(trace2);
- final TmfTimeRange expectedRange = new TmfTimeRange(
- trace2.getStartTime(),
- calculateOffset(trace2.getStartTime(), trace2.getInitialRangeOffset()));
- TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(expectedRange, actualRange);
- }
-
- /**
- * Try selecting a timestamp contained inside the trace's range. The trace's
- * current time should get updated correctly.
- */
- @Test
- public void testNewTimestamp() {
- openTrace(trace2);
- ITmfTimestamp ts = new TmfTimestamp(t2start + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(ts, selection.getStartTime());
- assertEquals(ts, selection.getEndTime());
- }
-
- /**
- * Try selecting a timestamp happening before the trace's start. The change
- * should be ignored.
- */
- @Test
- public void testTimestampBefore() {
- openTrace(trace2);
- TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
- ITmfTimestamp ts = new TmfTimestamp(t2start - ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(beforeTr, selection);
- }
-
- /**
- * Try selecting a timestamp happening after the trace's end. The change
- * should be ignored.
- */
- @Test
- public void testTimestampAfter() {
- openTrace(trace2);
- TmfTimeRange beforeTr = tm.getCurrentTraceContext().getSelectionRange();
- ITmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(beforeTr, selection);
- }
-
- /**
- * Test selecting a normal sub-range of a single trace.
- */
- @Test
- public void testTraceNewTimeRange() {
- openTrace(trace2);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t2start + ONE_SECOND, SCALE),
- new TmfTimestamp(t2end - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(range, curRange);
- }
-
- /**
- * Test selecting a range whose start time is before the trace's start time.
- * The selected range should get clamped to the trace's range.
- */
- @Test
- public void testTraceTimeRangeClampingStart() {
- openTrace(trace2);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
- new TmfTimestamp(t2end - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(t2start, curRange.getStartTime().getValue());
- assertEquals(range.getEndTime(), curRange.getEndTime());
- }
-
- /**
- * Test selecting a range whose end time is after the trace's end time.
- * The selected range should get clamped to the trace's range.
- */
- @Test
- public void testTraceTimeRangeClampingEnd() {
- openTrace(trace2);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t2start + ONE_SECOND, SCALE),
- new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
- selectWindowRange(range);
-
- TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(range.getStartTime(), curRange.getStartTime());
- assertEquals(t2end, curRange.getEndTime().getValue());
- }
-
- /**
- * Test selecting a range whose both start and end times are outside of the
- * trace's range. The selected range should get clamped to the trace's
- * range.
- */
- @Test
- public void testTraceTimeRangeClampingBoth() {
- openTrace(trace2);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t2start - ONE_SECOND, SCALE), // minus here
- new TmfTimestamp(t2end + ONE_SECOND, SCALE)); // plus here
- selectWindowRange(range);
-
- TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(t2start, curRange.getStartTime().getValue());
- assertEquals(t2end, curRange.getEndTime().getValue());
- }
-
- // ------------------------------------------------------------------------
- // Test multiple, non-overlapping traces in parallel
- // ------------------------------------------------------------------------
-
- /**
- * Test, with two traces in parallel, when we select a timestamp that is
- * part of the first trace.
- *
- * The first trace's timestamp should be updated, but the second trace's one
- * should not change.
- */
- @Test
- public void testTwoTracesTimestampValid() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* Timestamp of trace1 should have been updated */
- TmfTraceContext ctx = tm.getCurrentTraceContext();
- assertEquals(ts, ctx.getSelectionRange().getStartTime());
- assertEquals(ts, ctx.getSelectionRange().getEndTime());
-
- /* Timestamp of trace2 should not have changed */
- selectTrace(trace2);
- ctx = tm.getCurrentTraceContext();
- assertEquals(trace2.getStartTime(), ctx.getSelectionRange().getStartTime());
- assertEquals(trace2.getStartTime(), ctx.getSelectionRange().getEndTime());
- }
-
- /**
- * Test, with two traces in parallel, when we select a timestamp that is
- * between two traces.
- *
- * None of the trace's timestamps should be updated (we are not in an
- * experiment!)
- */
- @Test
- public void testTwoTracesTimestampInBetween() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* Timestamp of trace1 should not have changed */
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(trace1.getStartTime(), selection.getStartTime());
- assertEquals(trace1.getStartTime(), selection.getEndTime());
-
- /* Timestamp of trace2 should not have changed */
- selectTrace(trace2);
- selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(trace2.getStartTime(), selection.getStartTime());
- assertEquals(trace2.getStartTime(), selection.getEndTime());
- }
-
- /**
- * Test, with two traces in parallel, when we select a timestamp that is
- * completely out of the trace's range.
- *
- * None of the trace's timestamps should be updated.
- */
- @Test
- public void testTwoTracesTimestampInvalid() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* Timestamp of trace1 should not have changed */
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(trace1.getStartTime(), selection.getStartTime());
- assertEquals(trace1.getStartTime(), selection.getEndTime());
-
- /* Timestamp of trace2 should not have changed */
- selectTrace(trace2);
- selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(trace2.getStartTime(), selection.getStartTime());
- assertEquals(trace2.getStartTime(), selection.getEndTime());
- }
-
- /**
- * Test, with two traces opened in parallel (not in an experiment), if we
- * select a time range valid in one of them. That trace's time range should
- * be updated, but not the other one.
- */
- @Test
- public void testTwoTracesTimeRangeAllInOne() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1start + ONE_SECOND, SCALE),
- new TmfTimestamp(t1end - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- /* Range of trace1 should be equal to the requested one */
- assertEquals(range, tm.getCurrentTraceContext().getWindowRange());
-
- /* The range of trace 2 should not have changed */
- selectTrace(trace2);
- assertEquals(getInitialRange(trace2), tm.getCurrentTraceContext().getWindowRange());
- }
-
- /**
- * Test, with two traces in parallel, when we select a time range that is
- * only partially valid for one of the traces.
- *
- * The first trace's time range should be clamped to a valid range, and the
- * second one's should not change.
- */
- @Test
- public void testTwoTracesTimeRangePartiallyInOne() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1start + ONE_SECOND, SCALE),
- new TmfTimestamp(t1end + ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- /* Range of trace1 should get clamped to its end time */
- TmfTimeRange expectedRange = new TmfTimeRange(
- new TmfTimestamp(t1start + ONE_SECOND, SCALE),
- new TmfTimestamp(t1end, SCALE));
- assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
-
- /* Range of trace2 should not have changed */
- selectTrace(trace2);
- assertEquals(getInitialRange(trace2), tm.getCurrentTraceContext().getWindowRange());
- }
-
- /**
- * Test, with two traces in parallel, when we select a time range that is
- * only partially valid for both traces.
- *
- * Each trace's time range should get clamped to respectively valid ranges.
- */
- @Test
- public void testTwoTracesTimeRangeInBoth() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1end - ONE_SECOND, SCALE),
- new TmfTimestamp(t2start + ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- /* Range of trace1 should be clamped to its end time */
- TmfTimeRange expectedRange = new TmfTimeRange(
- new TmfTimestamp(t1end - ONE_SECOND, SCALE),
- new TmfTimestamp(t1end, SCALE));
- assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
-
- /* Range of trace2 should be clamped to its start time */
- selectTrace(trace2);
- expectedRange = new TmfTimeRange(
- new TmfTimestamp(t2start, SCALE),
- new TmfTimestamp(t2start + ONE_SECOND, SCALE));
- assertEquals(expectedRange, tm.getCurrentTraceContext().getWindowRange());
- }
-
- /**
- * Test, with two traces in parallel, when we select a time range that is
- * not valid for any trace.
- *
- * Each trace's time range should not be modified.
- */
- @Test
- public void testTwoTracesTimeRangeInBetween() {
- openTrace(trace1);
- openTrace(trace2);
- selectTrace(trace1);
- TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1end + ONE_SECOND, SCALE),
- new TmfTimestamp(t1end - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- /* Range of trace1 should not have changed */
- TmfTimeRange expectedRange = getInitialRange(trace1);
- TmfTimeRange curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
- assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
-
- /* Range of trace2 should not have changed */
- selectTrace(trace2);
- expectedRange = getInitialRange(trace2);
- curRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(expectedRange.getStartTime(), curRange.getStartTime());
- assertEquals(expectedRange.getEndTime(), curRange.getEndTime());
- }
-
- // ------------------------------------------------------------------------
- // Test an experiment
- // ------------------------------------------------------------------------
-
- /**
- * Test in an experiment when we select a timestamp that is part of one of
- * the experiment's traces.
- *
- * The experiment's current time should be correctly updated.
- */
- @Test
- public void testExperimentTimestampInTrace() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
- TmfTimestamp ts = new TmfTimestamp(t1start + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* The experiment's current time should be updated. */
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(ts, selection.getStartTime());
- assertEquals(ts, selection.getEndTime());
- }
-
- /**
- * Test in an experiment when we select a timestamp that is between two
- * traces in the experiment.
- *
- * The experiment's current time should still be updated, since the
- * timestamp is valid in the experiment itself.
- */
- @Test
- public void testExperimentTimestampInBetween() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
- TmfTimestamp ts = new TmfTimestamp(t1end + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* The experiment's current time should be updated. */
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(ts, selection.getStartTime());
- assertEquals(ts, selection.getEndTime());
- }
-
- /**
- * Test in an experiment when we select a timestamp that is outside of the
- * total range of the experiment.
- *
- * The experiment's current time should not be updated.
- */
- @Test
- public void testExperimentTimestampInvalid() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
- TmfTimestamp ts = new TmfTimestamp(t2end + ONE_SECOND, SCALE);
- selectTimestamp(ts);
-
- /* The experiment's current time should NOT be updated. */
- TmfTimeRange selection = tm.getCurrentTraceContext().getSelectionRange();
- assertEquals(trace1.getStartTime(), selection.getStartTime());
- assertEquals(trace1.getStartTime(), selection.getEndTime());
- }
-
- /**
- * Test the initial range of an experiment.
- */
- @Test
- public void testExperimentInitialRange() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
- /*
- * The initial range should be == to the initial range of the earliest
- * trace (here trace1).
- */
- final TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
-
- assertEquals(getInitialRange(trace1), actualRange);
- assertEquals(getInitialRange(exp), actualRange);
- }
-
- /**
- * Test the range clamping with the start time of the range outside of the
- * earliest trace's range. Only that start time should get clamped.
- */
- @Test
- public void testExperimentRangeClampingOne() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
-
- final TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1start - ONE_SECOND, SCALE),
- new TmfTimestamp(t1end - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(t1start, actualRange.getStartTime().getValue());
- assertEquals(t1end - ONE_SECOND, actualRange.getEndTime().getValue());
- }
-
- /**
- * Test the range clamping when both the start and end times of the signal's
- * range are outside of the trace's range. The range should clamp to the
- * experiment's range.
- */
- @Test
- public void testExperimentRangeClampingBoth() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
-
- final TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1start - ONE_SECOND, SCALE),
- new TmfTimestamp(t2end + ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(t1start, actualRange.getStartTime().getValue());
- assertEquals(t2end, actualRange.getEndTime().getValue());
- }
-
- /**
- * Test selecting a range in-between two disjoint traces in an experiment.
- * The range should still get correctly selected, even if no trace has any
- * events in that range.
- */
- @Test
- public void testExperimentRangeInBetween() {
- TmfExperiment exp = createExperiment(trace1, trace2);
- openTrace(exp);
-
- final TmfTimeRange range = new TmfTimeRange(
- new TmfTimestamp(t1end + ONE_SECOND, SCALE),
- new TmfTimestamp(t2start - ONE_SECOND, SCALE));
- selectWindowRange(range);
-
- TmfTimeRange actualRange = tm.getCurrentTraceContext().getWindowRange();
- assertEquals(range, actualRange);
- }
-
- // ------------------------------------------------------------------------
- // Utility methods
- // ------------------------------------------------------------------------
-
- private static TmfExperiment createExperiment(ITmfTrace t1, ITmfTrace t2) {
- ITmfTrace[] traces = new ITmfTrace[] { t1, t2 };
- TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "test-exp", traces,
- TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
- exp.indexTrace(true);
- // Deregister experiment from signal manager so that it doesn't
- // interfere with the TmfTraceManager tests
- TmfSignalManager.deregister(exp);
- return exp;
- }
-
- private static TmfTimeRange getInitialRange(ITmfTrace trace) {
- return new TmfTimeRange(
- trace.getStartTime(),
- calculateOffset(trace.getStartTime(), trace.getInitialRangeOffset()));
- }
-
- /**
- * Basically a "initial + offset" operation, but for ITmfTimetamp objects.
- */
- private static @NonNull ITmfTimestamp calculateOffset(ITmfTimestamp initialTs, ITmfTimestamp offsetTs) {
- long start = initialTs.normalize(0, SCALE).getValue();
- long offset = offsetTs.normalize(0, SCALE).getValue();
- return new TmfTimestamp(start + offset, SCALE);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test suite
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CtfTmfTraceTest.class,
- CtfTmfTraceValidateTest.class,
- FunkyTraceTest.class
-})
-public class AllTests {
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial generation with CodePro tools
- * Alexandre Montplaisir - Clean up, consolidate redundant tests
- * Patrick Tasse - Fix location ratio
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.signal.TmfEndSynchSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignal;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.TmfEventTypeCollectionHelper;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The class <code>CtfTmfTraceTest</code> contains tests for the class
- * <code>{@link CtfTmfTrace}</code>.
- *
- * @author ematkho
- * @version 1.0
- */
-public class CtfTmfTraceTest {
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
-
- private CtfTmfTrace fixture;
-
- /**
- * Perform pre-test initialization.
- *
- * @throws TmfTraceException
- * If the test trace is not found
- */
- @Before
- public void setUp() throws TmfTraceException {
- assumeTrue(testTrace.exists());
- fixture = new CtfTmfTrace();
- fixture.initTrace((IResource) null, testTrace.getPath(), CtfTmfEvent.class);
- }
-
- /**
- * Perform post-test clean-up.
- */
- @After
- public void tearDown() {
- if (fixture != null) {
- fixture.dispose();
- }
- }
-
- /**
- * Run the CtfTmfTrace() constructor test.
- */
- @Test
- public void testCtfTmfTrace() {
- try (CtfTmfTrace result = new CtfTmfTrace();) {
- assertNotNull(result);
- assertEquals(1000, result.getCacheSize());
- assertEquals(0L, result.getNbEvents());
- assertEquals(0L, result.getStreamingInterval());
- assertNull(result.getResource());
- assertNull(result.getType());
- }
- }
-
- /**
- * Test the parseEvent() method
- */
- @Test
- public void testParseEvent() {
- ITmfContext ctx = fixture.seekEvent(0);
- fixture.getNext(ctx);
- CtfTmfEvent event = fixture.parseEvent(ctx);
- assertNotNull(event);
- ctx.dispose();
- }
-
- /**
- * Run the void broadcast(TmfSignal) method test.
- */
- @Test
- public void testBroadcast() {
- TmfSignal signal = new TmfEndSynchSignal(1);
- fixture.broadcast(signal);
- }
-
- /**
- * Run the void dispose() method test.
- */
- @Test
- public void testClose() {
- try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
- }
- }
-
- /**
- * Run the int getCacheSize() method test.
- */
- @Test
- public void testGetCacheSize() {
- try (CtfTmfTrace emptyFixture = new CtfTmfTrace();) {
- int result = emptyFixture.getCacheSize();
- assertEquals(1000, result);
- }
- }
-
- /**
- * Run the ITmfLocation<Comparable> getCurrentLocation() method test.
- */
- @Test
- public void testGetCurrentLocation() {
- CtfLocation result = (CtfLocation) fixture.getCurrentLocation();
- assertNull(result);
- }
-
- /**
- * Test the seekEvent() method with a null location.
- */
- @Test
- public void testSeekEventLoc_null() {
- CtfLocation loc = null;
- fixture.seekEvent(loc);
- assertNotNull(fixture);
- }
-
- /**
- * Test the seekEvent() method with a location from a timestamp.
- */
- @Test
- public void testSeekEventLoc_timetamp() {
- CtfLocation loc = new CtfLocation(new TmfNanoTimestamp(0L));
- fixture.seekEvent(loc);
- assertNotNull(fixture);
- }
-
- /**
- * Run the ITmfTimestamp getEndTime() method test.
- */
- @Test
- public void testGetEndTime() {
- ITmfTimestamp result = fixture.getEndTime();
- assertNotNull(result);
- }
-
- /**
- * Run the String getEnvironment method test.
- */
- @Test
- public void testGetEnvValue() {
- String key = "tracer_name";
- String result = fixture.getTraceProperties().get(key);
- assertEquals("\"lttng-modules\"", result);
- }
-
- /**
- * Test the {@link CtfTmfTrace#getEventType()} method.
- */
- @Test
- public void testGetEventType() {
- Class<?> result = fixture.getEventType();
- assertNotNull(result);
- assertEquals(CtfTmfEvent.class, result);
- }
-
- /**
- * Run the Class<CtfTmfEvent> getContainedEventTypes() method test.
- */
- @Test
- public void testGetContainedEventTypes() {
- Set<? extends ITmfEventType> result = fixture.getContainedEventTypes();
- assertNotNull(result);
- assertFalse(result.isEmpty());
- }
-
- /**
- * Run the double getLocationRatio(ITmfLocation<?>) method test.
- */
- @Test
- public void testGetLocationRatio() {
- ITmfContext context = fixture.seekEvent(0);
- long t1 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- long t2 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- long t3 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- context.dispose();
- double ratio1 = fixture.getLocationRatio(new CtfLocation(t1, 0));
- assertEquals(0.0, ratio1, 0.01);
- double ratio2 = fixture.getLocationRatio(new CtfLocation(t2, 0));
- assertEquals((double) (t2 - t1) / (t3 - t1), ratio2, 0.01);
- double ratio3 = fixture.getLocationRatio(new CtfLocation(t3, 0));
- assertEquals(1.0, ratio3, 0.01);
- }
-
- /**
- * Run the String getName() method test.
- */
- @Test
- public void testGetName() {
- String result = fixture.getName();
- assertNotNull(result);
- }
-
- /**
- * Run the getTraceProperties() method test.
- */
- @Test
- public void testGetTraceProperties() {
- int result = fixture.getTraceProperties().size();
- assertEquals(9, result);
- }
-
- /**
- * Run the long getNbEvents() method test.
- */
- @Test
- public void testGetNbEvents() {
- long result = fixture.getNbEvents();
- assertEquals(1L, result);
- }
-
- /**
- * Run the CtfTmfEvent getNext(ITmfContext) method test.
- */
- @Test
- public void testGetNext() {
- ITmfContext context = fixture.seekEvent(0);
- CtfTmfEvent result = fixture.getNext(context);
- assertNotNull(result);
- context.dispose();
- }
-
- /**
- * Run the String getPath() method test.
- */
- @Test
- public void testGetPath() {
- String result = fixture.getPath();
- assertNotNull(result);
- }
-
- /**
- * Run the IResource getResource() method test.
- */
- @Test
- public void testGetResource() {
- IResource result = fixture.getResource();
- assertNull(result);
- }
-
- /**
- * Run the ITmfTimestamp getStartTime() method test.
- */
- @Test
- public void testGetStartTime() {
- ITmfTimestamp result = fixture.getStartTime();
- assertNotNull(result);
- }
-
- /**
- * Run the long getStreamingInterval() method test.
- */
- @Test
- public void testGetStreamingInterval() {
- long result = fixture.getStreamingInterval();
- assertEquals(0L, result);
- }
-
- /**
- * Run the TmfTimeRange getTimeRange() method test.
- */
- @Test
- public void testGetTimeRange() {
- TmfTimeRange result = fixture.getTimeRange();
- assertNotNull(result);
- }
-
- /**
- * Run the CtfTmfEvent readNextEvent(ITmfContext) method test.
- */
- @Test
- public void testReadNextEvent() {
- ITmfContext context = fixture.seekEvent(0);
- CtfTmfEvent result = fixture.getNext(context);
- assertNotNull(result);
- context.dispose();
- }
-
- /**
- * Run the ITmfContext seekEvent(double) method test.
- */
- @Test
- public void testSeekEvent_ratio() {
- ITmfContext context = fixture.seekEvent(0);
- long t1 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- long t2 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- long t3 = ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp();
- fixture.getNext(context);
- context.dispose();
- context = fixture.seekEvent(0.0);
- assertEquals(t1, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
- context.dispose();
- context = fixture.seekEvent(0.5);
- assertEquals(t2, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
- context.dispose();
- context = fixture.seekEvent(1.0);
- assertEquals(t3, ((CtfLocationInfo) context.getLocation().getLocationInfo()).getTimestamp());
- context.dispose();
- }
-
- /**
- * Run the ITmfContext seekEvent(long) method test.
- */
- @Test
- public void testSeekEvent_rank() {
- long rank = 1L;
- ITmfContext result = fixture.seekEvent(rank);
- assertNotNull(result);
- result.dispose();
- }
-
- /**
- * Run the ITmfContext seekEvent(ITmfTimestamp) method test.
- */
- @Test
- public void testSeekEvent_timestamp() {
- ITmfTimestamp timestamp = new TmfTimestamp();
- ITmfContext result = fixture.seekEvent(timestamp);
- assertNotNull(result);
- result.dispose();
- }
-
- /**
- * Run the ITmfContext seekEvent(ITmfLocation<?>) method test.
- */
- @Test
- public void testSeekEvent_location() {
- final CtfLocationInfo location2 = new CtfLocationInfo(1L, 0L);
- CtfLocation ctfLocation = new CtfLocation(location2);
- ITmfContext result = fixture.seekEvent(ctfLocation);
- assertNotNull(result);
- result.dispose();
- }
-
- /**
- * Run the boolean validate(IProject,String) method test.
- */
- @Test
- public void testValidate() {
- IProject project = null;
- IStatus result = fixture.validate(project, testTrace.getPath());
- assertTrue(result.isOK());
- }
-
- /**
- * Run the boolean hasEvent(final String) method test
- */
- @Test
- public void testEventLookup() {
- Set<? extends ITmfEventType> eventTypes = fixture.getContainedEventTypes();
- Set<String> eventNames = TmfEventTypeCollectionHelper.getEventNames(eventTypes);
- assertTrue(eventNames.contains("sched_switch"));
- assertFalse(eventNames.contains("Sched_switch"));
- String[] events = { "sched_switch", "sched_wakeup", "timer_init" };
- assertTrue(eventNames.containsAll(Arrays.asList(events)));
- Set<String> copy = new HashSet<>(eventNames);
- copy.retainAll(Arrays.asList(events));
- assertFalse(copy.isEmpty());
- String[] names = { "inexistent", "sched_switch", "SomeThing" };
- copy = new HashSet<>(eventNames);
- copy.retainAll(Arrays.asList(names));
- assertTrue(!copy.isEmpty());
- assertFalse(eventNames.containsAll(Arrays.asList(names)));
- }
-
- /**
- * Run the String getHostId() method test
- */
- @Test
- public void testCtfHostId() {
- String a = fixture.getHostId();
- assertEquals("\"84db105b-b3f4-4821-b662-efc51455106a\"", a);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - IInitial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTraceValidationStatus;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * The class <code>CtfTmfTraceValidateTest</code> contains tests for trace
- * validation
- * <code>{@link CtfTmfTrace#validate(org.eclipse.core.resources.IProject, String)}</code>
- * .
- *
- * @author Bernd Hufmann
- */
-@RunWith(Parameterized.class)
-public class CtfTmfTraceValidateTest {
-
- private static final Path BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces");
- private static final Path CTF_SUITE_BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces", "ctf-testsuite", "tests", "1.8");
-
- private String fTrace;
- private int fServerity;
- private int fConfidence;
- private boolean fHasException;
-
- /**
- * Gets a list of test case parameters.
- *
- * @return The list of CTF traces (directories) to test
- */
- @Parameters(name = "{index}: {0}")
- public static Iterable<Object[]> getTracePaths() {
- final List<Object[]> dirs = new LinkedList<>();
- // text-only metadata, valid CTF trace (lttle-endian)
- addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "literal-integers")), IStatus.OK, 10, false);
- // packet-based metadata, valid CTF trace (lttle-endian)
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("kernel")), IStatus.OK, 10, false);
- // text-only metadata, but invalid
- addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "enum-empty")), IStatus.WARNING, 1, true);
- // packet-based metadata, but invalid
- addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "lttng-modules-2.0-pre1")), IStatus.WARNING, 1, true);
- // pass file instead of directory
- addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("trace2.tar.bz2")), IStatus.ERROR, 1, false);
-
- return dirs;
- }
-
- private static void addDirsFrom(List<Object[]> dirs, Path path, int severity, int confidence, boolean hasException) {
- if (!Files.exists(path)) {
- /* Some planned directories may not exist yet in the test suite */
- return;
- }
-
- Object array[] = new Object[] { path.toString(), severity, confidence, hasException };
- dirs.add(array);
- }
-
- /**
- * @param trace
- * a trace path
- * @param severity
- * severity of validation status expected
- * @param confidence
- * confidence of validation status expected
- * @param hasException
- * flag whether validation status should contain exception
- */
- public CtfTmfTraceValidateTest(String trace, int severity, int confidence, boolean hasException) {
- fTrace = trace;
- fServerity = severity;
- fConfidence = confidence;
- fHasException = hasException;
- }
-
- /**
- * Main test cases
- */
- @Test
- public void testValidate() {
- try (CtfTmfTrace trace = new CtfTmfTrace();) {
- IStatus status = trace.validate(null, fTrace);
- assertEquals(toString(), fServerity, status.getSeverity());
-
- if (fHasException) {
- assertNotNull(toString(), status.getException());
- }
- switch (status.getSeverity()) {
- case IStatus.OK: {
- assertTrue(status instanceof CtfTraceValidationStatus);
- CtfTraceValidationStatus ctfStatus = (CtfTraceValidationStatus) status;
- assertEquals(toString(), fConfidence, ctfStatus.getConfidence());
- assertNotNull(ctfStatus.getEnvironment());
- break;
- }
- case IStatus.WARNING: {
- assertTrue(status instanceof TraceValidationStatus);
- TraceValidationStatus ctfStatus = (TraceValidationStatus) status;
- assertEquals(fConfidence, ctfStatus.getConfidence());
- break;
- }
- case IStatus.ERROR: {
- // nothing else to check here
- break;
- }
- default:
- // no other severity should be returned
- fail();
- break;
- }
- assertEquals(fServerity, status.getSeverity());
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.trace;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.request.TmfEventRequest;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.ctf.core.CtfEnumPair;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-
-/**
- * More advanced CTF tests using "funky_trace", a trace generated with the
- * Babeltrace CTF writer API, which has lots of fun things like different
- * integer/float sizes and non-standard struct alignments.
- *
- * @author Alexandre Montplaisir
- */
-public class FunkyTraceTest {
-
- /** Time-out tests after 20 seconds */
- @Rule
- public TestRule globalTimeout= new Timeout(20000);
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.FUNKY_TRACE;
- private static final double DELTA = 0.0000001;
-
- private CtfTmfTrace fTrace;
-
- // ------------------------------------------------------------------------
- // Setup
- // ------------------------------------------------------------------------
-
- /**
- * Test setup
- */
- @Before
- public void setup() {
- assumeTrue(testTrace.exists());
- fTrace = testTrace.getTrace();
- fTrace.indexTrace(true);
- }
-
- /**
- * Clean-up
- */
- @After
- public void tearDown() {
- if (fTrace != null) {
- fTrace.dispose();
- }
- }
-
- // ------------------------------------------------------------------------
- // Test methods
- // ------------------------------------------------------------------------
-
- /**
- * Verify the contents of the first event
- */
- @Test
- public void testFirstEvent() {
- CtfTmfEvent event = getEvent(0);
- assertEquals("Simple Event", event.getType().getName());
- assertEquals(1234567, event.getTimestamp().getValue());
- assertEquals(42, ((Long) event.getContent().getField("integer_field").getValue()).intValue());
- assertEquals(3.1415, ((Double) event.getContent().getField("float_field").getValue()).doubleValue(), DELTA);
- }
-
- /**
- * Verify the contents of the second event (the first "spammy event")
- */
- @Test
- public void testSecondEvent() {
- CtfTmfEvent event = getEvent(1);
- assertEquals("Spammy_Event", event.getType().getName());
- assertEquals(1234568, event.getTimestamp().getValue());
- assertEquals(0, ((Long) event.getContent().getField("field_1").getValue()).intValue());
- assertEquals("This is a test", event.getContent().getField("a_string").getValue());
- }
-
- /**
- * Verify the contents of the last "spammy event"
- */
- @Test
- public void testSecondToLastEvent() {
- CtfTmfEvent event = getEvent(100000);
- assertEquals("Spammy_Event", event.getType().getName());
- assertEquals(1334567, event.getTimestamp().getValue());
- assertEquals(99999, ((Long) event.getContent().getField("field_1").getValue()).intValue());
- assertEquals("This is a test", event.getContent().getField("a_string").getValue());
- }
-
- /**
- * Verify the contents of the last, complex event
- */
- @Test
- public void testLastEvent() {
- /*
- * Last event as seen in Babeltrace:
- * [19:00:00.001334568] (+0.000000001) Complex Test Event: { }, {
- * uint_35 = 0xDDF00D,
- * int_16 = -12345,
- * complex_structure = {
- * variant_selector = ( INT16_TYPE : container = 1 ),
- * a_string = "Test string",
- * variant_value = { INT16_TYPE = -200 },
- * inner_structure = {
- * seq_len = 0xA,
- * a_sequence = [ [0] = 4, [1] = 3, [2] = 2, [3] = 1, [4] = 0, [5] = -1, [6] = -2, [7] = -3, [8] = -4, [9] = -5 ]
- * }
- * }
- * }
- */
-
- CtfTmfEvent event = getEvent(100001);
- assertEquals("Complex Test Event", event.getType().getName());
- assertEquals(1334568, event.getTimestamp().getValue());
- assertEquals(0xddf00d, ((Long) event.getContent().getField("uint_35").getValue()).intValue());
- assertEquals(-12345, ((Long) event.getContent().getField("int_16").getValue()).intValue());
-
- ITmfEventField[] complexStruct =
- (ITmfEventField[]) event.getContent().getField("complex_structure").getValue();
-
- assertEquals("variant_selector", complexStruct[0].getName());
- CtfEnumPair variant1 = (CtfEnumPair) complexStruct[0].getValue();
- assertEquals("INT16_TYPE", variant1.getStringValue());
- assertEquals(Long.valueOf(1), variant1.getLongValue());
-
- assertEquals("a_string", complexStruct[1].getName());
- assertEquals("Test string", complexStruct[1].getValue());
-
- assertEquals("variant_value", complexStruct[2].getName());
- ITmfEventField variantField = (ITmfEventField) complexStruct[2].getValue();
- assertEquals("INT16_TYPE", variantField.getName());
- assertEquals(Long.valueOf(-200), variantField.getValue());
-
- ITmfEventField[] innerStruct = (ITmfEventField[]) complexStruct[3].getValue();
-
- assertEquals("seq_len", innerStruct[0].getName());
- assertEquals(Long.valueOf(10), innerStruct[0].getValue());
-
- assertEquals("a_sequence", innerStruct[1].getName());
- long[] seqValues = (long[]) innerStruct[1].getValue();
- long[] expectedValues = { 4, 3, 2, 1, 0, -1, -2, -3, -4, -5 };
- assertArrayEquals(expectedValues, seqValues);
- }
-
- // ------------------------------------------------------------------------
- // Private stuff
- // ------------------------------------------------------------------------
-
- private synchronized CtfTmfEvent getEvent(long index) {
- TestEventRequest req = new TestEventRequest(index);
- fTrace.sendRequest(req);
- try {
- req.waitForCompletion();
- } catch (InterruptedException e) {
- return null;
- }
- return req.getEvent();
- }
-
- private class TestEventRequest extends TmfEventRequest {
-
- private CtfTmfEvent fRetEvent = null;
-
- public TestEventRequest(long index) {
- super(CtfTmfEvent.class,
- TmfTimeRange.ETERNITY,
- index,
- 1,
- ExecutionType.FOREGROUND);
- }
-
- @Override
- public void handleData(ITmfEvent event) {
- fRetEvent = (CtfTmfEvent) event;
- }
-
- public CtfTmfEvent getEvent() {
- return fRetEvent;
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 École Polytechnique de Montréal
- *
- * 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:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.tests.stubs;
-
-import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
-import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Dummy test ctf trace
- */
-public class CtfTmfTraceStub extends CtfTmfTrace {
-
- /**
- * Simulate trace opening, to be called by tests who need an actively opened
- * trace
- */
- public void openTrace() {
- TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, this, null));
- selectTrace();
- }
-
- /**
- * Simulate selecting the trace
- */
- public void selectTrace() {
- TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, this));
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.tmf.ctf.core</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=error
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=1
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=1
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.core;singleton:=true
-Bundle-Activator: org.eclipse.tracecompass.internal.tmf.ctf.core.Activator
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.tracecompass.common.core,
- org.eclipse.tracecompass.ctf.core,
- org.eclipse.tracecompass.tmf.core
-Export-Package: org.eclipse.tracecompass.internal.tmf.ctf.core;x-internal:=true,
- org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;x-friends:="org.eclipse.tracecompass.tmf.ctf.core.tests",
- org.eclipse.tracecompass.tmf.ctf.core,
- org.eclipse.tracecompass.tmf.ctf.core.context,
- org.eclipse.tracecompass.tmf.ctf.core.event,
- org.eclipse.tracecompass.tmf.ctf.core.event.aspect,
- org.eclipse.tracecompass.tmf.ctf.core.event.lookup,
- org.eclipse.tracecompass.tmf.ctf.core.trace
-Import-Package: com.google.common.collect,
- org.eclipse.emf.common.util
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- plugin.xml
-src.includes = about.html
-additional.bundles = org.eclipse.jdt.annotation
-jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = CTF support for TMF Core Plug-in
-
-# CTF trace type
-tracetype.category.ctf = Common Trace Format
-tracetype.type.ctf = Generic CTF Trace
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.linuxtools.tmf.core.tracetype">
- <category
- id="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
- name="%tracetype.category.ctf">
- </category>
- <type
- category="org.eclipse.linuxtools.tmf.ctf.core.category.ctf"
- event_type="org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent"
- id="org.eclipse.linuxtools.tmf.ui.type.ctf"
- isDirectory="true"
- name="%tracetype.type.ctf"
- trace_type="org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace">
- </type>
- </extension>
-
-</plugin>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.tracecompass.tmf.ctf.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-
- <name>CTF support for TMF Core Plug-in</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-source-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <groupId>org.eclipse.tracecompass</groupId>
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * 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:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.ctf.core;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-/**
- * <b><u>Activator</u></b>
- * <p>
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * The plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.tracecompass.tmf.ctf.core"; //$NON-NLS-1$
-
- /**
- * The shared instance
- */
- private static Activator plugin;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- // ------------------------------------------------------------------------
- // Operators
- // ------------------------------------------------------------------------
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Logs a message with severity INFO in the runtime log of the plug-in.
- *
- * @param message A message to log
- */
- public void logInfo(String message) {
- getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity INFO in the runtime log of the plug-in.
- *
- * @param message A message to log
- * @param exception A exception to log
- */
- public void logInfo(String message, Throwable exception) {
- getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
- }
-
- /**
- * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
- *
- * @param message A message to log
- */
- public void logWarning(String message) {
- getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
- *
- * @param message A message to log
- * @param exception A exception to log
- */
- public void logWarning(String message, Throwable exception) {
- getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
- }
-
- /**
- * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
- *
- * @param message A message to log
- */
- public void logError(String message) {
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
- *
- * @param message A message to log
- * @param exception A exception to log
- */
- public void logError(String message, Throwable exception) {
- getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson, École Polytechnique de Montréal
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Florian Wininger - Performance improvements
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
-
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventFactory;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * The CTF trace reader iterator.
- *
- * It doesn't reserve a file handle, so many iterators can be used without
- * worries of I/O errors or resource exhaustion.
- *
- * @author Matthew Khouzam
- */
-public class CtfIterator extends CTFTraceReader
- implements ITmfContext, Comparable<CtfIterator> {
-
- /** An invalid location */
- public static final CtfLocation NULL_LOCATION = new CtfLocation(CtfLocation.INVALID_LOCATION);
-
- private final CtfTmfTrace fTrace;
-
- private CtfLocation fCurLocation;
- private long fCurRank;
-
- private CtfLocation fPreviousLocation;
- private CtfTmfEvent fPreviousEvent;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Create a new CTF trace iterator, which initially points at the first
- * event in the trace.
- *
- * @param ctfTrace
- * The {@link CTFTrace} linked to the trace. It should be
- * provided by the corresponding 'ctfTmfTrace'.
- *
- * @param ctfTmfTrace
- * The {@link CtfTmfTrace} to iterate over
- * @throws CTFException
- * If the iterator couldn't not be instantiated, probably due to
- * a read error.
- */
- public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace) throws CTFException {
- super(ctfTrace);
- fTrace = ctfTmfTrace;
- if (hasMoreEvents()) {
- fCurLocation = new CtfLocation(ctfTmfTrace.getStartTime());
- fCurRank = 0;
- } else {
- setUnknownLocation();
- }
- }
-
- /**
- * Create a new CTF trace iterator, which will initially point to the given
- * location/rank.
- *
- * @param ctfTrace
- * The {@link CTFTrace} linked to the trace. It should be
- * provided by the corresponding 'ctfTmfTrace'.
- * @param ctfTmfTrace
- * The {@link CtfTmfTrace} to iterate over
- * @param ctfLocationData
- * The initial timestamp the iterator will be pointing to
- * @param rank
- * The initial rank
- * @throws CTFException
- * If the iterator couldn't not be instantiated, probably due to
- * a read error.
- */
- public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace, CtfLocationInfo ctfLocationData, long rank)
- throws CTFException {
- super(ctfTrace);
-
- this.fTrace = ctfTmfTrace;
- if (this.hasMoreEvents()) {
- this.fCurLocation = new CtfLocation(ctfLocationData);
- if (this.getCurrentEvent().getTimestamp().getValue() != ctfLocationData.getTimestamp()) {
- this.seek(ctfLocationData);
- this.fCurRank = rank;
- }
- } else {
- setUnknownLocation();
- }
- }
-
- @Override
- public void dispose() {
- close();
- }
-
- private void setUnknownLocation() {
- fCurLocation = NULL_LOCATION;
- fCurRank = UNKNOWN_RANK;
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Return this iterator's trace.
- *
- * @return CtfTmfTrace The iterator's trace
- */
- public CtfTmfTrace getCtfTmfTrace() {
- return fTrace;
- }
-
- /**
- * Return the current event pointed to by the iterator.
- *
- * @return CtfTmfEvent The current event
- */
- public synchronized CtfTmfEvent getCurrentEvent() {
- final CTFStreamInputReader top = super.getPrio().peek();
- if (top != null) {
- if (!fCurLocation.equals(fPreviousLocation)) {
- fPreviousLocation = fCurLocation;
- fPreviousEvent = CtfTmfEventFactory.createEvent(top.getCurrentEvent(),
- top.getFilename(), fTrace);
- }
- return fPreviousEvent;
- }
- return null;
- }
-
- /**
- * Return the current timestamp location pointed to by the iterator. This is
- * the timestamp for use in CtfLocation, not the event timestamp.
- *
- * @return long The current timestamp location
- */
- public synchronized long getCurrentTimestamp() {
- final CTFStreamInputReader top = super.getPrio().peek();
- if (top != null) {
- long ts = top.getCurrentEvent().getTimestamp();
- return fTrace.timestampCyclesToNanos(ts);
- }
- return 0;
- }
-
- /**
- * Seek this iterator to a given location.
- *
- * @param ctfLocationData
- * The LocationData representing the position to seek to
- * @return boolean True if the seek was successful, false if there was an
- * error seeking.
- */
- public synchronized boolean seek(CtfLocationInfo ctfLocationData) {
- boolean ret = false;
-
- /* Avoid the cost of seeking at the current location. */
- if (fCurLocation.getLocationInfo().equals(ctfLocationData)) {
- return super.hasMoreEvents();
- }
- /* Update location to make sure the current event is updated */
- fCurLocation = new CtfLocation(ctfLocationData);
-
- /* Adjust the timestamp depending on the trace's offset */
- long currTimestamp = ctfLocationData.getTimestamp();
- final long offsetTimestamp = this.getCtfTmfTrace().timestampNanoToCycles(currTimestamp);
- try {
- if (offsetTimestamp < 0) {
- ret = super.seek(0L);
- } else {
- ret = super.seek(offsetTimestamp);
- }
- } catch (CTFException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- return false;
- }
- /*
- * Check if there is already one or more events for that timestamp, and
- * assign the location index correctly
- */
- long index = 0;
- final CtfTmfEvent currentEvent = this.getCurrentEvent();
- if (currentEvent != null) {
- currTimestamp = currentEvent.getTimestamp().getValue();
-
- for (long i = 0; i < ctfLocationData.getIndex(); i++) {
- if (currTimestamp == currentEvent.getTimestamp().getValue()) {
- index++;
- } else {
- index = 0;
- }
- this.advance();
- }
- } else {
- ret = false;
- }
- /* Seek the current location accordingly */
- if (ret) {
- fCurLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index));
- } else {
- fCurLocation = NULL_LOCATION;
- }
-
- return ret;
- }
-
- // ------------------------------------------------------------------------
- // CTFTraceReader
- // ------------------------------------------------------------------------
-
- @Override
- public boolean seek(long timestamp) {
- return seek(new CtfLocationInfo(timestamp, 0));
- }
-
- @Override
- public synchronized boolean advance() {
- boolean ret = false;
- try {
- ret = super.advance();
- } catch (CTFException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- }
-
- if (ret) {
- long timestamp = fCurLocation.getLocationInfo().getTimestamp();
- final long timestampValue = getCurrentTimestamp();
- if (timestamp == timestampValue) {
- long index = fCurLocation.getLocationInfo().getIndex();
- fCurLocation = new CtfLocation(timestampValue, index + 1);
- } else {
- fCurLocation = new CtfLocation(timestampValue, 0L);
- }
- } else {
- fCurLocation = NULL_LOCATION;
- }
- return ret;
- }
-
- // ------------------------------------------------------------------------
- // ITmfContext
- // ------------------------------------------------------------------------
-
- @Override
- public long getRank() {
- return fCurRank;
- }
-
- @Override
- public void setRank(long rank) {
- fCurRank = rank;
- }
-
- @Override
- public void increaseRank() {
- /* Only increase the rank if it's valid */
- if (hasValidRank()) {
- fCurRank++;
- }
- }
-
- @Override
- public boolean hasValidRank() {
- return (getRank() >= 0);
- }
-
- @Override
- public void setLocation(ITmfLocation location) {
- // FIXME alex: isn't there a cleaner way than a cast here?
- fCurLocation = (CtfLocation) location;
- seek(((CtfLocation) location).getLocationInfo());
- }
-
- @Override
- public CtfLocation getLocation() {
- return fCurLocation;
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- public int compareTo(final CtfIterator o) {
- if (getRank() < o.getRank()) {
- return -1;
- } else if (getRank() > o.getRank()) {
- return 1;
- }
- return 0;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = (prime * result)
- + ((fTrace == null) ? 0 : fTrace.hashCode());
- result = (prime * result)
- + ((fCurLocation == null) ? 0 : fCurLocation.hashCode());
- result = (prime * result) + (int) (fCurRank ^ (fCurRank >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (!(obj instanceof CtfIterator)) {
- return false;
- }
- CtfIterator other = (CtfIterator) obj;
- if (!equalsNullable(fTrace, other.fTrace)) {
- return false;
- }
- if (!equalsNullable(fCurLocation, other.fCurLocation)) {
- return false;
- }
- if (fCurRank != other.fCurRank) {
- return false;
- }
- return true;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Renamed/extracted from CtfTraceManager
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * A CTF trace iterator manager.
- *
- * Each instance of {@link CtfTmfTrace} should possess one of these, which will
- * manage the iterators that are opened to read that trace. This will allow
- * controlling the number of opened file handles per trace.
- *
- * @author Matthew Khouzam
- */
-public class CtfIteratorManager {
- /*
- * Cache size. Under 1023 on linux32 systems. Number of file handles
- * created.
- */
- private static final int MAX_SIZE = 100;
-
- /** The map of the cache */
- private final Map<CtfTmfContext, CtfIterator> fMap;
-
- /** An array pointing to the same cache. this allows fast "random" accesses */
- private final List<CtfTmfContext> fRandomAccess;
-
- /** Lock for when we access the two previous data structures */
- private final Lock fAccessLock = new ReentrantLock();
-
- /** The parent trace */
- private final CtfTmfTrace fTrace;
-
- /** Random number generator */
- private final Random fRnd;
-
- /**
- * Constructor
- *
- * @param trace
- * The trace whose iterators this manager will manage
- */
- public CtfIteratorManager(CtfTmfTrace trace) {
- fMap = new HashMap<>();
- fRandomAccess = new ArrayList<>();
- fRnd = new Random(System.nanoTime());
- fTrace = trace;
- }
-
- /**
- * This needs explaining: the iterator table is effectively a cache.
- * Originally the contexts had a 1 to 1 structure with the file handles of a
- * trace. This failed since there is a limit to how many file handles we can
- * have opened simultaneously. Then a round-robin scheme was implemented,
- * this lead up to a two competing contexts syncing up and using the same
- * file handler, causing horrible slowdowns. Now a random replacement
- * algorithm is selected. This is the same as used by arm processors, and it
- * works quite well when many cores so this looks promising for very
- * multi-threaded systems.
- *
- * @param context
- * the context to look up
- * @return the iterator referring to the context
- */
- public CtfIterator getIterator(final CtfTmfContext context) {
- /*
- * if the element is in the map, we don't need to do anything else.
- */
- CtfIterator iter = fMap.get(context);
- if (iter == null) {
-
- fAccessLock.lock();
- try {
- /*
- * Assign an iterator to a context.
- */
- if (fRandomAccess.size() < MAX_SIZE) {
- /*
- * if we're not full yet, just add an element.
- */
- iter = (CtfIterator) fTrace.createIterator();
- addElement(context, iter);
-
- } else {
- /*
- * if we're full, randomly replace an element
- */
- iter = replaceRandomElement(context);
- }
- if (context.getLocation() != null) {
- final CtfLocationInfo location = (CtfLocationInfo) context.getLocation().getLocationInfo();
- iter.seek(location);
- }
- } finally {
- fAccessLock.unlock();
- }
- }
- return iter;
- }
-
- /**
- * Remove an iterator from this manager
- *
- * @param context
- * The context of the iterator to remove
- */
- public void removeIterator(CtfTmfContext context) {
- fAccessLock.lock();
- try {
- /* The try below is only to auto-call CtfIterator.close() */
- try (CtfIterator removed = fMap.remove(context)) {
- // try with resource
- }
- fRandomAccess.remove(context);
-
- } finally {
- fAccessLock.unlock();
- }
- }
-
- /**
- * Add a pair of context and element to the hashmap and the arraylist.
- *
- * @param context
- * the context
- * @param elem
- * the iterator
- */
- private void addElement(final CtfTmfContext context,
- final CtfIterator elem) {
- fAccessLock.lock();
- try {
- fMap.put(context, elem);
- fRandomAccess.add(context);
-
- } finally {
- fAccessLock.unlock();
- }
- }
-
- /**
- * Replace a random element
- *
- * @param context
- * the context to swap in
- * @return the iterator of the removed elements.
- */
- private CtfIterator replaceRandomElement(final CtfTmfContext context) {
- /*
- * This needs some explanation too: We need to select a random victim
- * and remove it. The order of the elements is not important, so instead
- * of just calling arraylist.remove(element) which has an O(n)
- * complexity, we pick an random number. The element is swapped out of
- * the array and removed and replaced in the hashmap.
- */
- fAccessLock.lock(); // just in case, should only be called when already locked
- try {
- final int size = fRandomAccess.size();
- final int pos = fRnd.nextInt(size);
- final CtfTmfContext victim = fRandomAccess.get(pos);
- fRandomAccess.set(pos, context);
- final CtfIterator elem = fMap.remove(victim);
- fMap.put(context, elem);
- victim.dispose();
- return elem;
-
- } finally {
- fAccessLock.unlock();
- }
- }
-
- /**
- * Dispose this iterator manager, which will close all the remaining
- * iterators.
- */
- public void dispose() {
- fAccessLock.lock();
- try {
- for (CtfIterator iterator : fMap.values()) {
- iterator.dispose();
- }
- fMap.clear();
- fRandomAccess.clear();
-
- } finally {
- fAccessLock.unlock();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson, Ecole Polytechnique de Montreal 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:
- * Ansgar Radermacher - support for model URI
- * Patrick Tasse - context strings
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core;
-
-import org.eclipse.core.runtime.QualifiedName;
-
-/**
- * Set of constants used by the CTF adaptor classes
- *
- * @noimplement This interface is not intended to be implemented by clients.
- */
-@SuppressWarnings("nls")
-public interface CtfConstants {
-
- /*
- * Context strings
- */
-
- /** Prefix for context information stored as CtfTmfEventfield */
- String CONTEXT_FIELD_PREFIX = "context.";
-
- /** Key for ip field */
- String IP_KEY = "_ip";
-
- /*
- * Custom attributes names (key within hash table)
- */
-
- /** Model URI for traces related to EMF models */
- String MODEL_URI_KEY = "model.emf.uri";
-
- /**
- * The host persistent property for the live session.
- */
- QualifiedName LIVE_HOST = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.host"); //$NON-NLS-1$//$NON-NLS-2$
-
- /**
- * The port persistent property for the live session.
- */
- QualifiedName LIVE_PORT = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.port"); //$NON-NLS-1$//$NON-NLS-2$
-
- /**
- * The live session name persistent property.
- */
- QualifiedName LIVE_SESSION_NAME = new QualifiedName("org.eclipse.linuxtools.tmf.ctf.core", "live.session.name"); //$NON-NLS-1$//$NON-NLS-2$;
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core;
-
-import org.eclipse.tracecompass.tmf.core.util.Pair;
-
-/**
- * Pair of Enum value name and its long value.
- *
- * @author Bernd Hufmann
- */
-public class CtfEnumPair extends Pair<String, Long> {
-
- /**
- * Constructs a CtfEnumPair
- *
- * @param strValue
- * The first parameter of the pair (String)
- * @param longValue
- * The second parameter of the pair (Long)
- */
- public CtfEnumPair(String strValue, Long longValue) {
- super(strValue, longValue);
- }
-
- /**
- * Returns the String value of the Enum.
- *
- * @return the string value
- */
- public String getStringValue() {
- return getFirst();
- }
-
- /**
- * Returns the long value of the Enum.
- *
- * @return the Long value
- */
- public Long getLongValue() {
- return getSecond();
- }
-
- @Override
- public String toString() {
- return getFirst();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Extends TmfLocation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.context;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.location.TmfLocation;
-
-/**
- * The nugget of information that is unique to a location in a CTF trace.
- *
- * It can be copied and used to restore a position in a given trace.
- *
- * @author Matthew Khouzam
- */
-public final class CtfLocation extends TmfLocation {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /**
- * An invalid location
- */
- public static final CtfLocationInfo INVALID_LOCATION = new CtfLocationInfo(-1, -1);
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Basic constructor for CtfLocation. Uses a default index of 0.
- *
- * @param timestamp
- * The timestamp of this location
- */
- public CtfLocation(final ITmfTimestamp timestamp) {
- this(timestamp.getValue(), 0);
- }
-
- /**
- * Constructor using timestamp object and index
- *
- * @param timestamp
- * The timestamp of this location
- * @param index
- * The index of this location for this timestamp
- */
- public CtfLocation(final ITmfTimestamp timestamp, long index) {
- this(timestamp.getValue(), index);
- }
-
- /**
- * Constructor using a long value for the timestamp, and an index
- *
- * @param timestampValue
- * The new timestamp
- * @param index
- * The new index
- */
- public CtfLocation(final long timestampValue, final long index) {
- super(new CtfLocationInfo(timestampValue, index));
- }
-
- /**
- * Constructor using a pre-made locationInfo object
- *
- * @param locationInfo
- * The locationInfo object to use
- */
- public CtfLocation(CtfLocationInfo locationInfo) {
- super(locationInfo);
- }
-
- /**
- * Copy constructor
- *
- * @param location
- * Other location to copy
- */
- public CtfLocation(final CtfLocation location) {
- super(location);
- }
-
- // ------------------------------------------------------------------------
- // TmfLocation
- // ------------------------------------------------------------------------
-
- /**
- * Construct the location from the ByteBuffer.
- *
- * @param bufferIn
- * the buffer to read from
- */
- public CtfLocation(ByteBuffer bufferIn) {
- super(new CtfLocationInfo(bufferIn));
- }
-
- @Override
- public CtfLocationInfo getLocationInfo() {
- return (CtfLocationInfo) super.getLocationInfo();
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public String toString() {
- if (getLocationInfo().equals(CtfLocation.INVALID_LOCATION )) {
- return getClass().getSimpleName() + " [INVALID]"; //$NON-NLS-1$
- }
- return super.toString();
- }
-
- /**
- * Constructs the location from the ByteBuffer. This typically happens when reading from disk.
- */
- @Override
- public void serialize(ByteBuffer bufferOut) {
- getLocationInfo().serialize(bufferOut);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.context;
-
-import java.nio.ByteBuffer;
-
-/**
- * The data object to go in a {@link CtfLocation}.
- *
- * @author Matthew Khouzam
- */
-public class CtfLocationInfo implements Comparable<CtfLocationInfo> {
-
- private final long fTimestamp;
- private final long fIndex;
-
- /**
- * @param ts
- * Timestamp
- * @param index
- * Index of this event (if there are N elements with the same
- * timestamp, which one is it.)
- */
- public CtfLocationInfo(long ts, long index) {
- fTimestamp = ts;
- fIndex = index;
- }
-
- /**
- * Construct the location from the ByteBuffer.
- *
- * @param bufferIn
- * the buffer to read from
- */
- public CtfLocationInfo(ByteBuffer bufferIn) {
- fTimestamp = bufferIn.getLong();
- fIndex = bufferIn.getLong();
- }
-
- /**
- * @return The timestamp
- */
- public long getTimestamp() {
- return fTimestamp;
- }
-
- /**
- * @return The index of the element
- */
- public long getIndex() {
- return fIndex;
- }
-
- // ------------------------------------------------------------------------
- // Object
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = (prime * result) + (int) (fIndex ^ (fIndex >>> 32));
- result = (prime * result) + (int) (fTimestamp ^ (fTimestamp >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof CtfLocationInfo)) {
- return false;
- }
- CtfLocationInfo other = (CtfLocationInfo) obj;
- if (fIndex != other.fIndex) {
- return false;
- }
- if (fTimestamp != other.fTimestamp) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Element [" + fTimestamp + '/' + fIndex + ']'; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // Comparable
- // ------------------------------------------------------------------------
-
- @Override
- public int compareTo(CtfLocationInfo other) {
- if (fTimestamp > other.getTimestamp()) {
- return 1;
- }
- if (fTimestamp < other.getTimestamp()) {
- return -1;
- }
- if (fIndex > other.getIndex()) {
- return 1;
- }
- if (fIndex < other.getIndex()) {
- return -1;
- }
- return 0;
- }
-
- /**
- * Write the location to the ByteBuffer so that it can be saved to disk.
- *
- * @param bufferOut
- * the buffer to write to
- */
- public void serialize(ByteBuffer bufferOut) {
- bufferOut.putLong(fTimestamp);
- bufferOut.putLong(fIndex);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Simon Delisle - Remove the iterator in dispose()
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.context;
-
-import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Lightweight Context for CtfTmf traces. Should only use 3 references, 1 ref to
- * a boxed Long, a long and an int.
- *
- * @author Matthew Khouzam
- */
-public class CtfTmfContext implements ITmfContext {
-
- // -------------------------------------------
- // Fields
- // -------------------------------------------
-
- private CtfLocation fCurLocation;
- private long fCurRank;
-
- private final CtfTmfTrace fTrace;
-
- // -------------------------------------------
- // Constructor
- // -------------------------------------------
-
- /**
- * Constructor
- *
- * @param ctfTmfTrace
- * the parent trace
- */
- public CtfTmfContext(CtfTmfTrace ctfTmfTrace) {
- fTrace = ctfTmfTrace;
- fCurLocation = new CtfLocation(new CtfLocationInfo(0, 0));
- }
-
- // -------------------------------------------
- // TmfContext Overrides
- // -------------------------------------------
-
- @Override
- public long getRank() {
- return fCurRank;
- }
-
- @Override
- public synchronized ITmfLocation getLocation() {
- return fCurLocation;
- }
-
- @Override
- public boolean hasValidRank() {
- return fCurRank != CtfLocation.INVALID_LOCATION.getTimestamp();
- }
-
- @Override
- public synchronized void setLocation(ITmfLocation location) {
- if (location instanceof CtfLocation) {
- CtfIterator iterator = getIterator();
- iterator.seek(((CtfLocation) location).getLocationInfo());
- fCurLocation = iterator.getLocation();
- } else {
- fCurLocation = null;
- }
- }
-
- @Override
- public void setRank(long rank) {
- fCurRank = rank;
-
- }
-
- @Override
- public void increaseRank() {
- if (hasValidRank()) {
- fCurRank++;
- }
- }
-
- // -------------------------------------------
- // CtfTmfTrace Helpers
- // -------------------------------------------
-
- /**
- * Gets the trace of this context.
- *
- * @return The trace of this context
- */
- public CtfTmfTrace getTrace() {
- return fTrace;
- }
-
- /**
- * Gets the current event. Wrapper to help CtfTmfTrace
- *
- * @return The event or null
- */
- public synchronized CtfTmfEvent getCurrentEvent() {
- return getIterator().getCurrentEvent();
- }
-
- /**
- * Advances to a the next event. Wrapper to help CtfTmfTrace
- *
- * @return success or not
- */
- public synchronized boolean advance() {
- final CtfLocationInfo curLocationData = fCurLocation.getLocationInfo();
- CtfIterator iterator = getIterator();
- boolean retVal = iterator.advance();
- CtfTmfEvent currentEvent = iterator.getCurrentEvent();
-
- if (currentEvent != null) {
- final long timestampValue = iterator.getCurrentTimestamp();
- if (curLocationData.getTimestamp() == timestampValue) {
- fCurLocation = new CtfLocation(timestampValue, curLocationData.getIndex() + 1);
- } else {
- fCurLocation = new CtfLocation(timestampValue, 0L);
- }
- } else {
- fCurLocation = new CtfLocation(CtfLocation.INVALID_LOCATION);
- }
-
- return retVal;
- }
-
- @Override
- public void dispose() {
- fTrace.disposeContext(this);
- }
-
- /**
- * Seeks to a given timestamp. Wrapper to help CtfTmfTrace
- *
- * @param timestamp
- * desired timestamp
- * @return success or not
- */
- public synchronized boolean seek(final long timestamp) {
- CtfIterator iterator = getIterator();
- boolean ret = iterator.seek(timestamp);
- fCurLocation = iterator.getLocation();
- return ret;
- }
-
- /**
- * Seeks to a given location. Wrapper to help CtfTmfTrace
- * @param location
- * unique location to find the event.
- *
- * @return success or not
- */
- public synchronized boolean seek(final CtfLocationInfo location) {
- fCurLocation = new CtfLocation(location);
- return getIterator().seek(location);
- }
-
- // -------------------------------------------
- // Private helpers
- // -------------------------------------------
-
- /**
- * Get iterator, called every time to get an iterator, no local copy is
- * stored so that there is no need to "update"
- *
- * @return an iterator
- */
- private CtfIterator getIterator() {
- return (CtfIterator) fTrace.createIteratorFromContext(this);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- * Bernd Hufmann - Updated for source and model lookup interfaces
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.tmf.core.event.ITmfCustomAttributes;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
-import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfModelLookup;
-import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
-import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * A wrapper class around CTF's Event Definition/Declaration that maps all types
- * of Declaration to native Java types.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfTmfEvent extends TmfEvent
- implements ITmfSourceLookup, ITmfModelLookup, ITmfCustomAttributes {
-
- // ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- private final int fSourceCPU;
- private final long fTypeId;
- private final String fEventName;
- private final IEventDeclaration fEventDeclaration;
- private final @NonNull EventDefinition fEvent;
- private final String fReference;
-
- /** Lazy-loaded field containing the event's payload */
- private ITmfEventField fContent;
-
- private CtfTmfEventType fCtfTmfEventType;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Constructor used by {@link CtfTmfEventFactory#createEvent}
- */
- CtfTmfEvent(CtfTmfTrace trace, long rank, TmfNanoTimestamp timestamp,
- String fileName, int cpu, IEventDeclaration declaration, @NonNull EventDefinition eventDefinition) {
- super(trace,
- rank,
- timestamp,
- /*
- * Event type. We don't use TmfEvent's field here, we
- * re-implement getType().
- */
- null,
- /*
- * Content handled with a lazy-loaded field re-implemented in
- * getContent().
- */
- null);
-
- fEventDeclaration = declaration;
- fSourceCPU = cpu;
- fTypeId = declaration.getId().longValue();
- fEventName = declaration.getName();
- fEvent = eventDefinition;
- fReference = fileName;
- }
-
- /**
- * Inner constructor to create "null" events. Don't use this directly in
- * normal usage, use {@link CtfTmfEventFactory#getNullEvent(CtfTmfTrace)} to
- * get an instance of an empty event.
- *
- * There is no need to give higher visibility to this method than package
- * visible.
- *
- * @param trace
- * The trace associated with this event
- */
- CtfTmfEvent(CtfTmfTrace trace) {
- super(trace,
- ITmfContext.UNKNOWN_RANK,
- new TmfNanoTimestamp(-1),
- null,
- new TmfEventField("", null, new CtfTmfEventField[0])); //$NON-NLS-1$
- fSourceCPU = -1;
- fTypeId = -1;
- fEventName = EMPTY_CTF_EVENT_NAME;
- fEventDeclaration = null;
- fEvent = EventDefinition.NULL_EVENT;
- fReference = null;
- }
-
- /**
- * Default constructor. Do not use directly, but it needs to be present
- * because it's used in extension points, and the framework will use this
- * constructor to get the class type.
- */
- public CtfTmfEvent() {
- this(null);
- }
-
- // ------------------------------------------------------------------------
- // Getters/Setters/Predicates
- // ------------------------------------------------------------------------
-
- /**
- * Gets the cpu core the event was recorded on.
- *
- * @return The cpu id for a given source. In lttng it's from CPUINFO
- */
- public int getCPU() {
- return fSourceCPU;
- }
-
- /**
- * Return this event's ID, according to the trace's metadata.
- *
- * Watch out, this ID is not constant from one trace to another for the same
- * event types! Use "getEventName()" for a constant reference.
- *
- * @return The event ID
- */
- public long getID() {
- return fTypeId;
- }
-
- /**
- * Return this event's reference
- *
- * @return The event's reference
- */
- public String getReference() {
- return fReference;
- }
-
- @Override
- public CtfTmfTrace getTrace() {
- /*
- * Should be of the right type, since we take a CtfTmfTrace at the
- * constructor
- */
- return (CtfTmfTrace) super.getTrace();
- }
-
- @Override
- public ITmfEventType getType() {
- if (fCtfTmfEventType == null) {
- fCtfTmfEventType = new CtfTmfEventType(fEventName, getContent());
-
- /*
- * Register the event type in the owning trace, but only if there is
- * one
- */
- getTrace().registerEventType(fCtfTmfEventType);
- }
- return fCtfTmfEventType;
- }
-
- @Override
- public String getName() {
- return fEventName;
- }
-
- @Override
- public Set<String> listCustomAttributes() {
- if (fEventDeclaration == null) {
- return new HashSet<>();
- }
- return fEventDeclaration.getCustomAttributes();
- }
-
- @Override
- public String getCustomAttribute(String name) {
- if (fEventDeclaration == null) {
- return null;
- }
- return fEventDeclaration.getCustomAttribute(name);
- }
-
- /**
- * Get the call site for this event.
- *
- * @return the call site information, or null if there is none
- */
- @Override
- public CtfTmfCallsite getCallsite() {
- CtfTmfCallsite callsite = null;
- CtfTmfTrace trace = getTrace();
-
- if (getContent() != null) {
- ITmfEventField ipField = getContent().getField(CtfConstants.CONTEXT_FIELD_PREFIX + CtfConstants.IP_KEY);
- if (ipField != null && ipField.getValue() instanceof Long) {
- long ip = (Long) ipField.getValue();
- callsite = trace.getCallsite(fEventName, ip);
- }
- }
- if (callsite == null) {
- callsite = trace.getCallsite(fEventName);
- }
- return callsite;
- }
-
- @Override
- public String getModelUri() {
- return getCustomAttribute(CtfConstants.MODEL_URI_KEY);
- }
-
- @Override
- public synchronized ITmfEventField getContent() {
- if (fContent == null) {
- fContent = new TmfEventField(
- ITmfEventField.ROOT_FIELD_ID, null, parseFields(fEvent));
- }
- return fContent;
- }
-
- /**
- * Extract the field information from the structDefinition haze-inducing
- * mess, and put them into something ITmfEventField can cope with.
- */
- private static CtfTmfEventField[] parseFields(@NonNull EventDefinition eventDef) {
- List<CtfTmfEventField> fields = new ArrayList<>();
-
- ICompositeDefinition structFields = eventDef.getFields();
- if (structFields != null) {
- if (structFields.getFieldNames() != null) {
- for (String curFieldName : structFields.getFieldNames()) {
- fields.add(CtfTmfEventField.parseField((IDefinition) structFields.getDefinition(curFieldName), curFieldName));
- }
- }
- }
- /* Add context information as CtfTmfEventField */
- ICompositeDefinition structContext = eventDef.getContext();
- if (structContext != null) {
- for (String contextName : structContext.getFieldNames()) {
- /* Prefix field name */
- String curContextName = CtfConstants.CONTEXT_FIELD_PREFIX + contextName;
- fields.add(CtfTmfEventField.parseField((IDefinition) structContext.getDefinition(contextName), curContextName));
- }
- }
-
- return fields.toArray(new CtfTmfEventField[fields.size()]);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.CTFStrings;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * Factory for CtfTmfEvent's.
- *
- * This code was moved out of CtfTmfEvent to provide better separation between
- * the parsing/instantiation of events, and the usual TMF API implementations.
- *
- * @author Alexandre Montplaisir
- */
-public final class CtfTmfEventFactory {
-
- private static final String NO_STREAM = "No stream"; //$NON-NLS-1$
-
- /**
- * Don't let anyone instantiate this class.
- */
- private CtfTmfEventFactory() {}
-
- /**
- * Factory method to instantiate new {@link CtfTmfEvent}'s.
- *
- * @param eventDef
- * CTF EventDefinition object corresponding to this trace event
- * @param fileName
- * The path to the trace file
- * @param originTrace
- * The trace from which this event originates
- * @return The newly-built CtfTmfEvent
- */
- public static CtfTmfEvent createEvent(EventDefinition eventDef,
- String fileName, CtfTmfTrace originTrace) {
-
- /* Prepare what to pass to CtfTmfEvent's constructor */
- final IEventDeclaration eventDecl = eventDef.getDeclaration();
- final long ts = eventDef.getTimestamp();
- final TmfNanoTimestamp timestamp = originTrace.createTimestamp(
- originTrace.timestampCyclesToNanos(ts));
-
- int sourceCPU = eventDef.getCPU();
-
- String reference = fileName == null ? NO_STREAM : fileName;
-
- /* Handle the special case of lost events */
- if (eventDecl.getName().equals(CTFStrings.LOST_EVENT_NAME)) {
- IDefinition nbLostEventsDef = eventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD);
- IDefinition durationDef = eventDef.getFields().getDefinition(CTFStrings.LOST_EVENTS_DURATION);
- if (!(nbLostEventsDef instanceof IntegerDefinition) || !(durationDef instanceof IntegerDefinition)) {
- /*
- * One or both of these fields doesn't exist, or is not of the
- * right type. The event claims to be a "lost event", but is
- * malformed. Log it and return a null event instead.
- */
- return getNullEvent(originTrace);
- }
- long nbLostEvents = ((IntegerDefinition) nbLostEventsDef).getValue();
- long duration = ((IntegerDefinition) durationDef).getValue();
- TmfNanoTimestamp timestampEnd = new TmfNanoTimestamp(
- originTrace.timestampCyclesToNanos(ts) + duration);
-
- CtfTmfLostEvent lostEvent = new CtfTmfLostEvent(originTrace,
- ITmfContext.UNKNOWN_RANK,
- reference, // filename
- sourceCPU,
- eventDecl,
- new TmfTimeRange(timestamp, timestampEnd),
- nbLostEvents,
- eventDef);
- return lostEvent;
- }
-
- /* Handle standard event types */
- CtfTmfEvent event = new CtfTmfEvent(
- originTrace,
- ITmfContext.UNKNOWN_RANK,
- timestamp,
- reference, // filename
- sourceCPU,
- eventDecl,
- eventDef);
- return event;
- }
-
- /* Singleton instance of a null event */
- private static CtfTmfEvent nullEvent = null;
-
- /**
- * Get an instance of a null event.
- *
- * @param trace
- * A trace to associate with this null event
- * @return An empty event
- */
- public static CtfTmfEvent getNullEvent(@NonNull CtfTmfTrace trace) {
- if (nullEvent == null) {
- nullEvent = new CtfTmfEvent(trace);
- }
- return nullEvent;
- }
-
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Ericsson, École Polytechnique de Montréal
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Alexandre Montplaisir - Initial API and implementation, extend TmfEventField
- * Bernd Hufmann - Add Enum field handling
- * Geneviève Bastien - Add Struct and Variant field handling
- * Jean-Christian Kouame - Correct handling of unsigned integer fields
- * François Doray - Add generic array field type
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.Definition;
-import org.eclipse.tracecompass.ctf.core.event.types.EnumDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.ICompositeDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration;
-import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.StringDefinition;
-import org.eclipse.tracecompass.ctf.core.event.types.VariantDefinition;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.ctf.core.CtfEnumPair;
-
-/**
- * The CTF implementation of the TMF event field model
- *
- * @version 2.0
- * @author Matthew Khouzam
- * @author Alexandre Montplaisir
- */
-public abstract class CtfTmfEventField extends TmfEventField {
-
- // ------------------------------------------------------------------------
- // Constructor
- // ------------------------------------------------------------------------
-
- /**
- * Standard constructor. Only to be used internally, call parseField() to
- * generate a new field object.
- *
- * @param name
- * The name of this field
- * @param value
- * The value of this field. Its type should match the field type.
- * @param fields
- * The children fields. Useful for composite fields
- */
- protected CtfTmfEventField(String name, Object value, ITmfEventField[] fields) {
- super(/* Strip the underscore from the field name if there is one */
- name.startsWith("_") ? name.substring(1) : name, //$NON-NLS-1$
- value,
- fields);
- }
-
- // ------------------------------------------------------------------------
- // Operations
- // ------------------------------------------------------------------------
-
- /**
- * Factory method to instantiate CtfTmfEventField objects.
- *
- * @param fieldDef
- * The CTF Definition of this event field
- * @param fieldName
- * String The name to assign to this field
- * @return The resulting CtfTmfEventField object
- * @deprecated use {@link CtfTmfEventField#parseField(IDefinition, String)}
- */
- @Deprecated
- public static CtfTmfEventField parseField(Definition fieldDef,
- String fieldName) {
- return parseField((IDefinition) fieldDef, fieldName);
- }
-
- /**
- * Factory method to instantiate CtfTmfEventField objects.
- *
- * @param fieldDef
- * The CTF Definition of this event field
- * @param fieldName
- * String The name to assign to this field
- * @return The resulting CtfTmfEventField object
- */
- public static CtfTmfEventField parseField(IDefinition fieldDef,
- String fieldName) {
- CtfTmfEventField field = null;
-
- /* Determine the Definition type */
- if (fieldDef instanceof IntegerDefinition) {
- IntegerDefinition intDef = (IntegerDefinition) fieldDef;
- int base = intDef.getDeclaration().getBase();
- field = new CTFIntegerField(fieldName, intDef.getValue(), base, intDef.getDeclaration().isSigned());
-
- } else if (fieldDef instanceof EnumDefinition) {
- EnumDefinition enumDef = (EnumDefinition) fieldDef;
- field = new CTFEnumField(fieldName, new CtfEnumPair(enumDef.getValue(), enumDef.getIntegerValue()));
-
- } else if (fieldDef instanceof StringDefinition) {
- field = new CTFStringField(fieldName, ((StringDefinition) fieldDef).getValue());
-
- } else if (fieldDef instanceof FloatDefinition) {
- FloatDefinition floatDef = (FloatDefinition) fieldDef;
- field = new CTFFloatField(fieldName, floatDef.getValue());
-
- } else if (fieldDef instanceof AbstractArrayDefinition) {
- AbstractArrayDefinition arrayDef = (AbstractArrayDefinition) fieldDef;
- IDeclaration decl = arrayDef.getDeclaration();
- if (!(decl instanceof CompoundDeclaration)) {
- throw new IllegalArgumentException("Array definitions should only come from sequence or array declarations"); //$NON-NLS-1$
- }
- CompoundDeclaration arrDecl = (CompoundDeclaration) decl;
- IDeclaration elemType = null;
- Collection<Definition> definitions = arrayDef.getDefinitions();
- elemType = arrDecl.getElementType();
- if (elemType instanceof IntegerDeclaration) {
- /*
- * Array of integers => CTFIntegerArrayField, unless it's a
- * CTFStringField
- */
- IntegerDeclaration elemIntType = (IntegerDeclaration) elemType;
- /* Are the integers characters and encoded? */
- if (elemIntType.isCharacter()) {
- /* it's a CTFStringField */
- field = new CTFStringField(fieldName, arrayDef.toString());
- } else {
- /* it's a CTFIntegerArrayField */
- int size = arrayDef.getDefinitions().size();
- long[] values = new long[size];
- for (int i = 0; i < size; i++) {
- IDefinition elem = arrayDef.getDefinitions().get(i);
- if (elem == null) {
- break;
- }
- values[i] = ((IntegerDefinition) elem).getValue();
- }
- field = new CTFIntegerArrayField(fieldName, values,
- elemIntType.getBase(),
- elemIntType.isSigned());
- }
- } else {
- /* Arrays of elements of any other type */
- CtfTmfEventField[] elements = new CtfTmfEventField[arrayDef.getLength()];
- /* Parse the elements of the array. */
- int i = 0;
- for (IDefinition definition : definitions) {
- CtfTmfEventField curField = CtfTmfEventField.parseField(
- definition, fieldName + '[' + i + ']');
- elements[i] = curField;
- i++;
- }
-
- field = new CTFArrayField(fieldName, elements);
- }
- } else if (fieldDef instanceof ICompositeDefinition) {
- ICompositeDefinition strDef = (ICompositeDefinition) fieldDef;
-
- List<ITmfEventField> list = new ArrayList<>();
- /* Recursively parse the fields */
- for (String curFieldName : strDef.getFieldNames()) {
- list.add(CtfTmfEventField.parseField(strDef.getDefinition(curFieldName), curFieldName));
- }
- field = new CTFStructField(fieldName, list.toArray(new CtfTmfEventField[list.size()]));
-
- } else if (fieldDef instanceof VariantDefinition) {
- VariantDefinition varDef = (VariantDefinition) fieldDef;
-
- String curFieldName = varDef.getCurrentFieldName();
- IDefinition curFieldDef = varDef.getCurrentField();
- if (curFieldDef != null) {
- CtfTmfEventField subField = CtfTmfEventField.parseField(curFieldDef, curFieldName);
- field = new CTFVariantField(fieldName, subField);
- } else {
- /* A safe-guard, but curFieldDef should never be null */
- field = new CTFStringField(curFieldName, ""); //$NON-NLS-1$
- }
-
- } else {
- /*
- * Safe-guard, to avoid null exceptions later, field is expected not
- * to be null
- */
- field = new CTFStringField(fieldName, Messages.CtfTmfEventField_UnsupportedType + fieldDef.getClass().toString());
- }
- return field;
- }
-
- @Override
- public String toString() {
- return getName() + '=' + getFormattedValue();
- }
-
-}
-
-/**
- * The CTF field implementation for integer fields.
- *
- * @author alexmont
- */
-final class CTFIntegerField extends CtfTmfEventField {
-
- private final int fBase;
- private final boolean fSigned;
-
- /**
- * A CTF "IntegerDefinition" can be an integer of any byte size, so in the
- * Java parser this is interpreted as a long.
- *
- * @param name
- * The name of this field
- * @param longValue
- * The integer value of this field
- * @param signed
- * Is the value signed or not
- */
- CTFIntegerField(String name, long longValue, int base, boolean signed) {
- super(name, longValue, null);
- fSigned = signed;
- fBase = base;
- }
-
- @Override
- public Long getValue() {
- return (Long) super.getValue();
- }
-
- @Override
- public String getFormattedValue() {
- return IntegerDefinition.formatNumber(getValue(), fBase, fSigned);
- }
-
-}
-
-/**
- * The CTF field implementation for string fields
- *
- * @author alexmont
- */
-final class CTFStringField extends CtfTmfEventField {
-
- /**
- * Constructor for CTFStringField.
- *
- * @param strValue
- * The string value of this field
- * @param name
- * The name of this field
- */
- CTFStringField(String name, String strValue) {
- super(name, strValue, null);
- }
-
- @Override
- public String getValue() {
- return (String) super.getValue();
- }
-}
-
-/**
- * CTF field implementation for arrays of integers.
- *
- * @author alexmont
- */
-final class CTFIntegerArrayField extends CtfTmfEventField {
-
- private final int fBase;
- private final boolean fSigned;
- private String fFormattedValue = null;
-
- /**
- * Constructor for CTFIntegerArrayField.
- *
- * @param name
- * The name of this field
- * @param longValues
- * The array of integers (as longs) that compose this field's
- * value
- * @param signed
- * Are the values in the array signed or not
- */
- CTFIntegerArrayField(String name, long[] longValues, int base, boolean signed) {
- super(name, longValues, null);
- fBase = base;
- fSigned = signed;
- }
-
- @Override
- public long[] getValue() {
- return (long[]) super.getValue();
- }
-
- @Override
- public synchronized String getFormattedValue() {
- if (fFormattedValue == null) {
- List<String> strings = new ArrayList<>();
- for (long value : getValue()) {
- strings.add(IntegerDefinition.formatNumber(value, fBase, fSigned));
- }
- fFormattedValue = strings.toString();
- }
- return fFormattedValue;
- }
-
-}
-
-/**
- * CTF field implementation for arrays of arbitrary types.
- *
- * @author fdoray
- */
-final class CTFArrayField extends CtfTmfEventField {
-
- private String fFormattedValue = null;
-
- /**
- * Constructor for CTFArrayField.
- *
- * @param name
- * The name of this field
- * @param elements
- * The array elements of this field
- */
- CTFArrayField(String name, CtfTmfEventField[] elements) {
- super(name, elements, elements);
- }
-
- @Override
- public CtfTmfEventField[] getValue() {
- return (CtfTmfEventField[]) super.getValue();
- }
-
- @Override
- public synchronized String getFormattedValue() {
- if (fFormattedValue == null) {
- List<String> strings = new ArrayList<>();
- for (CtfTmfEventField element : getValue()) {
- strings.add(element.getFormattedValue());
- }
- fFormattedValue = strings.toString();
- }
- return fFormattedValue;
- }
-}
-
-/**
- * CTF field implementation for floats.
- *
- * @author emathko
- */
-final class CTFFloatField extends CtfTmfEventField {
-
- /**
- * Constructor for CTFFloatField.
- *
- * @param value
- * The float value (actually a double) of this field
- * @param name
- * The name of this field
- */
- protected CTFFloatField(String name, double value) {
- super(name, value, null);
- }
-
- @Override
- public Double getValue() {
- return (Double) super.getValue();
- }
-}
-
-/**
- * The CTF field implementation for Enum fields
- *
- * @author Bernd Hufmann
- */
-final class CTFEnumField extends CtfTmfEventField {
-
- /**
- * Constructor for CTFEnumField.
- *
- * @param enumValue
- * The Enum value consisting of a pair of Enum value name and its
- * long value
- * @param name
- * The name of this field
- */
- CTFEnumField(String name, CtfEnumPair enumValue) {
- super(name, new CtfEnumPair(enumValue.getFirst(),
- enumValue.getSecond()), null);
- }
-
- @Override
- public CtfEnumPair getValue() {
- return (CtfEnumPair) super.getValue();
- }
-}
-
-/**
- * The CTF field implementation for struct fields with sub-fields
- *
- * @author gbastien
- */
-final class CTFStructField extends CtfTmfEventField {
-
- /**
- * Constructor for CTFStructField.
- *
- * @param fields
- * The children of this field
- * @param name
- * The name of this field
- */
- CTFStructField(String name, CtfTmfEventField[] fields) {
- super(name, fields, fields);
- }
-
- @Override
- public CtfTmfEventField[] getValue() {
- return (CtfTmfEventField[]) super.getValue();
- }
-
- @Override
- public String getFormattedValue() {
- return Arrays.toString(getValue());
- }
-
-}
-
-/**
- * The CTF field implementation for variant fields its child
- *
- * @author gbastien
- */
-final class CTFVariantField extends CtfTmfEventField {
-
- /**
- * Constructor for CTFVariantField.
- *
- * @param field
- * The field selected for this variant
- * @param name
- * The name of this field
- */
- CTFVariantField(String name, CtfTmfEventField field) {
- super(name, field, new CtfTmfEventField[] { field });
- }
-
- @Override
- public CtfTmfEventField getValue() {
- return (CtfTmfEventField) super.getValue();
- }
-
-}
-
-/* Implement other possible fields types here... */
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
- *
- * 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: Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.TmfEventType;
-
-/**
- * The CTF extension of the TMF event type
- *
- * @author Matthew khouzam
- */
-public class CtfTmfEventType extends TmfEventType {
-
- /**
- * Constructor for CtfTmfEventType.
- *
- * @param eventName
- * The event name
- * @param content
- * The event field
- */
- public CtfTmfEventType(String eventName, ITmfEventField content) {
- super(eventName, content);
- }
-
- /**
- * Method toString.
- *
- * @return String
- */
- @Override
- public String toString() {
- return getName();
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.core.event.EventDefinition;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.tmf.core.event.ITmfLostEvent;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-
-/**
- * An implementation of {@link ITmfLostEvent} for use in the CTF adaptor.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfTmfLostEvent extends CtfTmfEvent implements ITmfLostEvent {
-
- private final TmfTimeRange fTimeRange;
- private final long fNbLost;
-
- /**
- * Constructor. Only {@link CtfTmfEventFactory} should call this.
- *
- * @param trace
- * The origin trace
- * @param rank
- * The rank of the event in the trace
- * @param content
- * The event's payload (fields). In case this event has some.
- * @param fileName
- * The name of the trace file from which this event comes
- * @param cpu
- * The CPU on which this event happened
- * @param declaration
- * The CTF Event Declaration object that created this event
- * @param timeRange
- * The time range of lost events indicated by this one
- * @param nbLost
- * The number of lost events in the range
- */
- CtfTmfLostEvent(CtfTmfTrace trace,
- long rank,
- String fileName,
- int cpu,
- IEventDeclaration declaration,
- TmfTimeRange timeRange,
- long nbLost,
- @NonNull EventDefinition def) {
- /*
- * Only the factory should call this method, the case to
- * (CtfTmfTimestamp) should be safe.
- */
- super(trace, rank, (TmfNanoTimestamp) timeRange.getStartTime(), fileName, cpu, declaration, def);
- fTimeRange = timeRange;
- fNbLost = nbLost;
- }
-
- @Override
- public TmfTimeRange getTimeRange() {
- return fTimeRange;
- }
-
- @Override
- public long getNbLostEvents() {
- return fNbLost;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson.
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Message bundle for tmf.ctf.core.event
- *
- * @author Matthew Khouzam
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.tmf.ctf.core.event.messages"; //$NON-NLS-1$
-
- /** Unsupported field type */
- public static String CtfTmfEventField_UnsupportedType;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-
-/**
- * Channel aspect for CTF traces
- *
- * @author Alexandre Montplaisir
- */
-public class CtfChannelAspect implements ITmfEventAspect {
-
- @Override
- public String getName() {
- return Messages.getMessage(Messages.AspectName_Channel);
- }
-
- @Override
- public String getHelpText() {
- return Messages.getMessage(Messages.AspectHelpText_Channel);
- }
-
- @Override
- public String resolve(ITmfEvent event) {
- if (!(event instanceof CtfTmfEvent)) {
- return EMPTY_STRING;
- }
- String ret = ((CtfTmfEvent) event).getReference();
- return (ret == null ? EMPTY_STRING : ret);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
- *
- * 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:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-
-/**
- * "CPU" event aspect for CTF traces.
- *
- * @author Alexandre Montplaisir
- */
-public class CtfCpuAspect extends TmfCpuAspect {
-
- @Override
- public Integer resolve(ITmfEvent event) {
- if (!(event instanceof CtfTmfEvent)) {
- return null;
- }
- int cpu = ((CtfTmfEvent) event).getCPU();
- return cpu;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- * 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:
- * Patrick Tassé - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event.aspect;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.osgi.util.NLS;
-
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME =
- "org.eclipse.tracecompass.tmf.ctf.core.event.aspect.messages"; //$NON-NLS-1$
-
- public static String AspectName_Channel;
- public static String AspectHelpText_Channel;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-
- /**
- * Helper method to expose externalized strings as non-null objects.
- */
- static @NonNull String getMessage(@Nullable String msg) {
- if (msg == null) {
- return ""; //$NON-NLS-1$
- }
- return msg;
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-AspectName_Channel=Channel
-AspectHelpText_Channel=A channel is a set of events with specific parameters and potentially added context information.
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Patrick Tasse - Initial API and implementation
- * Bernd Hufmann - Updated for new parent class
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.event.lookup;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite;
-
-/**
- * CTF TMF call site information for source code lookup.
- *
- * @author Patrick Tasse
- */
-public class CtfTmfCallsite extends TmfCallsite {
-
- // ------------------------------------------------------------------------
- // Attributes
- // ------------------------------------------------------------------------
-
- /** The event name. */
- private final String fEventName;
-
- /** The instruction pointer. */
- private final long fInstructionPointer;
-
- // ------------------------------------------------------------------------
- // Constructors
- // ------------------------------------------------------------------------
-
- /**
- * Standard Constructor.
- *
- * @param callsite
- * - a CTF call site
- */
- public CtfTmfCallsite(CTFCallsite callsite) {
- super(callsite.getFileName(), callsite.getFunctionName(), callsite.getLineNumber());
- fEventName = callsite.getEventName();
- fInstructionPointer = callsite.getIp();
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Returns the event name of the call site.
- *
- * @return the event name
- */
- public String getEventName() {
- return fEventName;
- }
-
- /**
- * Returns the instruction pointer of the call site.
- *
- * @return the instruction pointer
- */
- public long getIntructionPointer() {
- return fInstructionPointer;
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
- result = prime * result + (int) (fInstructionPointer ^ (fInstructionPointer >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- CtfTmfCallsite other = (CtfTmfCallsite) obj;
- if (!equalsNullable(fEventName, other.fEventName)) {
- return false;
- }
- if (fInstructionPointer != other.fInstructionPointer) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return getEventName() + "@0x" + Long.toHexString(fInstructionPointer) + ": " + //$NON-NLS-1$ //$NON-NLS-2$
- getFileName() + ':' + Long.toString(getLineNumber()) + ' ' + getFileName() + "()"; //$NON-NLS-1$
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-CtfTmfEventField_UnsupportedType=Unsupported field type:
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson, École Polytechnique de Montréal
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Patrick Tasse - Updated for removal of context clone
- * Geneviève Bastien - Added the createTimestamp function
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.trace;
-
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.nio.BufferOverflowException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.core.CTFException;
-import org.eclipse.tracecompass.ctf.core.event.CTFCallsite;
-import org.eclipse.tracecompass.ctf.core.event.CTFClock;
-import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
-import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader;
-import org.eclipse.tracecompass.ctf.core.trace.Metadata;
-import org.eclipse.tracecompass.internal.tmf.ctf.core.Activator;
-import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIterator;
-import org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator.CtfIteratorManager;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp;
-import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceProperties;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTraceWithPreDefinedEvents;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfPersistentlyIndexable;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.ITmfTraceIndexer;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.TmfBTreeTraceIndexer;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.ITmfCheckpoint;
-import org.eclipse.tracecompass.tmf.core.trace.indexer.checkpoint.TmfCheckpoint;
-import org.eclipse.tracecompass.tmf.core.trace.location.ITmfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.CtfConstants;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocation;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfLocationInfo;
-import org.eclipse.tracecompass.tmf.ctf.core.context.CtfTmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEventType;
-import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfChannelAspect;
-import org.eclipse.tracecompass.tmf.ctf.core.event.aspect.CtfCpuAspect;
-import org.eclipse.tracecompass.tmf.ctf.core.event.lookup.CtfTmfCallsite;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * The CTf trace handler
- *
- * @version 1.0
- * @author Matthew khouzam
- */
-public class CtfTmfTrace extends TmfTrace
- implements ITmfTraceProperties, ITmfPersistentlyIndexable,
- ITmfTraceWithPreDefinedEvents, AutoCloseable {
-
- // -------------------------------------------
- // Constants
- // -------------------------------------------
-
- /**
- * Default cache size for CTF traces
- */
- protected static final int DEFAULT_CACHE_SIZE = 50000;
-
- /**
- * Event aspects available for all CTF traces
- * @since 1.0
- */
- protected static final @NonNull Collection<ITmfEventAspect> CTF_ASPECTS =
- checkNotNull(ImmutableList.of(
- ITmfEventAspect.BaseAspects.TIMESTAMP,
- new CtfChannelAspect(),
- new CtfCpuAspect(),
- ITmfEventAspect.BaseAspects.EVENT_TYPE,
- ITmfEventAspect.BaseAspects.CONTENTS
- ));
-
- /**
- * The Ctf clock unique identifier field
- */
- private static final String CLOCK_HOST_PROPERTY = "uuid"; //$NON-NLS-1$
- private static final int CONFIDENCE = 10;
- private static final int MIN_CONFIDENCE = 1;
-
- // -------------------------------------------
- // Fields
- // -------------------------------------------
-
- private final Map<String, CtfTmfEventType> fContainedEventTypes =
- Collections.synchronizedMap(new HashMap<String, CtfTmfEventType>());
-
- private final CtfIteratorManager fIteratorManager =
- new CtfIteratorManager(this);
-
- /* Reference to the CTF Trace */
- private CTFTrace fTrace;
-
- // -------------------------------------------
- // TmfTrace Overrides
- // -------------------------------------------
- /**
- * Method initTrace.
- *
- * @param resource
- * The resource associated with this trace
- * @param path
- * The path to the trace file
- * @param eventType
- * The type of events that will be read from this trace
- * @throws TmfTraceException
- * If something went wrong while reading the trace
- */
- @Override
- public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType)
- throws TmfTraceException {
- /*
- * Set the cache size. This has to be done before the call to super()
- * because the super needs to know the cache size.
- */
- setCacheSize();
-
- super.initTrace(resource, path, eventType);
-
- try {
- this.fTrace = new CTFTrace(path);
- CtfTmfContext ctx;
- /* Set the start and (current) end times for this trace */
- ctx = (CtfTmfContext) seekEvent(0L);
- CtfTmfEvent event = getNext(ctx);
- if ((ctx.getLocation().equals(CtfIterator.NULL_LOCATION)) || (ctx.getCurrentEvent() == null)) {
- /* Handle the case where the trace is empty */
- this.setStartTime(TmfTimestamp.BIG_BANG);
- } else {
- final ITmfTimestamp curTime = event.getTimestamp();
- this.setStartTime(curTime);
- this.setEndTime(curTime);
- }
- /*
- * Register every event type. When you call getType, it will
- * register a trace to that type in the TmfEventTypeManager
- */
- try (CtfIterator iter = fIteratorManager.getIterator(ctx)) {
- for (IEventDeclaration ied : iter.getEventDeclarations()) {
- CtfTmfEventType ctfTmfEventType = fContainedEventTypes.get(ied.getName());
- if (ctfTmfEventType == null) {
- List<ITmfEventField> content = new ArrayList<>();
- /* Should only return null the first time */
- for (String fieldName : ied.getFields().getFieldsList()) {
- content.add(new TmfEventField(fieldName, null, null));
- }
- ITmfEventField contentTree = new TmfEventField(
- ITmfEventField.ROOT_FIELD_ID,
- null,
- content.toArray(new ITmfEventField[content.size()])
- );
-
- ctfTmfEventType = new CtfTmfEventType(ied.getName(), contentTree);
- fContainedEventTypes.put(ctfTmfEventType.getName(), ctfTmfEventType);
- }
- }
- }
- } catch (final CTFException e) {
- /*
- * If it failed at the init(), we can assume it's because the file
- * was not found or was not recognized as a CTF trace. Throw into
- * the new type of exception expected by the rest of TMF.
- */
- throw new TmfTraceException(e.getMessage(), e);
- }
- }
-
- @Override
- public void close() {
- dispose();
- }
-
- @Override
- public synchronized void dispose() {
- fIteratorManager.dispose();
- if (fTrace != null) {
- fTrace = null;
- }
- super.dispose();
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The default implementation of a CTF trace.
- *
- * Firstly a weak validation of the metadata is done to determine if the
- * path is actually for a CTF trace. After that a full validation is done.
- *
- * If the weak and full validation are successful the confidence is set
- * to 10.
- *
- * If the weak validation was successful, but the full validation fails
- * a TraceValidationStatus with severity warning and confidence of 1 is
- * returned.
- *
- * If both weak and full validation fails an error status is returned.
- */
- @Override
- public IStatus validate(final IProject project, final String path) {
- boolean isMetadataFile = false;
- try {
- isMetadataFile = Metadata.preValidate(path);
- } catch (final CTFException e) {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
- }
-
- if (isMetadataFile) {
- // Trace is pre-validated, continue will full validation
- try {
- final CTFTrace trace = new CTFTrace(path);
- if (!trace.majorIsSet()) {
- if (isMetadataFile) {
- return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet, null);
- }
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
- }
-
- // Validate using reader initialization
- try (CTFTraceReader ctfTraceReader = new CTFTraceReader(trace)) {}
-
- // Trace is validated, return with confidence
- return new CtfTraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID, trace.getEnvironment());
-
- } catch (final CTFException | BufferOverflowException e ) {
- // return warning since it's a CTF trace but with errors in it
- return new TraceValidationStatus(MIN_CONFIDENCE, IStatus.WARNING, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString(), e); //$NON-NLS-1$
- }
- }
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError);
- }
-
- @Override
- public Iterable<ITmfEventAspect> getEventAspects() {
- return CTF_ASPECTS;
- }
-
- /**
- * Method getCurrentLocation. This is not applicable in CTF
- *
- * @return null, since the trace has no knowledge of the current location
- * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getCurrentLocation()
- */
- @Override
- public ITmfLocation getCurrentLocation() {
- return null;
- }
-
- @Override
- public double getLocationRatio(ITmfLocation location) {
- final CtfLocation curLocation = (CtfLocation) location;
- final long startTime = getStartTime().getValue();
- final double diff = curLocation.getLocationInfo().getTimestamp() - startTime;
- final double total = getEndTime().getValue() - startTime;
- return Math.max(0.0, Math.min(1.0, diff / total));
- }
-
- /**
- * Method seekEvent.
- *
- * @param location
- * ITmfLocation<?>
- * @return ITmfContext
- */
- @Override
- public synchronized ITmfContext seekEvent(final ITmfLocation location) {
- CtfLocation currentLocation = (CtfLocation) location;
- CtfTmfContext context = new CtfTmfContext(this);
- if (fTrace == null) {
- context.setLocation(null);
- context.setRank(ITmfContext.UNKNOWN_RANK);
- return context;
- }
- /*
- * The rank is set to 0 if the iterator seeks the beginning. If not, it
- * will be set to UNKNOWN_RANK, since CTF traces don't support seeking
- * by rank for now.
- */
- if (currentLocation == null) {
- currentLocation = new CtfLocation(new CtfLocationInfo(0L, 0L));
- context.setRank(0);
- } else {
- context.setRank(ITmfContext.UNKNOWN_RANK);
- if (currentLocation.getLocationInfo() == CtfLocation.INVALID_LOCATION) {
- currentLocation = new CtfLocation(fTrace.getCurrentEndTime() + 1, 0L);
- }
- }
- /* This will seek and update the location after the seek */
- context.setLocation(currentLocation);
- return context;
- }
-
- @Override
- public synchronized ITmfContext seekEvent(double ratio) {
- CtfTmfContext context = new CtfTmfContext(this);
- if (fTrace == null) {
- context.setLocation(null);
- context.setRank(ITmfContext.UNKNOWN_RANK);
- return context;
- }
- final long end = getEndTime().getValue();
- final long start = getStartTime().getValue();
- final long diff = end - start;
- final long ratioTs = Math.round(diff * ratio) + start;
- context.seek(ratioTs);
- context.setRank(ITmfContext.UNKNOWN_RANK);
- return context;
- }
-
- /**
- * Method readNextEvent.
- *
- * @param context
- * ITmfContext
- * @return CtfTmfEvent
- * @see org.eclipse.tracecompass.tmf.core.trace.ITmfTrace#getNext(ITmfContext)
- */
- @Override
- public synchronized CtfTmfEvent getNext(final ITmfContext context) {
- if (fTrace == null) {
- return null;
- }
- CtfTmfEvent event = null;
- if (context instanceof CtfTmfContext) {
- if (context.getLocation() == null || CtfLocation.INVALID_LOCATION.equals(context.getLocation().getLocationInfo())) {
- return null;
- }
- CtfTmfContext ctfContext = (CtfTmfContext) context;
- event = ctfContext.getCurrentEvent();
-
- if (event != null) {
- updateAttributes(context, event.getTimestamp());
- ctfContext.advance();
- ctfContext.increaseRank();
- }
- }
-
- return event;
- }
-
- /**
- * Ctf traces have a clock with a unique uuid that will be used to identify
- * the host. Traces with the same clock uuid will be known to have been made
- * on the same machine.
- *
- * Note: uuid is an optional field, it may not be there for a clock.
- */
- @Override
- public String getHostId() {
- CTFClock clock = fTrace.getClock();
- if (clock != null) {
- String clockHost = (String) clock.getProperty(CLOCK_HOST_PROPERTY);
- if (clockHost != null) {
- return clockHost;
- }
- }
- return super.getHostId();
- }
-
- /**
- * Get the first callsite that matches the event name
- *
- * @param eventName The event name to look for
- * @return The best callsite candidate
- */
- public @Nullable CtfTmfCallsite getCallsite(String eventName) {
- CTFCallsite callsite = fTrace.getCallsite(eventName);
- if (callsite != null) {
- return new CtfTmfCallsite(callsite);
- }
- return null;
- }
-
- /**
- * Get the closest matching callsite for given event name and instruction
- * pointer
- *
- * @param eventName
- * The event name
- * @param ip
- * The instruction pointer
- * @return The closest matching callsite
- */
- public @Nullable CtfTmfCallsite getCallsite(String eventName, long ip) {
- CTFCallsite calliste = fTrace.getCallsite(eventName, ip);
- if (calliste != null) {
- return new CtfTmfCallsite(calliste);
- }
- return null;
- }
-
- /**
- * Get the CTF environment variables defined in this CTF trace, in <name,
- * value> form. This comes from the trace's CTF metadata.
- *
- * @return The CTF environment
- */
- public Map<String, String> getEnvironment() {
- return fTrace.getEnvironment();
- }
-
- // -------------------------------------------
- // ITmfTraceProperties
- // -------------------------------------------
-
- @Override
- public Map<String, String> getTraceProperties() {
- Map<String, String> properties = new HashMap<>();
- properties.putAll(fTrace.getEnvironment());
- properties.put(Messages.CtfTmfTrace_HostID, getHostId());
- return properties;
- }
-
- // -------------------------------------------
- // Clocks
- // -------------------------------------------
-
- /**
- * gets the clock offset
- *
- * @return the clock offset in ns
- */
- public long getOffset() {
- if (fTrace != null) {
- return fTrace.getOffset();
- }
- return 0;
- }
-
- /**
- * Convert a CTF timestamp in CPU cycles to its equivalent in nanoseconds
- * for this trace.
- *
- * @param cycles
- * The timestamp in cycles
- * @return The timestamp in nanoseconds
- */
- public long timestampCyclesToNanos(long cycles) {
- return fTrace.timestampCyclesToNanos(cycles);
- }
-
- /**
- * Convert a CTF timestamp in nanoseconds to its equivalent in CPU cycles
- * for this trace.
- *
- * @param nanos
- * The timestamp in nanoseconds
- * @return The timestamp in cycles
- */
- public long timestampNanoToCycles(long nanos) {
- return fTrace.timestampNanoToCycles(nanos);
- }
-
- /**
- * Gets the list of declared events
- */
- @Override
- public Set<CtfTmfEventType> getContainedEventTypes() {
- return ImmutableSet.copyOf(fContainedEventTypes.values());
- }
-
- /**
- * Register an event type to this trace.
- *
- * Public visibility so that {@link CtfTmfEvent#getType} can call it.
- *
- * FIXME This could probably be made cleaner?
- *
- * @param eventType
- * The event type to register
- */
- public void registerEventType(CtfTmfEventType eventType) {
- fContainedEventTypes.put(eventType.getName(), eventType);
- }
-
- // -------------------------------------------
- // Parser
- // -------------------------------------------
-
- @Override
- public CtfTmfEvent parseEvent(ITmfContext context) {
- CtfTmfEvent event = null;
- if (context instanceof CtfTmfContext) {
- final ITmfContext tmpContext = seekEvent(context.getLocation());
- event = getNext(tmpContext);
- }
- return event;
- }
-
- /**
- * Sets the cache size for a CtfTmfTrace.
- */
- protected void setCacheSize() {
- setCacheSize(DEFAULT_CACHE_SIZE);
- }
-
- // -------------------------------------------
- // CtfIterator factory methods
- // -------------------------------------------
-
- /**
- * Get an iterator to the trace
- *
- * @return an iterator to the trace
- */
- public ITmfContext createIterator() {
- try {
- return new CtfIterator(fTrace, this);
- } catch (CTFException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- }
- return null;
- }
-
- /**
- * Get an iterator to the trace, , which will initially point to the given
- * location/rank.
- *
- * @param ctfLocationData
- * The initial timestamp the iterator will be pointing to
- * @param rank
- * The initial rank
- * @return The new iterator
- */
- public ITmfContext createIterator(CtfLocationInfo ctfLocationData, long rank) {
- try {
- return new CtfIterator(fTrace, this, ctfLocationData, rank);
- } catch (CTFException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- }
- return null;
- }
-
- /**
- * Create the 'CtfIterator' object from a CtfTmfContext.
- *
- * @param context
- * The iterator will initially be pointing to this context
- * @return A new CtfIterator object
- * @since 1.0
- */
- public ITmfContext createIteratorFromContext(CtfTmfContext context) {
- return fIteratorManager.getIterator(context);
- }
-
- /**
- * Dispose an iterator that was create with
- * {@link #createIteratorFromContext}
- *
- * @param context
- * The last context that was pointed to by the iterator (this is
- * the 'key' to find the correct iterator to dispose).
- * @since 1.0
- */
- public void disposeContext(CtfTmfContext context) {
- fIteratorManager.removeIterator(context);
- }
-
- // ------------------------------------------------------------------------
- // Timestamp transformation functions
- // ------------------------------------------------------------------------
-
- /**
- * @since 1.0
- */
- @Override
- public @NonNull TmfNanoTimestamp createTimestamp(long ts) {
- return new TmfNanoTimestamp(getTimestampTransform().transform(ts));
- }
-
- private static int fCheckpointSize = -1;
-
- @Override
- public synchronized int getCheckpointSize() {
- if (fCheckpointSize == -1) {
- TmfCheckpoint c = new TmfCheckpoint(new TmfNanoTimestamp(0), new CtfLocation(0, 0), 0);
- ByteBuffer b = ByteBuffer.allocate(ITmfCheckpoint.MAX_SERIALIZE_SIZE);
- b.clear();
- c.serialize(b);
- fCheckpointSize = b.position();
- }
-
- return fCheckpointSize;
- }
-
- @Override
- protected ITmfTraceIndexer createIndexer(int interval) {
- return new TmfBTreeTraceIndexer(this, interval);
- }
-
- @Override
- public ITmfLocation restoreLocation(ByteBuffer bufferIn) {
- return new CtfLocation(bufferIn);
- }
-
- @Override
- public boolean isComplete() {
- if (getResource() == null) {
- return true;
- }
-
- String host = null;
- String port = null;
- String sessionName = null;
- try {
- host = getResource().getPersistentProperty(CtfConstants.LIVE_HOST);
- port = getResource().getPersistentProperty(CtfConstants.LIVE_PORT);
- sessionName = getResource().getPersistentProperty(CtfConstants.LIVE_SESSION_NAME);
- } catch (CoreException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- // Something happened to the resource, assume we won't get any more
- // data from it
- return true;
- }
- return host == null || port == null || sessionName == null;
- }
-
- @Override
- public void setComplete(final boolean isComplete) {
- super.setComplete(isComplete);
- try {
- if (isComplete) {
- getResource().setPersistentProperty(CtfConstants.LIVE_HOST, null);
- getResource().setPersistentProperty(CtfConstants.LIVE_PORT, null);
- getResource().setPersistentProperty(CtfConstants.LIVE_SESSION_NAME, null);
- }
- } catch (CoreException e) {
- Activator.getDefault().logError(e.getMessage(), e);
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Patrick Tasse - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.trace;
-
-import java.util.Map;
-
-import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-
-/**
- * Trace validation status that contains additional information from a CTF
- * trace for further validation.
- *
- * @since 1.0
- */
-public class CtfTraceValidationStatus extends TraceValidationStatus {
-
- private final Map<String, String> fEnvironment;
-
- /**
- * Constructor
- *
- * @param confidence
- * the confidence level, 0 is lowest
- * @param pluginId
- * the unique identifier of the relevant plug-in
- * @param environment
- * the CTF trace environment variables
- */
- public CtfTraceValidationStatus(int confidence, String pluginId, Map<String, String> environment) {
- super(confidence, pluginId);
- fEnvironment = environment;
- }
-
- /**
- * Get the CTF trace environment variables
- *
- * @return the CTF trace environment variables
- */
- public Map<String, String> getEnvironment() {
- return fEnvironment;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson.
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.core.trace;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Message bundle for tmf.ctf.core.trace
- *
- * @author Matthew Khouzam
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.tracecompass.tmf.ctf.core.trace.messages"; //$NON-NLS-1$
-
- /** Buffer overflow detected */
- public static String CtfTmfTrace_BufferOverflowErrorMessage;
-
- /** Text for host ID */
- public static String CtfTmfTrace_HostID;
-
- /** Major version number not set */
- public static String CtfTmfTrace_MajorNotSet;
-
- /** Reading error */
- public static String CtfTmfTrace_ReadingError;
-
- /** No event */
- public static String CtfTmfTrace_NoEvent;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-CtfTmfTrace_BufferOverflowErrorMessage=Buffer overflow exception, trace is malformed
-CtfTmfTrace_HostID=host ID
-CtfTmfTrace_MajorNotSet=Major version number not set
-CtfTmfTrace_ReadingError=Reading error
-CtfTmfTrace_NoEvent=Trace has no events
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-screenshots/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=f
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
-org.eclipse.jdt.core.compiler.problem.deadCode=error
-org.eclipse.jdt.core.compiler.problem.deprecation=error
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=error
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
-org.eclipse.jdt.core.compiler.source=1.7
-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_annotation=0
-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_method_declaration=0
-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_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-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.alignment_for_union_type_in_multicatch=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=0
-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.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-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.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-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=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not 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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-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=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=250
-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_on_off_tags=false
-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.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+++ /dev/null
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_tmf-style
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=false
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+++ /dev/null
-ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
-ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
-ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
-API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
-API_USE_SCAN_FIELD_SEVERITY=Error
-API_USE_SCAN_METHOD_SEVERITY=Error
-API_USE_SCAN_TYPE_SEVERITY=Error
-CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
-CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
-CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
-CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
-CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
-ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
-ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
-ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
-FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
-FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
-FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
-FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
-ILLEGAL_EXTEND=Warning
-ILLEGAL_IMPLEMENT=Warning
-ILLEGAL_INSTANTIATE=Warning
-ILLEGAL_OVERRIDE=Warning
-ILLEGAL_REFERENCE=Warning
-INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
-INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
-INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
-INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-INVALID_JAVADOC_TAG=Warning
-INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Warning
-LEAK_EXTEND=Warning
-LEAK_FIELD_DECL=Warning
-LEAK_IMPLEMENT=Warning
-LEAK_METHOD_PARAM=Warning
-LEAK_METHOD_RETURN_TYPE=Warning
-METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
-METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
-METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
-METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
-METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
-METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
-METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
-MISSING_EE_DESCRIPTIONS=Ignore
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
-TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
-UNUSED_PROBLEM_FILTERS=Warning
-automatically_removed_unused_problem_filters=false
-eclipse.preferences.version=1
-incompatible_api_component_version=Error
-incompatible_api_component_version_include_major_without_breaking_change=Disabled
-incompatible_api_component_version_include_minor_without_api_change=Disabled
-invalid_since_tag_version=Error
-malformed_since_tag=Error
-missing_since_tag=Error
-report_api_breakage_when_major_version_incremented=Disabled
-report_resolution_errors_api_component=Warning
+++ /dev/null
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=2
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=1
-compilers.p.discouraged-class=1
-compilers.p.internal=1
-compilers.p.missing-packages=2
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=2
-compilers.p.unknown-attribute=1
-compilers.p.unknown-class=1
-compilers.p.unknown-element=1
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=1
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-eclipse.preferences.version=1
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
-Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-SymbolicName: org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;singleton:=true
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests
-Require-Bundle: org.junit;bundle-version="4.0.0",
- org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.eclipse.ui,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.tracecompass.tmf.core,
- org.eclipse.tracecompass.tmf.ui,
- org.eclipse.tracecompass.tmf.ui.swtbot.tests,
- org.eclipse.tracecompass.tmf.ctf.core,
- org.eclipse.tracecompass.tmf.ctf.core.tests
-Import-Package: org.apache.log4j,
- org.apache.log4j.varia,
- org.eclipse.swtbot.eclipse.finder,
- org.eclipse.swtbot.eclipse.finder.widgets,
- org.eclipse.swtbot.swt.finder,
- org.eclipse.swtbot.swt.finder.finders,
- org.eclipse.swtbot.swt.finder.junit,
- org.eclipse.swtbot.swt.finder.results,
- org.eclipse.swtbot.swt.finder.utils,
- org.eclipse.swtbot.swt.finder.waits,
- org.eclipse.swtbot.swt.finder.widgets
+++ /dev/null
-<!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>June 5, 2006</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
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.properties,\
- about.html
-src.includes = about.html
-additional.bundles = org.eclipse.jdt.annotation
-jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-Bundle-Vendor = Eclipse Trace Compass
-Bundle-Name = CTF Support for TMF UI SWTBot Tests Plug-in
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2014 Ericsson
-
- 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
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-test-plugin</packaging>
-
- <name>CTF Support for TMF SWTBot Tests Plug-in</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-surefire-plugin</artifactId>
- <version>${tycho-version}</version>
- <configuration>
- <testSuite>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</testSuite>
- <testClass>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests.AllTests</testClass>
- <useUIHarness>true</useUIHarness>
- <useUIThread>false</useUIThread>
- <argLine>${tycho.testArgLine} ${base.ui.test.vmargs}</argLine>
- <product>org.eclipse.platform.ide</product>
- <environmentVariables>
- <SWT_GTK3>${SWT_GTK3}</SWT_GTK3>
- </environmentVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <groupId>org.eclipse.tracecompass</groupId>
-</project>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- * (Extracted from ImportAndReadSmokeTest.java)
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.varia.NullAppender;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfContext;
-import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
-import org.eclipse.tracecompass.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
-import org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace;
-import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
-import org.eclipse.tracecompass.tmf.ui.views.histogram.HistogramView;
-import org.eclipse.tracecompass.tmf.ui.views.statistics.TmfStatisticsView;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-
-/**
- * Abstract SWTBot Smoke test class.
- *
- * @author Matthew Khouzam
- * @author Bernd Hufmann
- */
-@RunWith(SWTBotJunit4ClassRunner.class)
-public abstract class AbstractImportAndReadSmokeTest {
-
- /** Trace name */
- protected static final String TRACE_NAME = "scp_dest";
- /** Trace folder */
- protected static final String TRACE_FOLDER = "synctraces";
- /** Trace type name for generic CTF traces */
- protected static final String TRACE_TYPE_NAME = "Generic CTF Trace";
- /** A Generic CTF Trace*/
- protected static final CtfTmfTestTrace fTrace = CtfTmfTestTrace.SYNC_DEST;
- /** SWT BOT workbench reference */
- protected static SWTWorkbenchBot fBot;
- /** Wizard to use */
- protected static Wizard fWizard;
-
- /** The Log4j logger instance. */
- protected static final Logger fLogger = Logger.getRootLogger();
-
- /** Test Class setup */
- @BeforeClass
- public static void init() {
- assumeTrue(fTrace.exists());
- SWTBotUtils.failIfUIThread();
-
- /* set up for swtbot */
- SWTBotPreferences.TIMEOUT = 50000; /* 50 second timeout */
- fLogger.removeAllAppenders();
- fLogger.addAppender(new NullAppender());
- fBot = new SWTWorkbenchBot();
-
- SWTBotUtils.closeView("welcome", fBot);
-
- SWTBotUtils.switchToTracingPerspective();
- /* finish waiting for eclipse to load */
- SWTBotUtils.waitForJobs();
- }
-
- /**
- * Test Class teardown
- */
- @AfterClass
- public static void terminate() {
- fLogger.removeAllAppenders();
- }
-
- /**
- * Creates a tracing projects
- */
- protected void createProject() {
- SWTBotUtils.focusMainWindow(fBot.shells());
- fBot.menu("File").menu("New").menu("Project...").click();
-
- fBot.shell("New Project").setFocus();
- SWTBotTree tree = fBot.tree();
- assertNotNull(tree);
- final String tracingKey = "Tracing";
- fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(tracingKey, tree));
- final SWTBotTreeItem tracingNode = tree.expandNode(tracingKey);
-
- tracingNode.select();
- final String projectKey = "Tracing Project";
- fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(projectKey, tracingNode));
- final SWTBotTreeItem tracingProject = tracingNode.getNode(projectKey);
- assertNotNull(tracingProject);
-
- tracingProject.select();
- tracingProject.click();
-
- SWTBotButton nextButton = fBot.button("Next >");
- fBot.waitUntil(Conditions.widgetIsEnabled(nextButton));
- nextButton.click();
- fBot.shell("Tracing Project").setFocus();
-
- final SWTBotText text = fBot.text();
- text.setText(getProjectName());
-
- fBot.button("Finish").click();
- SWTBotUtils.waitForJobs();
- }
-
- /**
- * Finishes the wizard
- */
- protected void importFinish() {
- SWTBotShell shell = fBot.activeShell();
- final SWTBotButton finishButton = fBot.button("Finish");
- finishButton.click();
- fBot.waitUntil(Conditions.shellCloses(shell));
- SWTBotUtils.waitForJobs();
- }
-
- /**
- * Gets the project Name
- * @return the project name
- */
- protected abstract String getProjectName();
-
- // ---------------------------------------------
- // Helpers for testing views
- // ---------------------------------------------
-
- /**
- * Verifies the properties view for a given view part
- *
- * @param vp
- * a view part
- */
- protected void testPropertyView(IViewPart vp) {
- PropertySheet pv = (PropertySheet) vp;
- assertNotNull(pv);
- }
-
- /**
- * Verifies the Histogram View
- * @param vp
- * the view part
- * @param tmfEd
- * the events editor
- */
- protected void testHistogramView(IViewPart vp, final TmfEventsEditor tmfEd) {
- final CtfTmfEvent desiredEvent1 = getEvent(100);
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- tmfEd.setFocus();
- tmfEd.selectionChanged(new SelectionChangedEvent(tmfEd, new StructuredSelection(desiredEvent1)));
- }
- });
-
- SWTBotUtils.waitForJobs();
- SWTBotUtils.delay(1000);
-
- final CtfTmfEvent desiredEvent2 = getEvent(10000);
- SWTBotView hvBot = fBot.viewById(HistogramView.ID);
- List<SWTBotToolbarButton> hvTools = hvBot.getToolbarButtons();
- for (SWTBotToolbarButton hvTool : hvTools) {
- if (hvTool.getToolTipText().toLowerCase().contains("lost")) {
- hvTool.click();
- }
- }
- HistogramView hv = (HistogramView) vp;
- final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent1.getTimestamp());
- final TmfSelectionRangeUpdatedSignal signal2 = new TmfSelectionRangeUpdatedSignal(hv, desiredEvent2.getTimestamp());
- hv.updateTimeRange(100000);
- SWTBotUtils.waitForJobs();
- hv.selectionRangeUpdated(signal);
- hv.broadcast(signal);
- SWTBotUtils.waitForJobs();
- SWTBotUtils.delay(1000);
-
- hv.updateTimeRange(1000000000);
- SWTBotUtils.waitForJobs();
- hv.selectionRangeUpdated(signal2);
- hv.broadcast(signal2);
- SWTBotUtils.waitForJobs();
- SWTBotUtils.delay(1000);
- assertNotNull(hv);
- }
-
- /**
- * Verifies the statistics view
- * @param vp
- * the view part
- */
- protected void testStatisticsView(IViewPart vp) {
- TmfStatisticsView sv = (TmfStatisticsView) vp;
- assertNotNull(sv);
- }
-
- // ---------------------------------------------
- // Trace helpers
- // ---------------------------------------------
-
- /**
- * Gets an event at a given rank
- * @param rank
- * a rank
- * @return the event at given rank
- */
- protected CtfTmfEvent getEvent(int rank) {
- try (CtfTmfTrace trace = fTrace.getTrace()) {
- ITmfContext ctx = trace.seekEvent(0);
- for (int i = 0; i < rank; i++) {
- trace.getNext(ctx);
- }
- return trace.getNext(ctx);
- }
- }
-
- /**
- * Gets a view part based on view title
- * @param viewTile
- * a view title
- * @return the view part
- */
- protected IViewPart getViewPart(final String viewTile) {
- final IViewPart[] vps = new IViewPart[1];
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- IViewReference[] viewRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
- for (IViewReference viewRef : viewRefs) {
- IViewPart vp = viewRef.getView(true);
- if (vp.getTitle().equals(viewTile)) {
- vps[0] = vp;
- return;
- }
- }
- }
- });
-
- return vps[0];
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * SWTBot test suite for tmf.ui
- *
- * @author Matthew Khouzam
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- ImportAndReadSmokeTest.class,
- StandardImportAndReadSmokeTest.class,
- TestInvalidCtfTrace.class
-})
-public class AllTests {
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Marc-Andre Laperle
- * Bernd Hufmann - Extracted functionality to class AbstractImportAndReadSmokeTest
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.BatchImportTraceWizard;
-import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * SWTBot Smoke test. base for other tests
- *
- * @author Matthew Khouzam
- */
-@RunWith(SWTBotJunit4ClassRunner.class)
-public class ImportAndReadSmokeTest extends AbstractImportAndReadSmokeTest {
-
- private static final String TRACE_PROJECT_NAME = "test";
-
- /**
- * Main test case
- */
- @Test
- public void test() {
- createProject();
-
- batchImportOpenWizard();
- batchImportSelecTraceType();
- batchImportAddDirectory();
- batchImportSelectTrace();
- importFinish();
-
- TmfEventsEditor tmfEd = SWTBotUtils.openEditor(fBot, getProjectName(), new Path(TRACE_NAME));
-
- testHistogramView(getViewPart("Histogram"), tmfEd);
- testPropertyView(getViewPart("Properties"));
- testStatisticsView(getViewPart("Statistics"));
- fBot.closeAllEditors();
-
- SWTBotUtils.deleteProject(getProjectName(), fBot);
- }
-
- private static void batchImportOpenWizard() {
- fWizard = new BatchImportTraceWizard();
-
- UIThreadRunnable.asyncExec(new VoidResult() {
- @Override
- public void run() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- // Fire the Import Trace Wizard
- if (workbench != null) {
- final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
- Shell shell = activeWorkbenchWindow.getShell();
- assertNotNull(shell);
- ((BatchImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
- WizardDialog dialog = new WizardDialog(shell, fWizard);
- dialog.open();
- }
- }
- });
-
- fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
- }
-
- private static void batchImportSelecTraceType() {
- final SWTBotTree tree = fBot.tree();
- final String ctfId = "Common Trace Format";
- fBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(ctfId, tree));
- fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_TYPE_NAME, tree.getTreeItem(ctfId)));
- tree.getTreeItem(ctfId).getNode(TRACE_TYPE_NAME).check();
- batchImportClickNext();
- }
-
- private static void batchImportAddDirectory() {
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- ((BatchImportTraceWizard) fWizard).addFileToScan(fTrace.getPath());
- }
- });
- final SWTBotButton removeButton = fBot.button("Remove");
- fBot.waitUntil(Conditions.widgetIsEnabled(removeButton));
- removeButton.click();
- fBot.waitUntil(Conditions.tableHasRows(fBot.table(), 1));
-
- batchImportClickNext();
- }
-
- private static void batchImportSelectTrace() {
- SWTBotTree tree = fBot.tree();
- fBot.waitUntil(Conditions.widgetIsEnabled(tree));
- final SWTBotTreeItem genericCtfTreeItem = tree.getTreeItem(TRACE_TYPE_NAME);
- fBot.waitUntil(Conditions.widgetIsEnabled(genericCtfTreeItem));
- genericCtfTreeItem.expand();
- genericCtfTreeItem.check();
- batchImportClickNext();
- }
-
- private static void batchImportClickNext() {
- IWizardPage currentPage = fWizard.getContainer().getCurrentPage();
- IWizardPage desiredPage = fWizard.getNextPage(currentPage);
- SWTBotButton nextButton = fBot.button("Next >");
- nextButton.click();
- fBot.waitUntil(ConditionHelpers.isWizardOnPage(fWizard, desiredPage));
- }
-
- @Override
- protected String getProjectName() {
- return TRACE_PROJECT_NAME;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
- *
- * 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:
- * Bernd Hufmann - Initial API and implementation
- * Marc-Andre Laperle - Added tests for extracting archives during import
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.VoidResult;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizard;
-import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizardPage;
-import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.Messages;
-import org.eclipse.tracecompass.tmf.core.TmfCommonConstants;
-import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder;
-import org.eclipse.tracecompass.tmf.ui.project.model.TmfTracesFolder;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * SWTBot Smoke test using ImportTraceWizard.
- *
- * @author Bernd Hufmann
- */
-@RunWith(SWTBotJunit4ClassRunner.class)
-public class StandardImportAndReadSmokeTest extends AbstractImportAndReadSmokeTest {
-
- private static final String TRACE_FOLDER_PARENT_PATH = fTrace.getPath() + File.separator + ".." + File.separator + ".." + File.separator;
- private static final String ARCHIVE_FILE_NAME = "synctraces.tar.gz";
- private static final String TRACE_ARCHIVE_PATH = TRACE_FOLDER_PARENT_PATH + ARCHIVE_FILE_NAME;
- private static final String TRACE_FOLDER_PARENT_NAME = "traces";
- private static final String TRACE_PROJECT_NAME = "Tracing";
-
- private static final String ARCHIVE_ROOT_ELEMENT_NAME = "/";
- private static final String GENERATED_ARCHIVE_NAME = "testtraces.zip";
- private static final String URI_SEPARATOR = "/";
- private static final String URI_FILE_SCHEME = "file:";
- private static final String URI_JAR_FILE_SCHEME = "jar:file:";
- private static final boolean IS_WIN32 = System.getProperty("os.name").startsWith("Windows"); //$NON-NLS-1$//$NON-NLS-2$
- private static final String URI_DEVICE_SEPARATOR = IS_WIN32 ? URI_SEPARATOR : "";
-
- /**
- * Test import from directory
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromDirectory() throws Exception {
- testImport(0, false, false);
- }
-
- /**
- * Test import from directory, create links
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromDirectoryLinks() throws Exception {
- testImport(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE, false, false);
- }
-
- /**
- * Test import from directory, preserve folder structure
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromDirectoryPreserveFolder() throws Exception {
- testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false, false);
- }
-
- /**
- * Test import from directory, create links, preserve folder structure
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromDirectoryLinksPreserveFolder() throws Exception {
- int options = ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE;
- testImport(options, false, false);
- }
-
- /**
- * Test import from directory, overwrite all
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromDirectoryOverwrite() throws Exception {
- testImport(0, false, false);
- testImport(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false, false);
- }
-
- /**
- * Test import from archive
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromArchive() throws Exception {
- testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, true, true);
- }
-
- /**
- * Test import from directory, preserve folder structure
- * @throws Exception on error
- */
- @Test
- public void testImportFromArchivePreserveFolder() throws Exception {
- testImport(ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false, true);
- }
-
- /**
- * Test import from directory, overwrite all
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testImportFromArchiveOverwrite() throws Exception {
- testImport(0, false, true);
- testImport(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false, true);
- }
-
- /**
- * Test import from directory containing archives
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testExtractArchivesFromDirectory() throws Exception {
- testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false);
- }
-
- /**
- * Test import from directory containing archives, create links
- * @throws Exception on error
- */
- @Test
- public void testExtractArchivesFromDirectoryLinks() throws Exception {
- testImportAndExtractArchives(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, false);
- }
-
- /**
- * Test import from directory containing archives, create links, preserve folder structure
- * @throws Exception on error
- */
- @Test
- public void testExtractArchivesFromDirectoryLinksPreserveStruture() throws Exception {
- testImportAndExtractArchives(ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE | ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, false);
- }
-
- /**
- * Test import from archive containing archives
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testExtractArchivesFromArchive() throws Exception {
- testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES, true);
- }
-
- /**
- * Test import from archive containing archives, preserve folder structure
- *
- * @throws Exception
- * on error
- */
- @Test
- public void testExtractArchivesFromArchivePreserveFolder() throws Exception {
- testImportAndExtractArchives(ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES | ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE, true);
- }
-
- private void testImport(int options, boolean testViews, boolean fromArchive) throws Exception {
- createProject();
- String expectedSourceLocation = null;
- openImportWizard();
- if (fromArchive) {
- expectedSourceLocation = URI_JAR_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(TRACE_ARCHIVE_PATH).getCanonicalPath()) + "!" + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
- selectImportFromArchive(TRACE_ARCHIVE_PATH);
- selectFolder(ARCHIVE_ROOT_ELEMENT_NAME);
- SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
- assertFalse(checkBox.isEnabled());
- } else {
- String sourcePath = TRACE_FOLDER_PARENT_PATH + File.separator + TRACE_FOLDER + File.separator + TRACE_NAME;
- expectedSourceLocation = URI_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(sourcePath).getCanonicalPath()) + URI_SEPARATOR;
- selectImportFromDirectory(TRACE_FOLDER_PARENT_PATH);
- selectFolder(new String [] {TRACE_FOLDER_PARENT_NAME, TRACE_FOLDER });
- }
-
- setOptions(options, ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
- importFinish();
-
- IPath expectedElementPath = new Path(TRACE_NAME);
- if ((options & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) {
- expectedElementPath = new Path(TRACE_FOLDER).append(expectedElementPath);
- }
-
- checkOptions(options, expectedSourceLocation, expectedElementPath);
- TmfEventsEditor tmfEd = SWTBotUtils.openEditor(fBot, getProjectName(), expectedElementPath);
- if (testViews) {
- testViews(tmfEd);
- }
-
- fBot.closeAllEditors();
-
- SWTBotUtils.deleteProject(getProjectName(), fBot);
- }
-
- private void testImportAndExtractArchives(int options, boolean fromArchive) throws Exception {
- createProject();
-
- String expectedSourceLocation;
- IPath expectedElementPath;
- if (fromArchive) {
- String testArchivePath = createArchive();
- openImportWizard();
- selectImportFromArchive(testArchivePath);
- selectFile(ARCHIVE_FILE_NAME, ARCHIVE_ROOT_ELEMENT_NAME, TRACE_PROJECT_NAME, TRACE_FOLDER_PARENT_NAME);
-
- expectedSourceLocation = URI_JAR_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(testArchivePath).getCanonicalPath()) + "!" + URI_SEPARATOR + TRACE_PROJECT_NAME + URI_SEPARATOR + TRACE_FOLDER_PARENT_NAME + URI_SEPARATOR + ARCHIVE_FILE_NAME
- + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
- expectedElementPath = new Path(TRACE_PROJECT_NAME).append(TRACE_FOLDER_PARENT_NAME).append(ARCHIVE_FILE_NAME).append(TRACE_FOLDER).append(TRACE_NAME);
- } else {
- openImportWizard();
- selectImportFromDirectory(TRACE_FOLDER_PARENT_PATH);
- selectFile(ARCHIVE_FILE_NAME, TRACE_FOLDER_PARENT_NAME);
- expectedElementPath = new Path(ARCHIVE_FILE_NAME).append(TRACE_FOLDER).append(TRACE_NAME);
- expectedSourceLocation = URI_FILE_SCHEME + URI_DEVICE_SEPARATOR + new Path(new File(TRACE_FOLDER_PARENT_PATH).getCanonicalPath()) + URI_SEPARATOR + ARCHIVE_FILE_NAME + URI_SEPARATOR + TRACE_FOLDER + URI_SEPARATOR + TRACE_NAME + URI_SEPARATOR;
- }
-
- if ((options & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) == 0) {
- expectedElementPath = new Path(TRACE_NAME);
- }
-
- setOptions(options, ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
- importFinish();
- // Archives should never be imported as links
- int expectedOptions = options & ~ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE;
- checkOptions(expectedOptions, expectedSourceLocation, expectedElementPath);
-
- TmfEventsEditor editor = SWTBotUtils.openEditor(fBot, TRACE_PROJECT_NAME, expectedElementPath);
- testViews(editor);
-
- SWTBotUtils.deleteProject(getProjectName(), fBot);
- }
-
- /**
- * Create a temporary archive containing a nested archive. For example,
- * testtraces.zip/synctraces.tar.gz can be used to test a nested archive.
- */
- private String createArchive() throws URISyntaxException, CoreException, IOException {
-
- // Link to the test traces folder. We use a link so that we can safely
- // delete the entire project when we are done.
- IProject project = getProjectResource();
- String canonicalPath = new File(TRACE_FOLDER_PARENT_PATH).getCanonicalPath();
- IFolder folder = project.getFolder(TRACE_FOLDER_PARENT_NAME);
- folder.createLink(new Path(canonicalPath), IResource.REPLACE, null);
-
- SWTBotTreeItem traceFilesProject = SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME);
- traceFilesProject.contextMenu("Export...").click();
-
- fBot.waitUntil(Conditions.shellIsActive("Export"));
- SWTBotShell activeShell = fBot.activeShell();
- SWTBotTree exportWizardsTree = fBot.tree();
- SWTBotTreeItem treeItem = SWTBotUtils.getTreeItem(fBot, exportWizardsTree, "General", "Archive File");
- treeItem.select();
- fBot.button("Next >").click();
- fBot.button("&Deselect All").click();
- selectFile(ARCHIVE_FILE_NAME, TRACE_PROJECT_NAME, TRACE_FOLDER_PARENT_NAME);
-
- String workspacePath = URIUtil.toFile(URIUtil.fromString(System.getProperty("osgi.instance.area"))).getAbsolutePath();
- final String archiveDestinationPath = workspacePath + File.separator + TRACE_PROJECT_NAME + File.separator + GENERATED_ARCHIVE_NAME;
- fBot.comboBox().setText(archiveDestinationPath);
- fBot.button("&Finish").click();
- fBot.waitUntil(Conditions.shellCloses(activeShell));
- return archiveDestinationPath;
- }
-
- private void testViews(TmfEventsEditor editor) {
- testHistogramView(getViewPart("Histogram"), editor);
- testPropertyView(getViewPart("Properties"));
- testStatisticsView(getViewPart("Statistics"));
- }
-
- private static void openImportWizard() {
- fWizard = new ImportTraceWizard();
-
- UIThreadRunnable.asyncExec(new VoidResult() {
- @Override
- public void run() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- // Fire the Import Trace Wizard
- if (workbench != null) {
- final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
- Shell shell = activeWorkbenchWindow.getShell();
- assertNotNull(shell);
- ((ImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
- WizardDialog dialog = new WizardDialog(shell, fWizard);
- dialog.open();
- }
- }
- });
-
- fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
- }
-
- private static void selectImportFromDirectory(String directoryPath) {
- SWTBotRadio button = fBot.radio("Select roo&t directory:");
- button.click();
-
- SWTBotCombo sourceCombo = fBot.comboBox();
- File traceFolderParent = new File(directoryPath);
- sourceCombo.setText(traceFolderParent.getAbsolutePath());
-
- SWTBotText text = fBot.text();
- text.setFocus();
- }
-
- private static void selectImportFromArchive(String archivePath) {
- SWTBotRadio button = fBot.radio("Select &archive file:");
- button.click();
-
- SWTBotCombo sourceCombo = fBot.comboBox(1);
-
- sourceCombo.setText(new File(archivePath).getAbsolutePath());
-
- SWTBotText text = fBot.text();
- text.setFocus();
- }
-
- private static void selectFolder(String... treePath) {
- SWTBotTree tree = fBot.tree();
- fBot.waitUntil(Conditions.widgetIsEnabled(tree));
- SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(fBot, tree, treePath);
- folderNode.check();
- }
-
- private static void selectFile(String fileName, String... folderTreePath) {
- SWTBotTree folderTree = fBot.tree();
- fBot.waitUntil(Conditions.widgetIsEnabled(folderTree));
- SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(fBot, folderTree, folderTreePath);
- folderNode.select();
-
- SWTBotTable fileTable = fBot.table();
- fBot.waitUntil(Conditions.widgetIsEnabled(fileTable));
- fBot.waitUntil(ConditionHelpers.isTableItemAvailable(fileName, fileTable));
- SWTBotTableItem tableItem = fileTable.getTableItem(fileName);
- tableItem.check();
- }
-
- private static void setOptions(int optionFlags, String traceTypeName) {
- SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
- if (checkBox.isEnabled()) {
- if ((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0) {
- checkBox.select();
- } else {
- checkBox.deselect();
- }
- }
-
- checkBox = fBot.checkBox(Messages.ImportTraceWizard_PreserveFolderStructure);
- if ((optionFlags & ImportTraceWizardPage.OPTION_PRESERVE_FOLDER_STRUCTURE) != 0) {
- checkBox.select();
- } else {
- checkBox.deselect();
- }
-
- checkBox = fBot.checkBox(Messages.ImportTraceWizard_ImportUnrecognized);
- if ((optionFlags & ImportTraceWizardPage.OPTION_IMPORT_UNRECOGNIZED_TRACES) != 0) {
- checkBox.select();
- } else {
- checkBox.deselect();
- }
-
- checkBox = fBot.checkBox(Messages.ImportTraceWizard_OverwriteExistingTrace);
- if ((optionFlags & ImportTraceWizardPage.OPTION_OVERWRITE_EXISTING_RESOURCES) != 0) {
- checkBox.select();
- } else {
- checkBox.deselect();
- }
-
- SWTBotCombo comboBox = fBot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
- if (traceTypeName != null && !traceTypeName.isEmpty()) {
- comboBox.setSelection(traceTypeName);
- } else {
- comboBox.setSelection(ImportTraceWizardPage.TRACE_TYPE_AUTO_DETECT);
- }
- }
-
- private void checkOptions(int optionFlags, String expectedSourceLocation, IPath expectedElementPath) throws CoreException {
- IProject project = getProjectResource();
- assertTrue(project.exists());
- TmfProjectElement tmfProject = TmfProjectRegistry.getProject(project, true);
- assertNotNull(tmfProject);
- TmfTraceFolder tracesFolder = tmfProject.getTracesFolder();
- assertNotNull(tracesFolder);
- List<TmfTraceElement> traces = tracesFolder.getTraces();
- assertFalse(traces.isEmpty());
- Collections.sort(traces, new Comparator<TmfTraceElement>() {
- @Override
- public int compare(TmfTraceElement arg0, TmfTraceElement arg1) {
- return arg0.getElementPath().compareTo(arg1.getElementPath());
- }
- });
-
- TmfTraceElement tmfTraceElement = traces.get(0);
- IResource traceResource = tmfTraceElement.getResource();
-
- assertEquals((optionFlags & ImportTraceWizardPage.OPTION_CREATE_LINKS_IN_WORKSPACE) != 0, traceResource.isLinked());
-
- // i.e. /Tracing/Traces
- IPath expectedPath = Path.ROOT.append(new Path(TRACE_PROJECT_NAME)).append(TmfTracesFolder.TRACES_FOLDER_NAME).append(expectedElementPath);
- assertEquals(expectedPath, traceResource.getFullPath());
-
- String sourceLocation = traceResource.getPersistentProperty(TmfCommonConstants.SOURCE_LOCATION);
- assertNotNull(sourceLocation);
- assertEquals(expectedSourceLocation, sourceLocation);
- }
-
- @Override
- protected String getProjectName() {
- return TRACE_PROJECT_NAME;
- }
-
- private IProject getProjectResource() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * 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:
- * Matthew Khouzam - Initial API and implementation
- * Patrick Tasse - Fix editor handling
- *******************************************************************************/
-
-package org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests;
-
-import static org.eclipse.swtbot.swt.finder.SWTBotAssert.assertContains;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.FileVisitor;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Logger;
-import org.apache.log4j.SimpleLayout;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-/**
- * Test invalid trace openning
- *
- * @author Matthew Khouzam
- */
-@RunWith(Parameterized.class)
-public class TestInvalidCtfTrace {
-
- private static final String PROJET_NAME = "TestInvalidCtfTraces";
- private static final Path BASE_PATH = Paths.get("../org.eclipse.tracecompass.ctf.core.tests", "traces", "ctf-testsuite", "tests", "1.8");
-
- /** The Log4j logger instance. */
- private static final Logger fLogger = Logger.getRootLogger();
-
- private static SWTWorkbenchBot fBot;
-
- private final File fLocation;
-
- private final String fExpectedMessage;
-
- private static final Map<String, String> ERRORS = new HashMap<>();
- static {
- // metadata
- ERRORS.put("array-redefinition", "MismatchedTokenException(57!=72)");
- ERRORS.put("array-size-identifier", "Is not an integer: x");
- ERRORS.put("array-size-keyword", "NoViableAltException(75@[])");
- ERRORS.put("array-size-negative", "Array length is negative");
- ERRORS.put("array-size-not-present", "NoViableAltException(14@[])");
- ERRORS.put("array-size-string", "Is not an integer: x");
- ERRORS.put("array-size-type-field", "Is not an integer: uint32_t");
- ERRORS.put("array-size-type", "Is not an integer: uint32_t");
- ERRORS.put("integer-encoding-as-string", "Invalid value for encoding");
- ERRORS.put("integer-encoding-invalid", "Invalid value for encoding");
- ERRORS.put("integer-negative-bit-size", "Invalid value for size");
- ERRORS.put("integer-range", "Invalid integer format: 23452397856348975623897562893746589237465289374658923764598237645897234658723648579236");
- ERRORS.put("integer-signed-as-string", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
- ERRORS.put("integer-signed-invalid", "Invalid boolean value svp");
- ERRORS.put("integer-size-as-string", "Invalid value for size");
- ERRORS.put("integer-size-missing", "org.eclipse.tracecompass.internal.ctf.core.event.metadata.exceptions.ParseException");
- ERRORS.put("struct-align-enum", "Invalid value for alignment");
- ERRORS.put("struct-align-huge", "Invalid integer format: 0xFFFFFFFFU");
- ERRORS.put("struct-align-negative", "Invalid value for alignment : -8");
- ERRORS.put("struct-align-string", "Invalid value for alignment");
- ERRORS.put("struct-align-zero", "Invalid value for alignment : 0");
- ERRORS.put("struct-duplicate-field-name", "Identifier has already been defined:xxx");
- ERRORS.put("struct-duplicate-struct-name", "struct a already defined.");
- ERRORS.put("struct-field-name-keyword", "NoViableAltException(73@[])");
- // streams
- ERRORS.put("content-size-larger-than-packet-size", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-alignment-empty-struct", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-alignment-integer", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-array-of-integers", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-float", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-integer", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-len-of-sequence", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-sequence-between-elements", "UNKNOWN"); //FIXME
- ERRORS.put("cross-packet-event-sequence-start", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-empty-event-with-aligned-struct", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-float", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-integer", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-large-sequence-length", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-len-of-sequence", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-packet-header", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-sequence-between-elements", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-sequence-start", "UNKNOWN"); //FIXME
- ERRORS.put("out-of-bound-sequence-within-element", "UNKNOWN"); //FIXME
-
- }
-
- /**
- * Populate the parameters
- *
- * @return the parameters. Basically all the errors with lookuped paths
- */
- @Parameters(name = "{index}: {0}")
- public static Iterable<Object[]> getTracePaths() {
- final List<Object[]> dirs = new LinkedList<>();
-
- FileVisitor<Path> visitor = new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
- final Path fileName = dir.getFileName();
- String res = ERRORS.get(fileName.toString());
- if (res != null) {
- dirs.add(new Object[] { dir.toFile(), res });
- return FileVisitResult.SKIP_SUBTREE;
- }
- return FileVisitResult.CONTINUE;
- }
-
- };
- /* TODO: add way of handling an error in a trace during a run */
- /* when that is done, we can add regression/stream/fail */
-
- Path badMetadata = BASE_PATH.resolve(Paths.get("regression", "metadata", "fail"));
- try {
- Files.walkFileTree(badMetadata, visitor);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return dirs;
- }
-
- /**
- * Constructor
- *
- * @param location
- * trace file
- * @param errorMessage
- * error message
- */
- public TestInvalidCtfTrace(File location, String errorMessage) {
- fLocation = location;
- fExpectedMessage = errorMessage;
- }
-
- /**
- * Initialization
- */
- @Before
- public void init() {
- SWTBotUtils.failIfUIThread();
- Thread.currentThread().setName("SWTBot Thread"); // for the debugger
- /* set up for swtbot */
- SWTBotPreferences.TIMEOUT = 20000; /* 20 second timeout */
- fLogger.removeAllAppenders();
- fLogger.addAppender(new ConsoleAppender(new SimpleLayout()));
- fBot = new SWTWorkbenchBot();
-
- SWTBotUtils.closeView("welcome", fBot);
-
- SWTBotUtils.switchToTracingPerspective();
- /* finish waiting for eclipse to load */
- SWTBotUtils.waitForJobs();
- SWTBotUtils.createProject(PROJET_NAME);
-
- }
-
- /**
- * Delete file
- */
- @After
- public void cleanup() {
- SWTBotUtils.deleteProject(PROJET_NAME, fBot);
- fLogger.removeAllAppenders();
- }
-
- /**
- * Open an invalid trace and see the message
- */
- @Test
- public void testOpen() {
- SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME);
- SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.ui.type.ctf");
- fBot.waitUntil(Conditions.shellIsActive("Open Trace"));
- final SWTBotShell shell = fBot.activeShell();
- final SWTBot dialogBot = shell.bot();
- String text = dialogBot.label(1).getText();
- dialogBot.button().click();
- fBot.waitUntil(Conditions.shellCloses(shell));
- assertContains(fExpectedMessage, text);
-
- }
-
-}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tracecompass.tmf.ctf</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
+++ /dev/null
-eclipse.preferences.version=1
-line.separator=\n
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-bin.includes = feature.xml,\
- feature.properties,\
- p2.inf
-src.includes = sourceTemplateFeature/p2.inf
+++ /dev/null
-###############################################################################
-# Copyright (c) 2009, 2015 Ericsson
-#
-# 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:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-featureName=CTF (Common Trace Format) Analysis
-
-description=Plug-ins to add support for reading and analyzing traces in the \
-Common Trace Format (CTF) to the Tracing and Monitoring Framework (TMF).
-
-featureProvider=Eclipse Trace Compass
-
-copyright=Copyright 2015 Ericsson
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- For PDE build, remove "ws" and "arch" -->
-<feature
- id="org.eclipse.tracecompass.tmf.ctf"
- label="%featureName"
- version="1.0.0.qualifier"
- provider-name="%featureProvider"
- license-feature="org.eclipse.license"
- license-feature-version="0.0.0">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="%licenseURL">
- %license
- </license>
-
- <includes
- id="org.eclipse.tracecompass.tmf"
- version="0.0.0"
- name="Tracing and Monitoring Framework (TMF)"/>
-
- <includes
- id="org.eclipse.tracecompass.ctf"
- version="0.0.0"
- name="Common Trace Format (CTF)"/>
-
- <requires>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.tracecompass.ctf.core" version="1.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.tracecompass.tmf.core" version="1.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.ui.ide"/>
- <import plugin="org.eclipse.tracecompass.tmf.ui" version="1.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.help"/>
- </requires>
-
- <plugin
- id="org.eclipse.tracecompass.tmf.ctf.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
+++ /dev/null
-update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.tmf.ctf.feature.group' || pc.name == 'org.eclipse.tracecompass.tmf.ctf.feature.group'))
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2011, Red Hat, Inc.
-
- 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
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>org.eclipse.tracecompass</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>org.eclipse.tracecompass.tmf.ctf</artifactId>
- <groupId>org.eclipse.tracecompass</groupId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>eclipse-feature</packaging>
-
- <name>CTF support for TMF Feature</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho.extras</groupId>
- <artifactId>tycho-source-feature-plugin</artifactId>
- <executions>
- <execution>
- <id>source-feature</id>
- <phase>package</phase>
- <goals>
- <goal>source-feature</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-p2-plugin</artifactId>
- <version>${tycho-version}</version>
- <executions>
- <execution>
- <id>attached-p2-metadata</id>
- <phase>package</phase>
- <goals>
- <goal>p2-metadata</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-update.matchExp=providedCapabilities.exists(pc | pc.namespace == 'org.eclipse.equinox.p2.iu' && (pc.name == 'org.eclipse.linuxtools.tmf.ctf.source.feature.group' || pc.name == 'org.eclipse.tracecompass.tmf.ctf.source.feature.group'))
\ No newline at end of file
<modules>
<module>btf</module>
<module>common</module>
+ <module>ctf</module>
<module>doc</module>
<module>gdbtrace</module>
<module>pcap</module>
<module>rcp</module>
<module>statesystem</module>
- <module>org.eclipse.tracecompass.ctf</module>
- <module>org.eclipse.tracecompass.ctf.core</module>
- <module>org.eclipse.tracecompass.ctf.core.tests</module>
- <module>org.eclipse.tracecompass.ctf.parser</module>
- <module>org.eclipse.tracecompass.ctf.parser.tests</module>
-
<module>org.eclipse.tracecompass.tmf</module>
<module>org.eclipse.tracecompass.tmf.core</module>
<module>org.eclipse.tracecompass.tmf.core.tests</module>
<module>org.eclipse.tracecompass.tmf.ui.tests</module>
<module>org.eclipse.tracecompass.tmf.ui.swtbot.tests</module>
- <module>org.eclipse.tracecompass.tmf.ctf</module>
- <module>org.eclipse.tracecompass.tmf.ctf.core</module>
- <module>org.eclipse.tracecompass.tmf.ctf.core.tests</module>
- <module>org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests</module>
-
<module>org.eclipse.tracecompass.tmf.analysis.xml.core</module>
<module>org.eclipse.tracecompass.tmf.analysis.xml.core.tests</module>
<module>org.eclipse.tracecompass.tmf.analysis.xml.ui</module>