1/* 2 * Copyright (C) 2007 The Android Open Source Project 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 17package com.android.ddmlib; 18 19/** 20 * Memory address to library mapping for native libraries. 21 * <p/> 22 * Each instance represents a single native library and its start and end memory addresses. 23 */ 24public final class NativeLibraryMapInfo { 25 private long mStartAddr; 26 private long mEndAddr; 27 28 private String mLibrary; 29 30 /** 31 * Constructs a new native library map info. 32 * @param startAddr The start address of the library. 33 * @param endAddr The end address of the library. 34 * @param library The name of the library. 35 */ 36 NativeLibraryMapInfo(long startAddr, long endAddr, String library) { 37 this.mStartAddr = startAddr; 38 this.mEndAddr = endAddr; 39 this.mLibrary = library; 40 } 41 42 /** 43 * Returns the name of the library. 44 */ 45 public String getLibraryName() { 46 return mLibrary; 47 } 48 49 /** 50 * Returns the start address of the library. 51 */ 52 public long getStartAddress() { 53 return mStartAddr; 54 } 55 56 /** 57 * Returns the end address of the library. 58 */ 59 public long getEndAddress() { 60 return mEndAddr; 61 } 62 63 /** 64 * Returns whether the specified address is inside the library. 65 * @param address The address to test. 66 * @return <code>true</code> if the address is between the start and end address of the library. 67 * @see #getStartAddress() 68 * @see #getEndAddress() 69 */ 70 public boolean isWithinLibrary(long address) { 71 return address >= mStartAddr && address <= mEndAddr; 72 } 73} 74