2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package gov.nasa.jpf.vm.serialize;
21 import java.io.OutputStream;
23 import gov.nasa.jpf.util.FinalBitSet;
24 import gov.nasa.jpf.vm.DebugStateSerializer;
25 import gov.nasa.jpf.vm.ElementInfo;
26 import gov.nasa.jpf.vm.JPFOutputStream;
27 import gov.nasa.jpf.vm.NativeStateHolder;
28 import gov.nasa.jpf.vm.StackFrame;
29 import gov.nasa.jpf.vm.StaticElementInfo;
30 import gov.nasa.jpf.vm.ThreadInfo;
33 * a CFSerializer that stores the serialized program state in a
34 * readable/diffable format.
36 * Automatically used by Debug..StateSet if the configured vm.storage.class is .vm.DebugJenkinsStateSet
38 public class DebugCFSerializer extends CFSerializer implements DebugStateSerializer {
42 // this is for debugging purposes only
43 public DebugCFSerializer() {
44 os = new JPFOutputStream(System.out);
48 public void setOutputStream (OutputStream s){
49 os = new JPFOutputStream(s);
53 protected int[] computeStoringData() {
54 os.printCommentLine("------------------------ serialized state");
55 return super.computeStoringData();
59 protected void processReferenceQueue(){
61 os.printCommentLine("--- heap");
63 super.processReferenceQueue();
67 public void process (ElementInfo ei) {
70 FinalBitSet filtered = !ei.isArray() ? getInstanceFilterMask(ei.getClassInfo()) : null;
71 os.print(ei, filtered);
76 protected void serializeClassLoaders(){
78 os.printCommentLine("--- classes");
80 super.serializeClassLoaders();
84 protected void serializeClass (StaticElementInfo sei){
85 super.serializeClass(sei);
87 FinalBitSet filtered = getStaticFilterMask(sei.getClassInfo());
88 os.print(sei, filtered);
93 protected void serializeStackFrames(){
95 os.printCommentLine("--- threads");
97 super.serializeStackFrames();
101 protected void serializeStackFrames(ThreadInfo ti){
105 super.serializeStackFrames(ti);
109 protected void serializeFrame(StackFrame frame){
112 super.serializeFrame(frame);
116 protected void serializeNativeStateHolders(){
118 os.printCommentLine("--- native state holders");
120 super.serializeNativeStateHolders();
124 protected void serializeNativeStateHolder (NativeStateHolder nsh){
127 super.serializeNativeStateHolder(nsh);