diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java 2004-09-17 09:18:42.000000000 +0400 @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; @@ -649,7 +650,7 @@ /** * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long) */ - public ICDILocation createLocation(long address) { + public ICDILocation createLocation(IAddress address) { return new Location(address); } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java 2004-09-17 09:18:42.000000000 +0400 @@ -95,7 +95,7 @@ MISession miSession = mblock.getMISession(); ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession); for (int i = 0; i < blocks.length; i++) { - if (blocks[i].getStartAddress() == mblock.getAddress() && + if (blocks[i].getStartAddress().equals(mblock.getAddress()) && blocks[i].getLength() == mblock.getLength()) { source = blocks[i]; break; diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java 2004-09-17 09:18:42.000000000 +0400 @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.mi.core.cdi.Session; @@ -36,16 +37,16 @@ /** * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses() */ - public Long[] getAddresses() { + public IAddress[] getAddresses() { /* But only returns the address that are in the block. */ - Long[] longs = miMem.getAddresses(); - List aList = new ArrayList(longs.length); - for (int i = 0; i < longs.length; i++) { - if (source.contains(longs[i])) { - aList.add(longs[i]); + IAddress[] mi_addresses = miMem.getAddresses(); + List aList = new ArrayList(mi_addresses.length); + for (int i = 0; i < mi_addresses.length; i++) { + if (source.contains(mi_addresses[i])) { + aList.add(mi_addresses[i]); } } - return (Long[])aList.toArray(new Long[0]); + return (IAddress[])aList.toArray(new IAddress[0]); } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java 2004-09-17 09:18:42.000000000 +0400 @@ -16,6 +16,7 @@ import java.util.Observable; import java.util.Observer; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; @@ -119,7 +120,7 @@ MemoryManager mgr = (MemoryManager)session.getMemoryManager(); MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession()); MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent; - Long[] addresses = miMem.getAddresses(); + IAddress[] addresses = miMem.getAddresses(); for (int i = 0; i < blocks.length; i++) { if (blocks[i].contains(addresses) && (! blocks[i].isFrozen() || blocks[i].isDirty())) { diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java 2004-09-17 09:18:42.000000000 +0400 @@ -10,22 +10,23 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.ICDILocation; /** */ public class Location implements ICDILocation { - long addr; + IAddress addr; String file = ""; //$NON-NLS-1$ String function = ""; //$NON-NLS-1$ int line; public Location(String f, String fnct, int l) { - this(f, fnct, l, 0); + this(f, fnct, l, null); } - public Location(String f, String fnct, int l, long a) { + public Location(String f, String fnct, int l, IAddress a) { if (f != null) file = f; if (fnct != null) @@ -34,14 +35,14 @@ addr = a; } - public Location(long address) { + public Location(IAddress address) { addr = address; } /** * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress() */ - public long getAddress() { + public IAddress getAddress() { return addr; } @@ -86,9 +87,9 @@ } } } - long oaddr = location.getAddress(); - if (addr != 0 && oaddr != 0) { - if (addr == oaddr) { + IAddress oaddr = location.getAddress(); + if (addr != null && oaddr != null) { //IPF_TODO: check ZERO addresses + if (addr.equals(oaddr)) { return true; } } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java 2004-09-17 10:23:11.000000000 +0400 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -17,6 +18,7 @@ import java.util.List; import java.util.Map; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; @@ -100,12 +102,12 @@ /** * update one Block. */ - public Long[] update(MemoryBlock block, List aList) throws CDIException { + public IAddress[] update(MemoryBlock block, List aList) throws CDIException { Target target = (Target)block.getTarget(); MISession miSession = target.getMISession(); MemoryBlock newBlock = cloneBlock(block); - boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() ); - Long[] array = compareBlocks(block, newBlock); + boolean newAddress = ! newBlock.getStartAddress().equals(block.getStartAddress()); + IAddress[] array = compareBlocks(block, newBlock); // Update the block MIDataReadMemoryInfo. block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo()); if (array.length > 0 || newAddress) { @@ -126,21 +128,23 @@ * oldBlock.getLength() == newBlock.getLength(); * @return Long[] array of modified addresses. */ - Long[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { + IAddress[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { byte[] oldBytes = oldBlock.getBytes(); byte[] newBytes = newBlock.getBytes(); List aList = new ArrayList(newBytes.length); - long diff = newBlock.getStartAddress() - oldBlock.getStartAddress(); - if ( Math.abs( diff ) < newBytes.length ) { + BigInteger distance = newBlock.getStartAddress().distance(oldBlock.getStartAddress()); + //IPF_TODO enshure it is OK here + int diff = distance.intValue(); + if ( Math.abs(diff) < newBytes.length) { for (int i = 0; i < newBytes.length; i++) { - if (i + (int)diff < oldBytes.length && i + (int)diff >= 0) { - if (oldBytes[i + (int)diff] != newBytes[i]) { - aList.add(new Long(newBlock.getStartAddress() + i)); + if (i + diff < oldBytes.length && i + diff >= 0) { + if (oldBytes[i + diff] != newBytes[i]) { + aList.add(newBlock.getStartAddress().add(BigInteger.valueOf(i))); } } } } - return (Long[])aList.toArray(new Long[0]); + return (IAddress[])aList.toArray(new IAddress[0]); } /** @@ -176,10 +180,9 @@ /** * @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int) */ - public ICDIMemoryBlock createMemoryBlock(long address, int length) + public ICDIMemoryBlock createMemoryBlock(IAddress address, int length) throws CDIException { - String addr = "0x" + Long.toHexString(address); //$NON-NLS-1$ - return createMemoryBlock(addr, length); + return createMemoryBlock(address.toHexAddressString(), length); } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java 2004-09-17 09:18:42.000000000 +0400 @@ -153,7 +153,7 @@ fLocation = new Location (miBreakpoint.getFile(), miBreakpoint.getFunction(), miBreakpoint.getLine(), - miBreakpoint.getAddress()); + ((Target)getTarget()).getAddressFactory().createAddress(miBreakpoint.getAddress())); } } return fLocation; diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java 2004-09-17 09:18:42.000000000 +0400 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.model; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.mi.core.output.MIAsm; @@ -26,8 +27,8 @@ /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress() */ - public long getAdress() { - return asm.getAddress(); + public IAddress getAdress() { + return ((Target)getTarget()).getAddressFactory().createAddress(asm.getAddress()); } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java 2004-09-17 10:55:28.000000000 +0400 @@ -11,9 +11,11 @@ package org.eclipse.cdt.debug.mi.core.cdi.model; +import java.math.BigInteger; import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.mi.core.MIException; @@ -32,16 +34,19 @@ */ public class MemoryBlock extends CObject implements ICDIMemoryBlock { - MIDataReadMemoryInfo mem; String expression; boolean frozen; boolean dirty; + private MIDataReadMemoryInfo mem; + private IAddress cStartAddress; //cashed start address + private byte[] cBytes; //cashed bytes + public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) { super(target); expression = exp; - mem = info; frozen = true; + setMIDataReadMemoryInfo(info); } /** @@ -52,9 +57,12 @@ } /** - * Reset the internal MIDataReadMemoryInfo. + * Reset the internal MIDataReadMemoryInfo. All modifications into mem info should be done + * using this method */ public void setMIDataReadMemoryInfo(MIDataReadMemoryInfo m) { + cStartAddress = ((Target)getTarget()).getAddressFactory().createAddress(m.getAddress()); + cBytes = getBytes(m); mem = m; } @@ -68,7 +76,7 @@ /** * @return true if any address in the array is within the block. */ - public boolean contains(Long[] adds) { + public boolean contains(IAddress[] adds) { for (int i = 0; i < adds.length; i++) { if (contains(adds[i])) { return true; @@ -80,10 +88,12 @@ /** * @return true if the address is within the block. */ - public boolean contains(Long addr) { - long start = getStartAddress(); + public boolean contains(IAddress addr) { + IAddress start = getStartAddress(); long length = getLength(); - if (start <= addr.longValue() && addr.longValue() <= start + length) { + if ( start.compareTo(addr) <= 0 && + addr.compareTo(start.add(BigInteger.valueOf(length))) <= 0 ) + { return true; } return false; @@ -104,10 +114,10 @@ } /** - * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getBytes() + * */ - public byte[] getBytes() throws CDIException { - MIMemory[] miMem = mem.getMemories(); + private byte[] getBytes(MIDataReadMemoryInfo m) { + MIMemory[] miMem = m.getMemories(); List aList = new ArrayList(); for (int i = 0; i < miMem.length; i++) { long[] data = miMem[i].getData(); @@ -123,6 +133,10 @@ return bytes; } + public byte[] getBytes() throws CDIException { + return cBytes; + } + /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh() */ @@ -130,7 +144,7 @@ Target target = (Target)getTarget(); MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager(); setDirty(true); - Long[] addresses = mgr.update(this, null); + IAddress[] addresses = mgr.update(this, null); // Check if this affects other blocks. if (addresses.length > 0) { MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession()); @@ -154,8 +168,8 @@ /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress() */ - public long getStartAddress() { - return mem.getAddress(); + public IAddress getStartAddress() { + return cStartAddress; } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java 2004-09-17 09:18:42.000000000 +0400 @@ -11,6 +11,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.model; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; import org.eclipse.cdt.debug.mi.core.cdi.Session; @@ -47,15 +48,15 @@ /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress() */ - public long getStartAddress() { - return miShared.getFrom(); + public IAddress getStartAddress() { + return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getFrom()); } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress() */ - public long getEndAddress() { - return miShared.getTo(); + public IAddress getEndAddress() { + return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getTo()); } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java 2004-09-17 09:18:42.000000000 +0400 @@ -130,10 +130,12 @@ */ public ICDILocation getLocation() { if (frame != null) { - return new Location(frame.getFile(), frame.getFunction(), - frame.getLine(), frame.getAddress()); + return new Location(frame.getFile(), + frame.getFunction(), + frame.getLine(), + ((Target)getTarget()).getAddressFactory().createAddress(frame.getAddress())); } - return new Location("", "", 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ + return new Location("", "", 0, ((Target)getTarget()).getAddressFactory().getZero()); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java 2004-09-17 09:18:42.000000000 +0400 @@ -13,6 +13,8 @@ import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; @@ -26,6 +28,7 @@ import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; +import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; import org.eclipse.cdt.debug.mi.core.cdi.Session; @@ -52,7 +55,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo; import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo; -import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; /** */ @@ -63,11 +65,13 @@ Thread[] noThreads = new Thread[0]; Thread[] currentThreads; int currentThreadId; + IAddressFactory addressFactory; - public Target(Session s, MISession mi) { + public Target(Session s, MISession mi, IAddressFactory addrFactory) { session = s; miSession = mi; currentThreads = noThreads; + addressFactory = addrFactory; } public MISession getMISession() { @@ -464,8 +468,8 @@ loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ } else if (location.getFunction() != null && location.getFunction().length() > 0) { loc = location.getFunction(); - } else if (location.getAddress() != 0) { - loc = "*" + location.getAddress(); //$NON-NLS-1$ + } else if ( ! location.getAddress().isZero() ) { + loc = "*" + location.getAddress().toString(); //$NON-NLS-1$ } MIExecUntil until = factory.createMIExecUntil(loc); try { @@ -575,8 +579,8 @@ loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ } else if (location.getFunction() != null && location.getFunction().length() > 0) { loc = location.getFunction(); - } else if (location.getAddress() != 0) { - loc = "*" + location.getAddress(); //$NON-NLS-1$ + } else if (! location.getAddress().isZero()) { + loc = "*" + location.getAddress().toString(); //$NON-NLS-1$ } MIJump jump = factory.createMIJump(loc); try { @@ -742,10 +746,44 @@ /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long) */ - public ICDILocation createLocation(long address) { + public ICDILocation createLocation(IAddress address) { BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return bMgr.createLocation(address); } +/* + private IAddressFactory createAddressFactory() throws CDIException + { + MISession mi = ((Session)getSession()).getMISession(); + CommandFactory cf = mi.getCommandFactory(); + MIGDBShowAddressSize as = cf.createMIGDBShowAddressSize(); + try + { + mi.postCommand(as ); + MIGDBShowAddressSizeInfo info = (MIGDBShowAddressSizeInfo)as.getMIInfo(); + if (info == null) + { + throw new CDIException("Target is not responding"); + } + switch ( info.getAddressSize() ) + { + case 32: + return new Addr32Factory(); + case 64: + return new Addr64Factory(); + default: + throw new CDIException("Undefined address size"); + } + } + catch (MIException e) + { + throw new MI2CDIException(e); + } + } +*/ + public IAddressFactory getAddressFactory() + { + return addressFactory; + } } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java 2004-09-17 09:18:42.000000000 +0400 @@ -11,8 +11,10 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; +import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; /** @@ -29,17 +31,19 @@ /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue() */ - public long pointerValue() throws CDIException { - long value = 0; - String valueString = getValueString(); + public IAddress pointerValue() throws CDIException { + String valueString = getValueString().trim(); int space = valueString.indexOf(' '); if (space != -1) { valueString = valueString.substring(0, space).trim(); } - try { - value = Long.decode(valueString).longValue(); - } catch (NumberFormatException e) { + try{ + + return ((Target)getTarget()).getAddressFactory().createAddress(valueString); + } + catch(Exception e) + { + return null; } - return value; } } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java 2004-09-17 09:18:42.000000000 +0400 @@ -11,8 +11,10 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; +import org.eclipse.cdt.debug.mi.core.cdi.model.Target; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; /** @@ -32,8 +34,7 @@ /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue() */ - public long referenceValue() throws CDIException { - long value = 0; + public IAddress referenceValue() throws CDIException { String valueString = getValueString().trim(); if ( valueString.startsWith("@") ) //$NON-NLS-1$ valueString = valueString.substring( 1 ); @@ -41,10 +42,14 @@ if (space != -1) { valueString = valueString.substring(0, space).trim(); } - try { - value = Long.decode(valueString).longValue(); - } catch (NumberFormatException e) { + try{ + + return ((Target)getTarget()).getAddressFactory().createAddress(valueString); + } + catch(Exception e) + { + return null; } - return value; + } } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java 2004-09-17 09:18:42.000000000 +0400 @@ -13,6 +13,7 @@ import java.util.Properties; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; @@ -54,19 +55,19 @@ SourceManager sourceManager; ICDIConfiguration configuration; - public Session(MISession miSession, boolean attach) { + public Session(MISession miSession, IAddressFactory addrFactory, boolean attach) { commonSetup(); setConfiguration(new Configuration(miSession, attach)); - Target target = new Target(this, miSession); + Target target = new Target(this, miSession, addrFactory); addTargets(new Target[] { target }, target); } - public Session(MISession miSession) { + public Session(MISession miSession, IAddressFactory addrFactory) { commonSetup(); setConfiguration(new CoreFileConfiguration()); - Target target = new Target(this, miSession); + Target target = new Target(this, miSession, addrFactory); addTargets(new Target[] { target }, target); } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java 2004-09-17 09:18:42.000000000 +0400 @@ -17,6 +17,7 @@ import java.util.List; import java.util.Map; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; @@ -145,9 +146,10 @@ } public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) { + IAddressFactory af = ((Target)getSession().getCurrentTarget()).getAddressFactory(); return !miLib.getName().equals(lib.getFileName()) || - miLib.getFrom() != lib.getStartAddress() || - miLib.getTo() != lib.getEndAddress() || + !af.createAddress(miLib.getFrom()).equals(lib.getStartAddress()) || + !af.createAddress(miLib.getTo()).equals(lib.getEndAddress()) || miLib.isRead() != lib.areSymbolsLoaded(); } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java 2004-09-17 09:18:42.000000000 +0400 @@ -12,6 +12,7 @@ import java.util.StringTokenizer; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDISourceManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; @@ -145,16 +146,16 @@ /** * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long) */ - public ICDIInstruction[] getInstructions(long start, long end) throws CDIException { + public ICDIInstruction[] getInstructions(IAddress start, IAddress end) throws CDIException { Target target = (Target)getSession().getCurrentTarget(); return getInstructions(target, start, end); } - public ICDIInstruction[] getInstructions(Target target, long start, long end) throws CDIException { + public ICDIInstruction[] getInstructions(Target target, IAddress start, IAddress end) throws CDIException { MISession mi = target.getMISession(); CommandFactory factory = mi.getCommandFactory(); String hex = "0x"; //$NON-NLS-1$ - String sa = hex + Long.toHexString(start); - String ea = hex + Long.toHexString(end); + String sa = start.toHexAddressString(); + String ea = end.toHexAddressString(); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false); try { mi.postCommand(dis); @@ -205,16 +206,15 @@ /** * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long) */ - public ICDIMixedInstruction[] getMixedInstructions(long start, long end) throws CDIException { + public ICDIMixedInstruction[] getMixedInstructions(IAddress start, IAddress end) throws CDIException { Target target = (Target)getSession().getCurrentTarget(); return getMixedInstructions(target, start, end); } - public ICDIMixedInstruction[] getMixedInstructions(Target target, long start, long end) throws CDIException { + public ICDIMixedInstruction[] getMixedInstructions(Target target, IAddress start, IAddress end) throws CDIException { MISession mi = target.getMISession(); CommandFactory factory = mi.getCommandFactory(); - String hex = "0x"; //$NON-NLS-1$ - String sa = hex + Long.toHexString(start); - String ea = hex + Long.toHexString(end); + String sa = start.toHexAddressString(); + String ea = end.toHexAddressString(); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true); try { mi.postCommand(dis); diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java 2004-09-17 09:18:11.000000000 +0400 @@ -222,6 +222,10 @@ return new MIGDBShowSolibSearchPath(); } + public MIGDBShowAddressSize createMIGDBShowAddressSize() { + return new MIGDBShowAddressSize(); + } + public MIStackInfoDepth createMIStackInfoDepth() { return new MIStackInfoDepth(); } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java 1970-01-01 03:00:00.000000000 +0300 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java 2004-09-17 09:18:11.000000000 +0400 @@ -0,0 +1,38 @@ +/* + * Created on Jun 4, 2004 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package org.eclipse.cdt.debug.mi.core.command; + +import org.eclipse.cdt.debug.mi.core.MIException; +import org.eclipse.cdt.debug.mi.core.output.MIGDBShowAddressSizeInfo; +import org.eclipse.cdt.debug.mi.core.output.MIInfo; +import org.eclipse.cdt.debug.mi.core.output.MIOutput; + +/** + * @author root + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class MIGDBShowAddressSize extends MIGDBShow { + + public MIGDBShowAddressSize () { + super(new String[] { "remoteaddresssize" }); + } + + public MIInfo getMIInfo() throws MIException { + MIGDBShowAddressSizeInfo info = null; + MIOutput out = getMIOutput(); + if (out != null) { + info = new MIGDBShowAddressSizeInfo(out); + if (info.isError()) { + throwMIException(info, out); + } + } + return info; + } + +} diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java 2004-09-17 09:18:11.000000000 +0400 @@ -12,7 +12,7 @@ import org.eclipse.cdt.debug.mi.core.MISession; - +import org.eclipse.cdt.core.IAddress; /** * This can not be detected yet by gdb/mi. @@ -20,18 +20,18 @@ */ public class MIMemoryChangedEvent extends MIChangedEvent { - Long[] addresses; + IAddress[] addresses; - public MIMemoryChangedEvent(MISession source, Long[] addrs) { + public MIMemoryChangedEvent(MISession source, IAddress[] addrs) { this(source, 0, addrs); } - public MIMemoryChangedEvent(MISession source, int token, Long[] addrs) { + public MIMemoryChangedEvent(MISession source, int token, IAddress[] addrs) { super(source, token); addresses = addrs; } - public Long[] getAddresses() { + public IAddress[] getAddresses() { return addresses; } } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java 2004-09-17 09:18:11.000000000 +0400 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.event; +import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.mi.core.MISession; @@ -20,20 +21,20 @@ */ public class MIMemoryCreatedEvent extends MICreatedEvent { - long address; + IAddress address; long totalBytes; - public MIMemoryCreatedEvent(MISession source, long addr, long total) { + public MIMemoryCreatedEvent(MISession source, IAddress addr, long total) { this(source, 0, addr, total); } - public MIMemoryCreatedEvent(MISession source, int token, long addr, long total) { + public MIMemoryCreatedEvent(MISession source, int token, IAddress addr, long total) { super(source, token); address = addr; totalBytes = total; } - public long getAddress() { + public IAddress getAddress() { return address; } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIAsm.java 2004-09-17 09:18:11.000000000 +0400 @@ -14,7 +14,7 @@ * Represent a GDB Tuple MI assembly response. */ public class MIAsm { - long address; + String address; String function = ""; //$NON-NLS-1$ String opcode = ""; //$NON-NLS-1$ String args = ""; //$NON-NLS-1$ @@ -24,7 +24,7 @@ parse(tuple); } - public long getAddress() { + public String getAddress() { return address; } @@ -43,7 +43,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append('{'); - buffer.append("address=\"" + Long.toHexString(address) +"\""); //$NON-NLS-1$//$NON-NLS-2$ + buffer.append("address=\"" + address +"\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",func-name=\"" + function + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$ buffer.append(",inst=\"" + getInstruction() + "\""); //$NON-NLS-1$//$NON-NLS-2$ @@ -64,7 +64,7 @@ if (var.equals("address")) { //$NON-NLS-1$ try { - address = Long.decode(str.trim()).longValue(); + address = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("func-name")) { //$NON-NLS-1$ diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java 2004-09-17 09:18:11.000000000 +0400 @@ -54,7 +54,7 @@ String type = ""; //$NON-NLS-1$ String disp = ""; //$NON-NLS-1$ boolean enabled; - long address; + String address; String func = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$ int line; @@ -146,7 +146,7 @@ enabled = e; } - public long getAddress() { + public String getAddress() { return address; } @@ -228,7 +228,7 @@ enabled = str.equals("y"); //$NON-NLS-1$ } else if (var.equals("addr")) { //$NON-NLS-1$ try { - address = Long.decode(str.trim()).longValue(); + address = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("func")) { //$NON-NLS-1$ diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java 2004-09-17 09:18:11.000000000 +0400 @@ -18,7 +18,7 @@ */ public class MIDataReadMemoryInfo extends MIInfo { - long addr; + String addr; long nextRow; long prevRow; long nextPage; @@ -33,7 +33,7 @@ parse(); } - public long getAddress() { + public String getAddress() { return addr; } @@ -96,7 +96,7 @@ if (var.equals("addr")) { //$NON-NLS-1$ try { - addr = Long.decode(str.trim()).longValue(); + addr = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("nr-bytes")) { //$NON-NLS-1$ diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIFrame.java 2004-09-17 09:18:11.000000000 +0400 @@ -16,7 +16,7 @@ public class MIFrame { int level; - long addr; + String addr; String func = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$ int line; @@ -42,7 +42,7 @@ return line; } - public long getAddress() { + public String getAddress() { return addr; } @@ -53,7 +53,7 @@ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("level=\"" + level + "\""); //$NON-NLS-1$//$NON-NLS-2$ - buffer.append(",addr=\"" + Long.toHexString(addr) + "\""); //$NON-NLS-1$//$NON-NLS-2$ + buffer.append(",addr=\"" + addr + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",func=\"" + func + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$ @@ -86,7 +86,7 @@ } } else if (var.equals("addr")) { //$NON-NLS-1$ try { - addr = Long.decode(str.trim()).longValue(); + addr = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("func")) { //$NON-NLS-1$ diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java 1970-01-01 03:00:00.000000000 +0300 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java 2004-09-17 09:18:11.000000000 +0400 @@ -0,0 +1,25 @@ +/* + * Created on Jun 7, 2004 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package org.eclipse.cdt.debug.mi.core.output; + +/** + * @author root + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class MIGDBShowAddressSizeInfo extends MIGDBShowInfo { + + public MIGDBShowAddressSizeInfo(MIOutput o) { + super(o); + } + + public int getAddressSize() + { + return Integer.parseInt(getValue()); + } +} diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java 2004-09-17 09:18:11.000000000 +0400 @@ -80,8 +80,8 @@ if (str.length() > 0) { // Pass the header int index = -1; - long from = 0; - long to = 0; + String from = ""; + String to = ""; boolean syms = false; String name = ""; //$NON-NLS-1$ @@ -102,16 +102,10 @@ } break; case 2 : // second column is "To" - try { - to = Long.decode(sub).longValue(); - } catch (NumberFormatException e) { - } + to = sub; break; case 3 : // first column is "From" - try { - from = Long.decode(sub).longValue(); - } catch (NumberFormatException e) { - } + from = sub; break; } } @@ -123,8 +117,8 @@ } void parseWinShared(String str, List aList) { - long from = 0; - long to = 0; + String from = ""; + String to = ""; boolean syms = true; int index = str.lastIndexOf(' '); @@ -134,10 +128,7 @@ if (!sub.startsWith("0x")) { //$NON-NLS-1$ sub = "0x" + sub; //$NON-NLS-1$ } - try { - from = Long.decode(sub).longValue(); - } catch (NumberFormatException e) { - } + from = sub; str = str.substring(0, index).trim(); } MIShared s = new MIShared(from, to, syms, str.trim()); diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIMemory.java 2004-09-17 09:18:11.000000000 +0400 @@ -14,7 +14,7 @@ * GDB/MI memory parsing. */ public class MIMemory { - long addr; + String addr; long [] data = new long[0]; String ascii = ""; //$NON-NLS-1$ @@ -22,7 +22,7 @@ parse(tuple); } - public long getAddress() { + public String getAddress() { return addr; } @@ -36,7 +36,7 @@ public String toSting() { StringBuffer buffer = new StringBuffer(); - buffer.append("addr=\"" + Long.toHexString(addr) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + buffer.append("addr=\"" + addr + "\""); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("data=["); //$NON-NLS-1$ for (int i = 0 ; i < data.length; i++) { if (i != 0) { @@ -63,7 +63,7 @@ if (var.equals("addr")) { //$NON-NLS-1$ try { - addr = Long.decode(str.trim()).longValue(); + addr = str.trim(); } catch (NumberFormatException e) { } } else if (var.equals("data")) { //$NON-NLS-1$ diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIShared.java 2004-09-17 09:18:11.000000000 +0400 @@ -16,23 +16,23 @@ */ public class MIShared { - long from; - long to; + String from; + String to; boolean isread; String name; - public MIShared (long start, long end, boolean read, String location) { + public MIShared (String start, String end, boolean read, String location) { from = start; to = end; isread = read; name = location; } - public long getFrom() { + public String getFrom() { return from; } - public long getTo() { + public String getTo() { return to; } diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java 2004-09-17 09:17:35.000000000 +0400 @@ -73,7 +73,7 @@ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { @@ -105,7 +105,7 @@ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, pid, null, cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { @@ -137,7 +137,7 @@ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, corefile.toFile(), cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java 2004-09-17 09:17:35.000000000 +0400 @@ -69,7 +69,7 @@ remote += ":"; //$NON-NLS-1$ remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$ String[] args = new String[] {"remote", remote}; //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), 0, args, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, 0, args, cwd, gdbinit); } else { MIPlugin plugin = MIPlugin.getDefault(); Preferences prefs = plugin.getPluginPreferences(); @@ -77,7 +77,7 @@ String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$ String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), -1, null, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, -1, null, cwd, gdbinit); ICDITarget[] targets = session.getTargets(); for (int i = 0; i < targets.length; ++i) { Target target = (Target)targets[i]; diff -NaurbB workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java --- workspace-orig/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 2004-09-17 08:43:07.000000000 +0400 +++ workspace/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java 2004-09-17 09:17:35.000000000 +0400 @@ -21,6 +21,10 @@ import java.util.MissingResourceException; import java.util.ResourceBundle; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.IAddressFactory; +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.command.CLICommand; @@ -30,6 +34,8 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.spawner.ProcessFactory; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; import org.osgi.framework.BundleContext; @@ -113,7 +119,7 @@ * @return ICDISession * @throws MIException */ - public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit) throws IOException, MIException { PTY pty = null; boolean failed = false; @@ -156,7 +162,7 @@ * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit, PTY pty) throws IOException, MIException { + public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit, PTY pty) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -170,13 +176,13 @@ if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } } else { if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } } @@ -206,7 +212,7 @@ // If an exception is thrown that means ok // we did not attach to any target. } - return new Session(session, false); + return new Session(session, getAddressFactory(program), false); } /** @@ -216,7 +222,7 @@ * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, File program, File core, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, IFile program, File core, File cwd, String gdbinit) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -229,7 +235,7 @@ if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } Process pgdb = getGDBProcess(args); MISession session; @@ -239,7 +245,7 @@ pgdb.destroy(); throw e; } - return new Session(session); + return new Session(session, getAddressFactory(program)); } /** @@ -249,7 +255,7 @@ * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, File program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, IFile program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -262,7 +268,7 @@ if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } Process pgdb = getGDBProcess(args); MISession session; @@ -298,7 +304,7 @@ //@@@ We have to manually set the suspended state when we attach session.getMIInferior().setSuspended(); session.getMIInferior().update(); - return new Session(session, true); + return new Session(session, getAddressFactory(program), true); } /** @@ -423,6 +429,16 @@ getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT); } + protected IAddressFactory getAddressFactory(IFile exe) + { + ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( exe ); + if ( cFile instanceof IBinary ) + { + return ((IBinary)cFile).getAddressFactory(); + } + return null; + } + /* (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#shutdown() */