blob: 89823db86fb0a9c3a923897a62239ae907754573 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2010, 2011 Nokia 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:
* Nokia - Initial API and implementation
* Broadcom - implmentation of ctor with properties
*******************************************************************************/
package org.eclipse.cdt.debug.edc.internal.arm;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.edc.arm.IARMSymbol;
import org.eclipse.cdt.debug.edc.internal.symbols.Symbol;
import org.eclipse.cdt.utils.Addr32;
public class ARMSymbol extends Symbol implements IARMSymbol {
protected boolean isThumb;
public ARMSymbol(String name, IAddress address, long size) {
this(name, address, size, new HashMap<String, Object>(0));
}
public ARMSymbol(String name, IAddress address, long size,
Map<String, Object> props) {
// will keep thumb-mode in isThumb; need to clear thumb bit in addr
super(name, new Addr32(address.getValue().clearBit(0).longValue()),
size, props);
isThumb = address.getValue().testBit(0);
}
public int compareTo(Object o) {
if (o instanceof ARMSymbol) {
return address.compareTo(((ARMSymbol) o).address);
} else if (o instanceof IAddress) {
return address.compareTo(o);
}
return 0;
}
public boolean isThumbAddress() {
return isThumb;
}
@Override
public String toString() {
return "name=" + name //$NON-NLS-1$
+ ", address=" + address.toHexAddressString() //$NON-NLS-1$
+ ", size=" + size + ", thumb=" + isThumb; //$NON-NLS-1$
}
}