1 /* 2 * Copyright (C) 2008 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.hit; 18 19 public class StackFrame { 20 public static final int NO_LINE_NUMBER = 0; 21 public static final int UNKNOWN_LOCATION = -1; 22 public static final int COMPILED_METHOD = -2; 23 public static final int NATIVE_METHOD = -3; 24 25 long mId; 26 String mMethodName; 27 String mSignature; 28 String mFilename; 29 int mSerialNumber; 30 int mLineNumber; 31 32 public StackFrame(long id, String method, String sig, String file, 33 int serial, int line) { 34 mId = id; 35 mMethodName = method; 36 mSignature = sig; 37 mFilename = file; 38 mSerialNumber = serial; 39 mLineNumber = line; 40 } 41 42 private final String lineNumberString() { 43 switch (mLineNumber) { 44 case NO_LINE_NUMBER: return "No line number"; 45 case UNKNOWN_LOCATION: return "Unknown line number"; 46 case COMPILED_METHOD: return "Compiled method"; 47 case NATIVE_METHOD: return "Native method"; 48 49 default: return String.valueOf(mLineNumber); 50 } 51 } 52 53 public final String toString() { 54 return mMethodName 55 + mSignature.replace('/', '.') 56 + " - " 57 + mFilename + ":" 58 + lineNumberString(); 59 } 60 } 61