ghidra-master/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/line/StateMachine.java
/* ###
 * IP: GHIDRA
 * REVIEWED: YES
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.app.util.bin.format.dwarf.line;

import ghidra.util.Msg;

public class StateMachine {
	/**
	 * The program-counter value corresponding to a machine instruction
	 * generated by the compiler.
	 */
	public long address;
	/**
	 * An unsigned integer indicating the identity of the source file
	 * corresponding to a machine instruction.
	 */
	public int file;
	/**
	 * An unsigned integer indicating a source line number. Lines are
	 * numbered beginning at 1. The compiler may emit the value 0 in cases
	 * where an instruction cannot be attributed to any source line.
	 */
	public int line;
	/**
	 * An unsigned integer indicating a column number within a source line.
	 * Columns are numbered beginning at 1. The value 0 is reserved to
	 * indicate that a statement begins at the ??left edge?? of the line.
	 */
	public int column;
	/**
	 * A boolean indicating that the current instruction is the beginning of a
	 * statement.
	 */
	public boolean isStatement;
	/**
	 * A boolean indicating that the current instruction is the beginning of a
	 * basic block.
	 */
	public boolean isBasicBlock;
	/**
	 * A boolean indicating that the current address is that of the first byte after
	 * the end of a sequence of target machine instructions.
	 */
	public boolean isEndSequence;

	public void reset(boolean defaultIsStatement) {
		address = 0;
		file = 1;
		line = 1;
		column = 0;
		isStatement = defaultIsStatement;
		isBasicBlock = false;
		isEndSequence = false;
	}

	void print() {
		Msg.info(this, "ADDR=" + Long.toHexString(address));
		Msg.info(this, " ");
		Msg.info(this, "FILE=" + Long.toHexString(file));
		Msg.info(this, " ");
		Msg.info(this, "LINE=" + Long.toHexString(line));
		Msg.info(this, " ");
		Msg.info(this, "LINE=" + line);
		Msg.info(this, " ");
		Msg.info(this, "COL=" + Long.toHexString(column));
		Msg.info(this, " ");
		Msg.info(this, "");
	}
}
