View | Details | Raw Unified | Return to bug 69908 | Differences between
and this patch

Collapse All | Expand All

(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/Addr32Factory.java (+41 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
14
/*
15
 */
16
final public class Addr32Factory implements IAddressFactory
17
{
18
	
19
	final public  IAddress getZero() 
20
	{
21
		return Addr32.ZERO; 
22
	}
23
24
	final public IAddress getMax() 
25
	{
26
		return Addr32.MAX; 
27
	}
28
	
29
	final public IAddress createAddress(String addr) 
30
	{
31
		IAddress address=new Addr32(addr);
32
		return address; 
33
	}
34
	
35
	final public IAddress createAddress(String addr, int radix) 
36
	{
37
		IAddress address=new Addr32(addr, radix);
38
		return address; 
39
	}
40
	
41
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/Addr32.java (+141 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
import java.math.BigInteger;
14
15
/*
16
 */
17
final public class Addr32 implements IAddress
18
{
19
	public static final Addr32 ZERO=new Addr32(0);
20
	public static final Addr32 MAX=new Addr32(0xffffffffL);
21
22
	public static final BigInteger MAX_OFFSET = BigInteger.valueOf(0xffffffffL);
23
	
24
	public static final int BYTES_NUM = 4;
25
	public static final int DIGITS_NUM = BYTES_NUM * 2;
26
	public static final int CHARS_NUM = DIGITS_NUM + 2; 
27
		
28
	private long address;
29
30
	/*
31
	 * addrBytes should be 4 bytes length
32
	 */
33
	public Addr32(byte [] addrBytes)
34
	{
35
		/*We should mask out sign bits to have correct value*/
36
		this.address = ( ( ((long)addrBytes[0]) << 24 ) & 0xFF000000L) + 
37
                       ( ( ((long)addrBytes[1]) << 16 ) & 0x00FF0000L) +
38
                       ( ( ((long)addrBytes[2]) << 8  ) & 0x0000FF00L) + 
39
                       (   ((long)addrBytes[3])         & 0x000000FFL);
40
	}
41
42
	public Addr32(long rawaddress) 
43
	{
44
		this.address=rawaddress;
45
	}
46
47
	public Addr32(String addr) 
48
	{
49
		addr = addr.toLowerCase();
50
		if ( addr.startsWith( "0x" ) )
51
		{		
52
			this.address = Long.parseLong(addr.substring(2), 16);
53
		}
54
		else
55
		{
56
			this.address = Long.parseLong(addr, 10);
57
		}
58
	}
59
60
	public Addr32(String addr, int radix) 
61
	{
62
		this.address=Long.parseLong(addr, radix);
63
	}
64
65
	final public IAddress add(BigInteger offset) 
66
	{
67
		return new Addr32(this.address +  offset.longValue());
68
	}
69
70
	final public BigInteger getMaxOffset()
71
	{
72
		return MAX_OFFSET;
73
	}
74
75
	final public BigInteger distance(IAddress other)
76
	{
77
		return BigInteger.valueOf(address - ((Addr32)other).address);
78
	}
79
	
80
	final public int compareTo(IAddress addr) 
81
	{
82
		if (address > ((Addr32)addr).address)
83
		{ 
84
			return 1;
85
		}	
86
		if (address < ((Addr32)addr).address)
87
		{ 
88
			return -1;
89
		}	
90
		return 0;
91
	}
92
93
	final public boolean isMax() 
94
	{
95
		return address == MAX.address;
96
	}
97
98
	final public boolean isZero() 
99
	{
100
		return address == ZERO.address;
101
	}
102
103
	final public String toString() 
104
	{
105
		return toString(10);		
106
	}
107
108
	final public String toString(int radix) 
109
	{
110
		return Long.toString(address, radix);
111
	}
112
113
	final public boolean equals(IAddress x) 
114
	{
115
		if (x == this)
116
			return true;
117
		if (!(x instanceof Addr32))
118
			return false;
119
		return this.address == ((Addr32)x).address;
120
	}
121
122
	final public String toHexAddressString( )
123
	{
124
		String addressString = Long.toString(address,16);
125
		StringBuffer sb = new StringBuffer( CHARS_NUM  );
126
        int count = DIGITS_NUM - addressString.length();
127
		sb.append( "0x" );
128
		for ( int i = 0; i < count ; ++i ) 
129
		{
130
			sb.append( '0' );
131
		}
132
		sb.append( addressString );
133
		return sb.toString();
134
	}
135
136
	final public int getCharsNum()
137
	{
138
		return CHARS_NUM;
139
	}
140
	
141
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/Addr64Factory.java (+39 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
14
/*
15
 */
16
final public class Addr64Factory implements IAddressFactory{
17
18
    final public  IAddress getZero() 
19
	{
20
		return Addr64.ZERO; 
21
	}
22
23
    final public IAddress getMax() 
24
	{
25
		return Addr64.MAX; 
26
	}
27
	
28
    final public IAddress createAddress(String addr) 
29
	{
30
		IAddress address=new Addr64(addr);
31
		return address; 
32
	}
33
	
34
    final public IAddress createAddress(String addr, int radix) 
35
	{
36
		IAddress address=new Addr64(addr, radix);
37
		return address; 
38
	}
39
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/Addr64.java (+128 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
import java.math.BigInteger;
14
15
/*
16
 */
17
final public class Addr64 implements IAddress 
18
{
19
	public static final Addr64 ZERO=new Addr64("0");
20
	public static final Addr64 MAX=new Addr64("ffffffffffffffff",16);
21
22
	public static final BigInteger MAX_OFFSET = new BigInteger("ffffffffffffffff",16);
23
	
24
    public static final int BYTES_NUM = 8;
25
    public static final int DIGITS_NUM = BYTES_NUM * 2;
26
	public static final int CHARS_NUM = DIGITS_NUM + 2; 
27
	
28
	private BigInteger address;
29
30
	public Addr64(byte [] addrBytes)
31
	{
32
		if( addrBytes.length != 8)
33
			throw(new NumberFormatException("Invalid address array"));
34
		this.address = new BigInteger(1, addrBytes);
35
	}
36
	
37
	public Addr64(BigInteger rawaddress) 
38
	{
39
		this.address=rawaddress;		
40
	}	
41
	
42
	public Addr64(String addr) 
43
	{
44
		addr = addr.toLowerCase();
45
		if ( addr.startsWith( "0x" ) )
46
		{		
47
			this.address = new BigInteger(addr.substring(2), 16);
48
		}
49
		else
50
		{
51
			this.address = new BigInteger(addr, 10);
52
		}
53
	}
54
	
55
	public Addr64(String addr, int radix) 
56
	{
57
		this.address=new BigInteger(addr, radix);
58
	}
59
60
	final public IAddress add(BigInteger offset) 
61
	{
62
		return new Addr64(this.address.add(offset));
63
	}
64
65
	final public BigInteger getMaxOffset()
66
	{
67
		return MAX_OFFSET;
68
	}
69
70
	final public BigInteger distance(IAddress other)
71
	{
72
		return address.add(((Addr64)other).address.negate());
73
	}
74
75
	final public boolean isMax() 
76
	{
77
		return address.equals(MAX);
78
	}
79
80
	final public boolean isZero() 
81
	{
82
		return address.equals(ZERO);
83
	}
84
85
	final public int compareTo(IAddress addr) 
86
	{
87
		return this.address.compareTo(((Addr64)addr).address);
88
	}
89
90
	final public boolean equals(IAddress x) 
91
	{
92
		if (x == this)
93
			return true;
94
		if (!(x instanceof Addr64))
95
			return false;
96
		return this.address.equals(((Addr64)x).address);
97
	}
98
99
	final public String toString() 
100
	{
101
		return toString(10);		
102
	}
103
	
104
	final public String toString(int radix) 
105
	{
106
		return address.toString(radix);
107
	}
108
	
109
	final public String toHexAddressString( )
110
	{
111
		String addressString = address.toString(16);
112
		StringBuffer sb = new StringBuffer( CHARS_NUM  );
113
        int count = DIGITS_NUM - addressString.length();
114
		sb.append( "0x" );
115
		for ( int i = 0; i < count; ++i ) 
116
		{
117
			sb.append( '0' );
118
		}
119
		sb.append( addressString );
120
		return sb.toString();
121
	}
122
	
123
	final public int getCharsNum()
124
	{
125
		return CHARS_NUM;
126
	}
127
}
128
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/IAddressFactory.java (+51 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
14
/*
15
 * This inteface serves as an address factory. If you need to 
16
 * implement your own addresses, you should extend this.
17
 * 
18
 * Please see Addr32Factory and Addr64Factory to see how it can be implemented.
19
 */
20
public interface IAddressFactory 
21
{
22
	/*
23
	 * Returns zero address, i.e. minimal possible address
24
	 */
25
	IAddress getZero();
26
	/*
27
	 * Returns maximal address.
28
	 */
29
	IAddress getMax();
30
	/*
31
	 * Creates address from string representation. 
32
	 * 
33
	 * 1. This method should be able to create address from hex 
34
	 *    address string (string produced with 
35
	 *    IAddress.toHexAddressString() method). 
36
	 * 2. Method should be case insensetive
37
	 * 3. Method should be able to create address from decimal address 
38
	 *    representation
39
	 * 
40
	 *   Please see Addr32Factory.createAddress() for reference implementation.
41
	 */
42
	IAddress createAddress(String addr);
43
	/*
44
	 * Creates address from string with given radix. 
45
	 * 
46
	 * Given string should not contain any prefixes or sign numbers.
47
	 * 
48
	 * Method should be case insensetive
49
	 */
50
	IAddress createAddress(String addr, int radix);
51
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/IAddress.java (+82 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 Intel Corporation and others.
3
 * All rights reserved. This program and the accompanying materials 
4
 * are made available under the terms of the Common Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/cpl-v10.html
7
 * 
8
 * Contributors:
9
 *     Intel Corporation - Initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.cdt.core;
12
13
import java.math.BigInteger;
14
15
/*
16
 * Represents C/C++ address in CDT. All implementors of this inteface should be 
17
 * immutable, i.e. all methods should not modify objects, they should return 
18
 * new object.
19
 * 
20
 * Please see Addr32 and Addr64 classes to see how this interface should 
21
 * be extended
22
 */
23
public interface IAddress
24
{
25
	/*
26
	 * Return adds offset to address and returns new address object 
27
	 * which is the result  
28
	 */
29
	IAddress add(BigInteger offset);
30
	/*
31
	 * Returns maximal offset possible for address. The offset 
32
	 * should be Identicall for all addresses of given class. 
33
	 */
34
	BigInteger getMaxOffset();
35
	/*
36
	 * Returns distance between two addresses. Distance may be positive or negative
37
	 */
38
	BigInteger distance(IAddress other);
39
	/*
40
	 * Compares two addresses.
41
	 * 
42
	 * Returns:
43
	 *        -1 if this <  addr
44
	 *         0 if this == addr
45
	 *         1 if this >  addr
46
	 */
47
	int compareTo(IAddress addr);
48
	/*
49
	 * Returns true if addresses are equal
50
	 */
51
	boolean equals(IAddress addr);
52
    /*
53
     * Return true if address is zero, i.e. minimal possible
54
     */
55
	boolean isZero();
56
    /*
57
     * Return true if address is maximal, i.e. maximal possible
58
     */
59
	boolean isMax();
60
	
61
	/*
62
	 * Converts address to string as an unsigned number with given radix
63
	 */
64
	String toString(int radix);
65
	/*
66
	 * Identical to toString(10)
67
	 */
68
	String toString();
69
	/*
70
	 * Converts address to the hex representation with '0x' prefix and 
71
	 * with all leading zeros. The length of returned string should be 
72
	 * the same for all addresses of given class. I.e. 10 for 32-bit 
73
	 * addresses and 18 for 64-bit addresses
74
	 */
75
	String toHexAddressString();
76
77
	/*
78
	 * Returns amount of symbols in hex representation. Is identical to 
79
	 * toHexAddressString().length(). It is present for perfomance purpose.
80
	 */
81
	int getCharsNum();
82
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/IBinaryParser.java (-2 / +3 lines)
Lines 121-127 Link Here
121
		 * @param addr
121
		 * @param addr
122
		 * @return ISymbol
122
		 * @return ISymbol
123
		 */
123
		 */
124
		ISymbol getSymbol(long addr);
124
		ISymbol getSymbol(IAddress addr);
125
125
126
		/**
126
		/**
127
		 * The name of the object
127
		 * The name of the object
Lines 129-134 Link Here
129
		 */
129
		 */
130
		String getName();
130
		String getName();
131
131
132
		IAddressFactory getAddressFactory();
132
	}
133
	}
133
134
134
	/**
135
	/**
Lines 176-182 Link Here
176
		 * Address of the symbol
177
		 * Address of the symbol
177
		 * @return
178
		 * @return
178
		 */
179
		 */
179
		long getAddress();
180
		IAddress getAddress();
180
181
181
		/**
182
		/**
182
		 * Size of the symbol.
183
		 * Size of the symbol.
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/model/IBinaryElement.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.core.model;
11
package org.eclipse.cdt.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
14
13
15
14
/**
16
/**
15
 */
17
 */
Lines 22-28 Link Here
22
 	 * @exception CModelException if this element does not have address
24
 	 * @exception CModelException if this element does not have address
23
 	 * information.
25
 	 * information.
24
 	 */
26
 	 */
25
 	long getAddress() throws CModelException;
27
 	IAddress getAddress() throws CModelException;
26
28
27
	/**
29
	/**
28
 	 * Returns the binary object the element belongs to.
30
 	 * Returns the binary object the element belongs to.
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/core/model/IBinary.java (+4 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.core.model;
11
package org.eclipse.cdt.core.model;
12
12
13
import org.eclipse.cdt.core.IAddressFactory;
14
13
15
14
/**
16
/**
15
 * Represents a Binary file, for example an ELF excutable.
17
 * Represents a Binary file, for example an ELF excutable.
Lines 43-46 Link Here
43
	
45
	
44
	public boolean isLittleEndian();
46
	public boolean isLittleEndian();
45
47
48
	public IAddressFactory getAddressFactory();
49
46
}
50
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/internal/core/model/BinaryElement.java (-3 / +4 lines)
Lines 7-12 Link Here
7
import java.io.IOException;
7
import java.io.IOException;
8
import java.util.Map;
8
import java.util.Map;
9
9
10
import org.eclipse.cdt.core.IAddress;
10
import org.eclipse.cdt.core.model.CModelException;
11
import org.eclipse.cdt.core.model.CModelException;
11
import org.eclipse.cdt.core.model.IBinary;
12
import org.eclipse.cdt.core.model.IBinary;
12
import org.eclipse.cdt.core.model.IBinaryElement;
13
import org.eclipse.cdt.core.model.IBinaryElement;
Lines 27-35 Link Here
27
 */
28
 */
28
public class BinaryElement extends CElement implements IBinaryElement, ISourceManipulation, ISourceReference {
29
public class BinaryElement extends CElement implements IBinaryElement, ISourceManipulation, ISourceReference {
29
30
30
	long addr;
31
	IAddress addr;
31
32
32
	public BinaryElement(ICElement parent, String name, int type, long a) {
33
	public BinaryElement(ICElement parent, String name, int type, IAddress a) {
33
		super(parent, name, type);
34
		super(parent, name, type);
34
		addr = a;
35
		addr = a;
35
	}
36
	}
Lines 153-159 Link Here
153
	/* (non-Javadoc)
154
	/* (non-Javadoc)
154
	 * @see org.eclipse.cdt.core.model.IBinaryElement#getAddress()
155
	 * @see org.eclipse.cdt.core.model.IBinaryElement#getAddress()
155
	 */
156
	 */
156
	public long getAddress() throws CModelException {
157
	public IAddress getAddress() throws CModelException {
157
		return addr;
158
		return addr;
158
	}
159
	}
159
160
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/internal/core/model/BinaryFunction.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.internal.core.model;
12
package org.eclipse.cdt.internal.core.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.core.model.IBinaryFunction;
15
import org.eclipse.cdt.core.model.IBinaryFunction;
15
import org.eclipse.cdt.core.model.ICElement;
16
import org.eclipse.cdt.core.model.ICElement;
16
17
Lines 18-24 Link Here
18
 */
19
 */
19
public class BinaryFunction extends BinaryElement implements IBinaryFunction {
20
public class BinaryFunction extends BinaryElement implements IBinaryFunction {
20
21
21
	public BinaryFunction(ICElement parent, String name, long a) {
22
	public BinaryFunction(ICElement parent, String name, IAddress a) {
22
		super(parent, name, ICElement.C_FUNCTION, a);
23
		super(parent, name, ICElement.C_FUNCTION, a);
23
	}
24
	}
24
25
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/internal/core/model/Binary.java (+12 lines)
Lines 17-22 Link Here
17
import java.util.HashMap;
17
import java.util.HashMap;
18
import java.util.Map;
18
import java.util.Map;
19
19
20
import org.eclipse.cdt.core.IAddressFactory;
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
21
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
21
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
22
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
22
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
23
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
Lines 43-48 Link Here
43
	private long longBSS;
44
	private long longBSS;
44
	private String endian;
45
	private String endian;
45
	private String soname;
46
	private String soname;
47
	private IAddressFactory addressFactory;
46
	
48
	
47
	private long fLastModification;
49
	private long fLastModification;
48
50
Lines 172-177 Link Here
172
		return binaryObject;
174
		return binaryObject;
173
	}
175
	}
174
	
176
	
177
	public IAddressFactory getAddressFactory() {
178
		if (isObject() || isExecutable() || isSharedLib() || isCore()) {
179
			if (addressFactory == null || hasChanged()) {
180
				addressFactory = getBinaryObject().getAddressFactory();
181
			}
182
		}
183
		return addressFactory;
184
	}
185
	
175
	protected int getType() {
186
	protected int getType() {
176
		IBinaryObject obj = getBinaryObject();
187
		IBinaryObject obj = getBinaryObject();
177
		if (obj != null && (fBinType == 0 || hasChanged())) {
188
		if (obj != null && (fBinType == 0 || hasChanged())) {
Lines 193-198 Link Here
193
			longData = -1;
204
			longData = -1;
194
			longText = -1;
205
			longText = -1;
195
			soname = null;
206
			soname = null;
207
			addressFactory = null;
196
		}
208
		}
197
		return changed;
209
		return changed;
198
	}
210
	}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/internal/core/model/BinaryModule.java (-2 / +3 lines)
Lines 13-18 Link Here
13
13
14
import java.util.Map;
14
import java.util.Map;
15
15
16
import org.eclipse.cdt.core.IAddress;
16
import org.eclipse.cdt.core.model.CModelException;
17
import org.eclipse.cdt.core.model.CModelException;
17
import org.eclipse.cdt.core.model.IBinary;
18
import org.eclipse.cdt.core.model.IBinary;
18
import org.eclipse.cdt.core.model.IBinaryElement;
19
import org.eclipse.cdt.core.model.IBinaryElement;
Lines 47-54 Link Here
47
	/* (non-Javadoc)
48
	/* (non-Javadoc)
48
	 * @see org.eclipse.cdt.core.model.IBinaryElement#getAddress()
49
	 * @see org.eclipse.cdt.core.model.IBinaryElement#getAddress()
49
	 */
50
	 */
50
	public long getAddress() throws CModelException {
51
	public IAddress getAddress() throws CModelException {
51
		return 0;
52
		return null; 
52
	}
53
	}
53
54
54
	/* (non-Javadoc)
55
	/* (non-Javadoc)
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/internal/core/model/BinaryVariable.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.internal.core.model;
11
package org.eclipse.cdt.internal.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.core.model.ICElement;
14
import org.eclipse.cdt.core.model.ICElement;
14
import org.eclipse.cdt.core.model.IVariable;
15
import org.eclipse.cdt.core.model.IVariable;
15
16
Lines 18-24 Link Here
18
 */
19
 */
19
public class BinaryVariable extends BinaryElement implements IVariable {
20
public class BinaryVariable extends BinaryElement implements IVariable {
20
21
21
	public BinaryVariable(ICElement parent, String name, long a) {
22
	public BinaryVariable(ICElement parent, String name, IAddress a) {
22
		super(parent, name, ICElement.C_VARIABLE, a);
23
		super(parent, name, ICElement.C_VARIABLE, a);
23
	}
24
	}
24
25
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/Addr2line.java (-7 / +11 lines)
Lines 15-21 Link Here
15
import java.io.IOException;
15
import java.io.IOException;
16
import java.io.InputStreamReader;
16
import java.io.InputStreamReader;
17
import java.io.OutputStreamWriter;
17
import java.io.OutputStreamWriter;
18
import java.math.BigInteger;
18
19
20
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.utils.spawner.ProcessFactory;
21
import org.eclipse.cdt.utils.spawner.ProcessFactory;
20
22
21
public class Addr2line {
23
public class Addr2line {
Lines 61-73 Link Here
61
		}
63
		}
62
	}
64
	}
63
65
64
	public String getLine(long address) throws IOException {
66
	public String getLine(IAddress address) throws IOException {
65
		getOutput(Integer.toHexString((int)address));
67
		getOutput(address.toString(16));
66
		return lastline;
68
		return lastline;
67
	}
69
	}
68
70
69
	public String getFunction(long address) throws IOException {
71
	public String getFunction(IAddress address) throws IOException {
70
		getOutput(Integer.toHexString((int)address));
72
		getOutput(address.toString(16));
71
		return lastsymbol;
73
		return lastsymbol;
72
	}	
74
	}	
73
75
Lines 78-84 Link Here
78
	 *  main
80
	 *  main
79
	 *  hello.c:39
81
	 *  hello.c:39
80
	 */
82
	 */
81
	public String getFileName(long address) throws IOException {
83
	public String getFileName(IAddress address) throws IOException {
82
		String filename = null;
84
		String filename = null;
83
		String line = getLine(address);
85
		String line = getLine(address);
84
		int index1, index2;
86
		int index1, index2;
Lines 103-114 Link Here
103
	 *  main
105
	 *  main
104
	 *  hello.c:39
106
	 *  hello.c:39
105
	 */
107
	 */
106
	public int getLineNumber(long address) throws IOException {
108
	public int getLineNumber(IAddress address) throws IOException {
107
		// We try to get the nearest match
109
		// We try to get the nearest match
108
		// since the symbol may not exactly align with debug info.
110
		// since the symbol may not exactly align with debug info.
109
		// In C line number 0 is invalid, line starts at 1 for file, we use
111
		// In C line number 0 is invalid, line starts at 1 for file, we use
110
		// this for validation.
112
		// this for validation.
111
		for (int i = 0; i <= 20; i += 4, address += i) {
113
		
114
		//IPF_TODO: check 
115
		for (int i = 0; i <= 20; i += 4, address = address.add(BigInteger.valueOf(i))) {
112
			String line = getLine(address);
116
			String line = getLine(address);
113
			if (line != null) {
117
			if (line != null) {
114
				int colon = line.lastIndexOf(':');
118
				int colon = line.lastIndexOf(':');
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/BinaryObjectAdapter.java (-4 / +15 lines)
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.utils;
11
package org.eclipse.cdt.utils;
12
12
13
import java.math.BigInteger;
13
import java.util.Arrays;
14
import java.util.Arrays;
14
15
16
import org.eclipse.cdt.core.IAddress;
17
import org.eclipse.cdt.core.IAddressFactory;
15
import org.eclipse.cdt.core.IBinaryParser;
18
import org.eclipse.cdt.core.IBinaryParser;
16
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
19
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
17
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
Lines 35-40 Link Here
35
		public String soname;
38
		public String soname;
36
		public String[] needed;
39
		public String[] needed;
37
		public String cpu;
40
		public String cpu;
41
		public IAddressFactory addressFactory;
38
42
39
		public BinaryObjectInfo() {
43
		public BinaryObjectInfo() {
40
			cpu = soname = ""; //$NON-NLS-1$
44
			cpu = soname = ""; //$NON-NLS-1$
Lines 49-57 Link Here
49
	/* (non-Javadoc)
53
	/* (non-Javadoc)
50
	 * @see org.eclipse.cdt.core.IBinaryParser.IBinaryObject#getSymbol(long)
54
	 * @see org.eclipse.cdt.core.IBinaryParser.IBinaryObject#getSymbol(long)
51
	 */
55
	 */
52
	public ISymbol getSymbol(long addr) {
56
	public ISymbol getSymbol(IAddress addr) {
53
		ISymbol[] syms = getSymbols();
57
		ISymbol[] syms = getSymbols();
54
		int insertion = Arrays.binarySearch(syms, new Long(addr));
58
		int insertion = Arrays.binarySearch(syms, addr);
55
		if (insertion >= 0) {
59
		if (insertion >= 0) {
56
			return syms[insertion];
60
			return syms[insertion];
57
		}
61
		}
Lines 60-66 Link Here
60
		}
64
		}
61
		insertion = -insertion - 1;
65
		insertion = -insertion - 1;
62
		ISymbol symbol =  syms[insertion - 1];
66
		ISymbol symbol =  syms[insertion - 1];
63
		if (addr < (symbol.getAddress() + symbol.getSize())) {
67
		if (addr.compareTo(symbol.getAddress().add(BigInteger.valueOf(symbol.getSize()))) < 0) {
64
			return syms[insertion - 1];
68
			return syms[insertion - 1];
65
		}
69
		}
66
		return null;
70
		return null;
Lines 153-159 Link Here
153
		}
157
		}
154
		return ""; //$NON-NLS-1$
158
		return ""; //$NON-NLS-1$
155
	}
159
	}
156
160
	public IAddressFactory getAddressFactory()
161
	{
162
		BinaryObjectInfo info = getBinaryObjectInfo();
163
		if (info != null) {
164
			return info.addressFactory;
165
		}
166
		return null; //$NON-NLS-1$
167
	}
157
	/**
168
	/**
158
	 * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryObject#getName()
169
	 * @see org.eclipse.cdt.core.model.IBinaryParser.IBinaryObject#getName()
159
	 */
170
	 */
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/coff/parser/ARMember.java (-1 / +2 lines)
Lines 15-20 Link Here
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 77-83 Link Here
77
					continue;
78
					continue;
78
				}
79
				}
79
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
80
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
80
				list.add(new Symbol(this, name, type, peSyms[i].n_value, 1));
81
				list.add(new Symbol(this, name, type, new Addr32(peSyms[i].n_value), 1));
81
			}
82
			}
82
		}
83
		}
83
	}
84
	}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/coff/parser/CygwinPEBinaryObject.java (-2 / +5 lines)
Lines 11-18 Link Here
11
import java.io.ByteArrayInputStream;
11
import java.io.ByteArrayInputStream;
12
import java.io.IOException;
12
import java.io.IOException;
13
import java.io.InputStream;
13
import java.io.InputStream;
14
import java.math.BigInteger;
14
import java.util.List;
15
import java.util.List;
15
16
17
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.IAddress;
16
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
19
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
17
import org.eclipse.cdt.utils.Addr2line;
20
import org.eclipse.cdt.utils.Addr2line;
18
import org.eclipse.cdt.utils.CPPFilt;
21
import org.eclipse.cdt.utils.CPPFilt;
Lines 147-153 Link Here
147
					continue;
150
					continue;
148
				}
151
				}
149
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
152
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
150
				int addr = peSyms[i].n_value;
153
				IAddress addr = new Addr32(peSyms[i].n_value);
151
				int size = 4;
154
				int size = 4;
152
				if (cppfilt != null) {
155
				if (cppfilt != null) {
153
					try {
156
					try {
Lines 172-178 Link Here
172
						}
175
						}
173
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
176
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
174
						int startLine = addr2line.getLineNumber(addr);
177
						int startLine = addr2line.getLineNumber(addr);
175
						int endLine = addr2line.getLineNumber(addr + size - 1);
178
						int endLine = addr2line.getLineNumber(addr.add(BigInteger.valueOf(size - 1)));
176
						list.add(new CygwinSymbol(this, name, type, addr, size, file, startLine, endLine));
179
						list.add(new CygwinSymbol(this, name, type, addr, size, file, startLine, endLine));
177
					} catch (IOException e) {
180
					} catch (IOException e) {
178
						addr2line = null;
181
						addr2line = null;
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/coff/parser/CygwinSymbol.java (-3 / +5 lines)
Lines 7-13 Link Here
7
package org.eclipse.cdt.utils.coff.parser;
7
package org.eclipse.cdt.utils.coff.parser;
8
8
9
import java.io.IOException;
9
import java.io.IOException;
10
import java.math.BigInteger;
10
11
12
import org.eclipse.cdt.core.IAddress;
11
import org.eclipse.cdt.utils.Addr2line;
13
import org.eclipse.cdt.utils.Addr2line;
12
import org.eclipse.cdt.utils.Symbol;
14
import org.eclipse.cdt.utils.Symbol;
13
import org.eclipse.core.runtime.IPath;
15
import org.eclipse.core.runtime.IPath;
Lines 31-37 Link Here
31
	 * @param startLine
33
	 * @param startLine
32
	 * @param endLine
34
	 * @param endLine
33
	 */
35
	 */
34
	public CygwinSymbol(CygwinPEBinaryObject binary, String name, int type, long addr, long size, IPath sourceFile, int startLine,
36
	public CygwinSymbol(CygwinPEBinaryObject binary, String name, int type, IAddress addr, long size, IPath sourceFile, int startLine,
35
			int endLine) {
37
			int endLine) {
36
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
38
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
37
	}
39
	}
Lines 43-49 Link Here
43
	 * @param addr
45
	 * @param addr
44
	 * @param size
46
	 * @param size
45
	 */
47
	 */
46
	public CygwinSymbol(CygwinPEBinaryObject binary, String name, int type, long addr, long size) {
48
	public CygwinSymbol(CygwinPEBinaryObject binary, String name, int type, IAddress addr, long size) {
47
		super(binary, name, type, addr, size);
49
		super(binary, name, type, addr, size);
48
	}
50
	}
49
51
Lines 55-61 Link Here
55
		Addr2line addr2line = ((CygwinPEBinaryObject)binary).getAddr2line(true);
57
		Addr2line addr2line = ((CygwinPEBinaryObject)binary).getAddr2line(true);
56
		if (addr2line != null) {
58
		if (addr2line != null) {
57
			try {
59
			try {
58
				return addr2line.getLineNumber(getAddress() + offset);
60
				return addr2line.getLineNumber(getAddress().add(BigInteger.valueOf(offset)));
59
			} catch (IOException e) {
61
			} catch (IOException e) {
60
				// ignore
62
				// ignore
61
			}
63
			}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/coff/parser/PEBinaryObject.java (-1 / +3 lines)
Lines 15-20 Link Here
15
import java.util.Arrays;
15
import java.util.Arrays;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.IBinaryParser;
19
import org.eclipse.cdt.core.IBinaryParser;
19
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 107-112 Link Here
107
		info.isLittleEndian = attribute.isLittleEndian();
108
		info.isLittleEndian = attribute.isLittleEndian();
108
		info.hasDebug = attribute.hasDebug();
109
		info.hasDebug = attribute.hasDebug();
109
		info.cpu = attribute.getCPU();
110
		info.cpu = attribute.getCPU();
111
		info.addressFactory = attribute.getAddressFactory(); 
110
	}
112
	}
111
113
112
	protected void loadSymbols(PE pe) throws IOException {
114
	protected void loadSymbols(PE pe) throws IOException {
Lines 129-135 Link Here
129
					continue;
131
					continue;
130
				}
132
				}
131
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
133
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
132
				list.add(new Symbol(this, name, type, peSyms[i].n_value, 1));
134
				list.add(new Symbol(this, name, type, new Addr32(peSyms[i].n_value), 1));
133
			}
135
			}
134
		}
136
		}
135
	}
137
	}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/coff/PE.java (+10 lines)
Lines 14-20 Link Here
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.io.RandomAccessFile;
15
import java.io.RandomAccessFile;
16
16
17
import org.eclipse.cdt.core.Addr32Factory;
17
import org.eclipse.cdt.core.CCorePlugin;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.IAddressFactory;
18
import org.eclipse.cdt.utils.coff.Coff.FileHeader;
20
import org.eclipse.cdt.utils.coff.Coff.FileHeader;
19
import org.eclipse.cdt.utils.coff.Coff.OptionalHeader;
21
import org.eclipse.cdt.utils.coff.Coff.OptionalHeader;
20
import org.eclipse.cdt.utils.coff.Coff.SectionHeader;
22
import org.eclipse.cdt.utils.coff.Coff.SectionHeader;
Lines 84-89 Link Here
84
		int word;
86
		int word;
85
		boolean bDebug;
87
		boolean bDebug;
86
		boolean isle;
88
		boolean isle;
89
		IAddressFactory addrFactory;
87
90
88
		public String getCPU() {
91
		public String getCPU() {
89
			return cpu;
92
			return cpu;
Lines 104-109 Link Here
104
		public int getWord() {
107
		public int getWord() {
105
			return word;
108
			return word;
106
		}
109
		}
110
		
111
		public IAddressFactory getAddressFactory(){
112
			return addrFactory;
113
		}
114
		
107
	}
115
	}
108
116
109
	/**
117
	/**
Lines 462-467 Link Here
462
		if ((filhdr.f_flags & PEConstants.IMAGE_FILE_32BIT_MACHINE) != 0) {
470
		if ((filhdr.f_flags & PEConstants.IMAGE_FILE_32BIT_MACHINE) != 0) {
463
			attrib.word = 32;
471
			attrib.word = 32;
464
		}
472
		}
473
		
474
		attrib.addrFactory = new Addr32Factory(); 
465
		return attrib;
475
		return attrib;
466
	}
476
	}
467
477
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/elf/Elf.java (-34 / +264 lines)
Lines 17-26 Link Here
17
import java.util.Arrays;
17
import java.util.Arrays;
18
import java.util.Comparator;
18
import java.util.Comparator;
19
19
20
import org.eclipse.cdt.core.Addr32;
21
import org.eclipse.cdt.core.Addr32Factory;
22
import org.eclipse.cdt.core.Addr64;
23
import org.eclipse.cdt.core.Addr64Factory;
20
import org.eclipse.cdt.core.CCorePlugin;
24
import org.eclipse.cdt.core.CCorePlugin;
25
import org.eclipse.cdt.core.IAddress;
26
import org.eclipse.cdt.core.IAddressFactory;
21
27
22
// test checkin
28
// test checkin
23
public class Elf {
29
public class Elf {
30
	public final static int ELF32_ADDR_SIZE = 4;
31
	public final static int ELF32_OFF_SIZE = 4;
32
	public final static int ELF64_ADDR_SIZE = 8;
33
	public final static int ELF64_OFF_SIZE = 8;
34
	
24
	protected ERandomAccessFile efile;		
35
	protected ERandomAccessFile efile;		
25
36
26
	protected ELFhdr ehdr;
37
	protected ELFhdr ehdr;
Lines 52-58 Link Here
52
63
53
		/* e_ident[EI_CLASS] */
64
		/* e_ident[EI_CLASS] */
54
		public final static int ELFCLASSNONE = 0;
65
		public final static int ELFCLASSNONE = 0;
55
		public final static int ELCLASS32 = 1;
66
		public final static int ELFCLASS32 = 1;
56
		public final static int ELFCLASS64 = 2;
67
		public final static int ELFCLASS64 = 2;
57
68
58
		/* e_ident[EI_DATA] */
69
		/* e_ident[EI_DATA] */
Lines 117-123 Link Here
117
		public int 	e_type; 				/* file type (Elf32_Half) */
128
		public int 	e_type; 				/* file type (Elf32_Half) */
118
		public int 	e_machine;				/* machine type (Elf32_Half) */
129
		public int 	e_machine;				/* machine type (Elf32_Half) */
119
		public long		e_version;				/* version number (Elf32_Word) */
130
		public long		e_version;				/* version number (Elf32_Word) */
120
		public long		e_entry;        		/* entry point (Elf32_Addr)*/
131
		public IAddress		e_entry;        		/* entry point (Elf32_Addr)*/
121
	    public long		e_phoff;				/* Program hdr offset (Elf32_Off)*/
132
	    public long		e_phoff;				/* Program hdr offset (Elf32_Off)*/
122
		public long		e_shoff;				/* Section hdr offset (Elf32_Off)*/
133
		public long		e_shoff;				/* Section hdr offset (Elf32_Off)*/
123
	    public long		e_flags;				/* Processor flags (Elf32_Word)*/
134
	    public long		e_flags;				/* Processor flags (Elf32_Word)*/
Lines 138-146 Link Here
138
			e_type = efile.readShortE();
149
			e_type = efile.readShortE();
139
			e_machine = efile.readShortE();
150
			e_machine = efile.readShortE();
140
			e_version = efile.readIntE();
151
			e_version = efile.readIntE();
141
			e_entry = efile.readIntE();
152
			switch (e_ident[ELFhdr.EI_CLASS])
153
			{
154
				case ELFhdr.ELFCLASS32:
155
				{
156
					byte[] addrArray = new byte[ELF32_ADDR_SIZE];
157
					efile.readFullyE(addrArray);
158
					e_entry = new Addr32(addrArray);
142
			e_phoff = efile.readIntE();
159
			e_phoff = efile.readIntE();
143
			e_shoff = efile.readIntE();
160
			e_shoff = efile.readIntE();
161
				}
162
				break; 
163
				case ELFhdr.ELFCLASS64:
164
				{
165
					byte[] addrArray = new byte[ELF64_ADDR_SIZE];
166
					efile.readFullyE(addrArray);
167
					e_entry = new Addr64(addrArray);
168
					e_phoff = readUnsignedLong(efile);
169
					e_shoff = readUnsignedLong(efile);
170
				}
171
				break; 
172
				case ELFhdr.ELFCLASSNONE:
173
				default: 
174
					throw new IOException("Unknown ELF class " + e_ident[ELFhdr.EI_CLASS]);
175
			}
144
			e_flags = efile.readIntE();
176
			e_flags = efile.readIntE();
145
			e_ehsize = efile.readShortE();
177
			e_ehsize = efile.readShortE();
146
			e_phentsize = efile.readShortE();
178
			e_phentsize = efile.readShortE();
Lines 163-171 Link Here
163
			e_type = makeShort(bytes, offset, isle); offset += 2;
195
			e_type = makeShort(bytes, offset, isle); offset += 2;
164
			e_machine = makeShort(bytes, offset, isle); offset += 2;
196
			e_machine = makeShort(bytes, offset, isle); offset += 2;
165
			e_version = makeInt(bytes, offset, isle); offset += 4;
197
			e_version = makeInt(bytes, offset, isle); offset += 4;
166
			e_entry = makeInt(bytes, offset, isle); offset += 4;
198
			switch (e_ident[ELFhdr.EI_CLASS])
167
			e_phoff = makeInt(bytes, offset, isle); offset += 4;
199
			{
168
			e_shoff = makeInt(bytes, offset, isle); offset += 4;
200
				case ELFhdr.ELFCLASS32:
201
				{
202
					byte[] addrArray = new byte[ELF32_ADDR_SIZE];
203
					System.arraycopy(bytes, offset, addrArray, 0, ELF32_ADDR_SIZE); offset += ELF32_ADDR_SIZE;
204
					e_entry = new Addr32(addrArray);
205
					e_phoff = makeInt(bytes, offset, isle); offset += ELF32_OFF_SIZE;
206
					e_shoff = makeInt(bytes, offset, isle); offset += ELF32_OFF_SIZE;
207
				}
208
				break; 
209
				case ELFhdr.ELFCLASS64:
210
				{
211
					byte[] addrArray = new byte[ELF64_ADDR_SIZE];
212
					System.arraycopy(bytes, offset, addrArray, 0, ELF64_ADDR_SIZE); offset += ELF64_ADDR_SIZE;
213
					e_entry = new Addr64(addrArray);
214
					e_phoff = makeUnsignedLong(bytes, offset, isle); offset += ELF64_OFF_SIZE;
215
					e_shoff = makeUnsignedLong(bytes, offset, isle); offset += ELF64_OFF_SIZE;
216
				}
217
				break; 
218
				case ELFhdr.ELFCLASSNONE:
219
				default: 
220
					throw new IOException("Unknown ELF class " + e_ident[ELFhdr.EI_CLASS]);
221
			}
169
			e_flags = makeInt(bytes, offset, isle); offset += 4;
222
			e_flags = makeInt(bytes, offset, isle); offset += 4;
170
			e_ehsize = makeShort(bytes, offset, isle); offset += 2;
223
			e_ehsize = makeShort(bytes, offset, isle); offset += 2;
171
			e_phentsize = makeShort(bytes, offset, isle); offset += 2;
224
			e_phentsize = makeShort(bytes, offset, isle); offset += 2;
Lines 194-199 Link Here
194
			return ((val[offset + 0] << 24) + (val[offset + 1] << 16) + (val[offset + 2] << 8) + val[offset + 3]);
247
			return ((val[offset + 0] << 24) + (val[offset + 1] << 16) + (val[offset + 2] << 8) + val[offset + 3]);
195
		}
248
		}
196
249
250
		private final long makeLong(byte [] val, int offset, boolean isle) throws IOException
251
		{
252
			long result = 0;
253
			int shift = 0;
254
			if ( isle ) 
255
				for(int i=7; i >= 0; i-- )
256
				{
257
					shift = i*8;
258
					result += ( ((long)val[offset + i]) << shift ) & ( 0xffL << shift );
259
				}
260
			else
261
				for(int i=0; i <= 7; i++ )
262
				{
263
					shift = (7-i)*8;
264
					result += ( ((long)val[offset + i]) << shift ) & ( 0xffL << shift );
265
				}
266
			return result;
267
		}
268
		
269
		private final long makeUnsignedLong(byte [] val, int offset, boolean isle) throws IOException
270
		{
271
			long result = makeLong(val,offset,isle);
272
	    	if(result < 0)
273
	    	{
274
	    		throw new IOException( "Maximal file offset is " + Long.toHexString(Long.MAX_VALUE) +
275
	    				               " given offset is " + Long.toHexString(result));
276
	    	}
277
	    	return result;
278
279
		}
280
		
281
		
197
		
282
		
198
	}
283
	}
199
284
Lines 222-228 Link Here
222
		public long sh_name;
307
		public long sh_name;
223
		public long sh_type;
308
		public long sh_type;
224
		public long sh_flags;
309
		public long sh_flags;
225
		public long sh_addr;
310
		public IAddress sh_addr;
226
		public long sh_offset;
311
		public long sh_offset;
227
		public long sh_size;
312
		public long sh_size;
228
		public long sh_link;
313
		public long sh_link;
Lines 301-309 Link Here
301
        public final static int SHN_XINDEX = 0xffffffff; 
386
        public final static int SHN_XINDEX = 0xffffffff; 
302
        public final static int SHN_HIRESERVE = 0xffffffff; 
387
        public final static int SHN_HIRESERVE = 0xffffffff; 
303
388
304
389
		/*NOTE: 64 bit and 32 bit ELF sections has different order*/
305
		public long st_name;
390
		public long st_name;
306
		public long st_value;
391
		public IAddress st_value;
307
		public long st_size;
392
		public long st_size;
308
		public short st_info;
393
		public short st_info;
309
		public short st_other;
394
		public short st_other;
Lines 326-331 Link Here
326
		}
411
		}
327
						
412
						
328
		public int compareTo(Object obj) {
413
		public int compareTo(Object obj) {
414
			/*
329
			long thisVal = 0;
415
			long thisVal = 0;
330
			long anotherVal = 0;
416
			long anotherVal = 0;
331
			if ( obj instanceof Symbol ) {
417
			if ( obj instanceof Symbol ) {
Lines 338-343 Link Here
338
				thisVal = this.st_value;
424
				thisVal = this.st_value;
339
			}
425
			}
340
			return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
426
			return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1));
427
			*/
428
			return this.st_value.compareTo(((Symbol)obj).st_value);
341
		}
429
		}
342
430
343
		public String toString() {	
431
		public String toString() {	
Lines 362-388 Link Here
362
	 * and the Long doesn't know how to compare against a Symbol so if
450
	 * and the Long doesn't know how to compare against a Symbol so if
363
	 * we compare Symbol vs Long it is ok, but not if we do Long vs Symbol.
451
	 * we compare Symbol vs Long it is ok, but not if we do Long vs Symbol.
364
	 */
452
	 */
453
	
365
	class SymbolComparator implements Comparator {
454
	class SymbolComparator implements Comparator {
366
		long val1, val2;
455
		IAddress val1, val2;
367
		public int compare(Object o1, Object o2) {
456
		public int compare(Object o1, Object o2) {
368
457
369
			if(o1 instanceof Long) {
458
			if(o1 instanceof IAddress) {
370
				val1 = ((Long)o1).longValue();
459
				val1 = (IAddress)o1;
371
			} else if(o1 instanceof Symbol) {
460
			} else if(o1 instanceof Symbol) {
372
				val1 = ((Symbol)o1).st_value;
461
				val1 = ((Symbol)o1).st_value;
373
			} else {
462
			} else {
374
				return -1;
463
				return -1;
375
			}
464
			}
376
			
465
			
377
			if(o2 instanceof Long) {
466
			if(o2 instanceof IAddress) {
378
				val2 = ((Long)o2).longValue();
467
				val2 = (IAddress)o2;
379
			} else if(o2 instanceof Symbol) {
468
			} else if(o2 instanceof Symbol) {
380
				val2 = ((Symbol)o2).st_value;
469
				val2 = ((Symbol)o2).st_value;
381
			} else {
470
			} else {
382
				return -1;
471
				return -1;
383
			}
472
			}
384
			return (val1 == val2) ? 0 
473
			return val1.compareTo(val2);
385
								  : ((val1 < val2) ? -1 : 1);
386
		}
474
		}
387
	}
475
	}
388
476
Lines 399-409 Link Here
399
		public final static int PF_X = 1;
487
		public final static int PF_X = 1;
400
		public final static int PF_W = 2;
488
		public final static int PF_W = 2;
401
		public final static int PF_R = 4;
489
		public final static int PF_R = 4;
402
		
490
		/*NOTE: 64 bit and 32 bit ELF have different order and size of elements */
403
		public long p_type;
491
		public long p_type;
404
		public long p_offset;
492
		public long p_offset;
405
		public long p_vaddr;
493
		public IAddress p_vaddr;
406
		public long p_paddr;
494
		public IAddress p_paddr;
407
		public long p_filesz;
495
		public long p_filesz;
408
		public long p_memsz;
496
		public long p_memsz;
409
		public long p_flags;
497
		public long p_flags;
Lines 418-437 Link Here
418
		PHdr phdrs[] = new PHdr[ehdr.e_phnum];
506
		PHdr phdrs[] = new PHdr[ehdr.e_phnum];
419
		for( int i = 0; i < ehdr.e_phnum; i++ ) {
507
		for( int i = 0; i < ehdr.e_phnum; i++ ) {
420
			phdrs[i] = new PHdr();
508
			phdrs[i] = new PHdr();
509
			switch (ehdr.e_ident[ELFhdr.EI_CLASS])
510
			{
511
				case ELFhdr.ELFCLASS32:
512
				{
513
					byte[] addrArray = new byte[ELF32_ADDR_SIZE];
514
421
			phdrs[i].p_type = efile.readIntE();
515
			phdrs[i].p_type = efile.readIntE();
422
			phdrs[i].p_offset = efile.readIntE();
516
			phdrs[i].p_offset = efile.readIntE();
423
			phdrs[i].p_vaddr = efile.readIntE();
517
					efile.readFullyE(addrArray);
424
			phdrs[i].p_paddr = efile.readIntE();
518
					phdrs[i].p_vaddr = new Addr32(addrArray);
519
					efile.readFullyE(addrArray);
520
					phdrs[i].p_paddr = new Addr32(addrArray);
425
			phdrs[i].p_filesz = efile.readIntE();
521
			phdrs[i].p_filesz = efile.readIntE();
426
			phdrs[i].p_memsz = efile.readIntE();
522
			phdrs[i].p_memsz = efile.readIntE();
427
			phdrs[i].p_flags = efile.readIntE();
523
			phdrs[i].p_flags = efile.readIntE();
428
			phdrs[i].p_align = efile.readIntE();
524
			phdrs[i].p_align = efile.readIntE();
429
		}
525
		}
526
				break; 
527
				case ELFhdr.ELFCLASS64:
528
				{
529
					byte[] addrArray = new byte[ELF64_ADDR_SIZE];
530
					
531
					phdrs[i].p_type = efile.readIntE();
532
					phdrs[i].p_flags = efile.readIntE();
533
					phdrs[i].p_offset = readUnsignedLong(efile);
534
					efile.readFullyE(addrArray);
535
					phdrs[i].p_vaddr = new Addr64(addrArray);
536
					efile.readFullyE(addrArray);
537
					phdrs[i].p_paddr = new Addr64(addrArray);
538
					phdrs[i].p_filesz = readUnsignedLong(efile);
539
					phdrs[i].p_memsz = readUnsignedLong(efile);
540
					phdrs[i].p_align = readUnsignedLong(efile);
541
				}
542
				break; 
543
				case ELFhdr.ELFCLASSNONE:
544
				default: 
545
					throw new IOException("Unknown ELF class " + ehdr.e_ident[ELFhdr.EI_CLASS]);
546
			}
547
548
		}
430
		return phdrs;
549
		return phdrs;
431
	}
550
	}
432
		
551
		
433
	public class Dynamic {
552
	public class Dynamic {
434
		public final static int DYN_ENT_SIZE = 8;
553
		public final static int DYN_ENT_SIZE_32 = 8;
554
		public final static int DYN_ENT_SIZE_64 = 16;
435
555
436
		public final static int DT_NULL 		= 0;
556
		public final static int DT_NULL 		= 0;
437
		public final static int DT_NEEDED 		= 1;
557
		public final static int DT_NEEDED 		= 1;
Lines 454-463 Link Here
454
		private Section section;
574
		private Section section;
455
		private String name;
575
		private String name;
456
						
576
						
457
		protected Dynamic(Section section, long tag, long val) {
577
		protected Dynamic(Section section) {
458
			this.section = section;
578
			this.section = section;
459
			d_tag = tag;
460
			d_val = val;
461
		}						
579
		}						
462
		
580
		
463
		public String toString() {
581
		public String toString() {
Lines 491-501 Link Here
491
		// We must assume the section is a table ignoring the sh_entsize as it is not
609
		// We must assume the section is a table ignoring the sh_entsize as it is not
492
		// set for MIPS.
610
		// set for MIPS.
493
		while( off < section.sh_size ) {
611
		while( off < section.sh_size ) {
494
			Dynamic dynEnt = new Dynamic(section, efile.readIntE(), efile.readIntE());
612
			Dynamic dynEnt = new Dynamic(section);
495
			if ( dynEnt.d_tag == Dynamic.DT_NULL ) 
613
			switch (ehdr.e_ident[ELFhdr.EI_CLASS])
614
			{
615
				case ELFhdr.ELFCLASS32:
616
				{
617
					dynEnt.d_tag = efile.readIntE();
618
					dynEnt.d_val = efile.readIntE();
619
					off+= Dynamic.DYN_ENT_SIZE_32;
620
				}
496
				break;
621
				break;
622
				case ELFhdr.ELFCLASS64:
623
				{
624
					dynEnt.d_tag = efile.readLongE();
625
					dynEnt.d_val = efile.readLongE();
626
					off+= Dynamic.DYN_ENT_SIZE_64;
627
				}
628
				break; 
629
				case ELFhdr.ELFCLASSNONE:
630
				default: 
631
					throw new IOException("Unknown ELF class " + ehdr.e_ident[ELFhdr.EI_CLASS]);
632
			}
633
			
634
			if ( dynEnt.d_tag != Dynamic.DT_NULL ) 
497
			dynList.add(dynEnt);
635
			dynList.add(dynEnt);
498
			off+= Dynamic.DYN_ENT_SIZE;
499
		}
636
		}
500
		return (Dynamic[])dynList.toArray(new Dynamic[0]);
637
		return (Dynamic[])dynList.toArray(new Dynamic[0]);
501
	}
638
	}
Lines 546-551 Link Here
546
		int debugType;
683
		int debugType;
547
		boolean bDebug;
684
		boolean bDebug;
548
		boolean isle;
685
		boolean isle;
686
		IAddressFactory addressFactory;
549
687
550
		public String getCPU() {
688
		public String getCPU() {
551
			return cpu;
689
			return cpu;
Lines 566-571 Link Here
566
		public boolean isLittleEndian() {
704
		public boolean isLittleEndian() {
567
			return isle;
705
			return isle;
568
		}
706
		}
707
708
		public IAddressFactory getAddressFactory() {
709
			return addressFactory;
710
		}
569
	}
711
	}
570
712
571
    public Attribute getAttributes() throws IOException {
713
    public Attribute getAttributes() throws IOException {
Lines 679-684 Link Here
679
				attrib.isle = false;
821
				attrib.isle = false;
680
				break;
822
				break;
681
		}
823
		}
824
		switch (ehdr.e_ident[ELFhdr.EI_CLASS])
825
		{
826
			case ELFhdr.ELFCLASS32:
827
				attrib.addressFactory = new Addr32Factory();
828
			break; 
829
			case ELFhdr.ELFCLASS64:
830
				attrib.addressFactory = new Addr64Factory();
831
			break; 
832
			case ELFhdr.ELFCLASSNONE:
833
			default:
834
				attrib.addressFactory = null;  
835
		}
682
		// getSections
836
		// getSections
683
		// find .debug using toString
837
		// find .debug using toString
684
		Section [] sec = getSections();
838
		Section [] sec = getSections();
Lines 777-790 Link Here
777
				sections[i] = new Section();
931
				sections[i] = new Section();
778
				sections[i].sh_name = efile.readIntE();
932
				sections[i].sh_name = efile.readIntE();
779
				sections[i].sh_type = efile.readIntE();
933
				sections[i].sh_type = efile.readIntE();
934
				switch (ehdr.e_ident[ELFhdr.EI_CLASS])
935
				{
936
					case ELFhdr.ELFCLASS32:
937
					{
938
						byte[] addrArray = new byte[ELF32_ADDR_SIZE];
780
				sections[i].sh_flags = efile.readIntE();
939
				sections[i].sh_flags = efile.readIntE();
781
				sections[i].sh_addr = efile.readIntE();
940
						efile.readFullyE(addrArray);
941
						sections[i].sh_addr = new Addr32(addrArray);
782
				sections[i].sh_offset = efile.readIntE();
942
				sections[i].sh_offset = efile.readIntE();
783
				sections[i].sh_size = efile.readIntE();
943
				sections[i].sh_size = efile.readIntE();
944
					}
945
					break; 
946
					case ELFhdr.ELFCLASS64:
947
					{
948
						byte[] addrArray = new byte[ELF64_ADDR_SIZE];
949
						sections[i].sh_flags = efile.readLongE();
950
						efile.readFullyE(addrArray);
951
						sections[i].sh_addr = new Addr64(addrArray);
952
						sections[i].sh_offset = readUnsignedLong(efile);
953
						sections[i].sh_size = readUnsignedLong(efile);
954
					}
955
					break; 
956
					case ELFhdr.ELFCLASSNONE:
957
					default: 
958
						throw new IOException("Unknown ELF class " + ehdr.e_ident[ELFhdr.EI_CLASS]);
959
				}
960
				
784
				sections[i].sh_link = efile.readIntE();
961
				sections[i].sh_link = efile.readIntE();
785
				sections[i].sh_info = efile.readIntE();
962
				sections[i].sh_info = efile.readIntE();
963
				switch (ehdr.e_ident[ELFhdr.EI_CLASS])
964
				{
965
					case ELFhdr.ELFCLASS32:
966
					{
786
				sections[i].sh_addralign = efile.readIntE();
967
				sections[i].sh_addralign = efile.readIntE();
787
				sections[i].sh_entsize = efile.readIntE();
968
				sections[i].sh_entsize = efile.readIntE();
969
					}
970
					break; 
971
					case ELFhdr.ELFCLASS64:
972
					{
973
						sections[i].sh_addralign = efile.readLongE();
974
						sections[i].sh_entsize = readUnsignedLong(efile);
975
					}
976
					break; 
977
					case ELFhdr.ELFCLASSNONE:
978
					default: 
979
						throw new IOException("Unknown ELF class " + ehdr.e_ident[ELFhdr.EI_CLASS]);
980
				}
788
				if ( sections[i].sh_type == Section.SHT_SYMTAB )
981
				if ( sections[i].sh_type == Section.SHT_SYMTAB )
789
					syms = i;
982
					syms = i;
790
				if ( syms == 0 && sections[i].sh_type == Section.SHT_DYNSYM )
983
				if ( syms == 0 && sections[i].sh_type == Section.SHT_DYNSYM )
Lines 804-815 Link Here
804
        for( int c = 0; c < numSyms; c++) {
997
        for( int c = 0; c < numSyms; c++) {
805
	        efile.seek(section.sh_offset + (section.sh_entsize * c));
998
	        efile.seek(section.sh_offset + (section.sh_entsize * c));
806
            Symbol symbol = new Symbol( section );
999
            Symbol symbol = new Symbol( section );
1000
			switch (ehdr.e_ident[ELFhdr.EI_CLASS])
1001
			{
1002
				case ELFhdr.ELFCLASS32:
1003
				{
1004
					byte[] addrArray = new byte[ELF32_ADDR_SIZE];
1005
807
            symbol.st_name = efile.readIntE();
1006
            symbol.st_name = efile.readIntE();
808
            symbol.st_value = efile.readIntE();
1007
					efile.readFullyE(addrArray);
1008
					symbol.st_value = new Addr32(addrArray);
809
            symbol.st_size = efile.readIntE();
1009
            symbol.st_size = efile.readIntE();
810
            symbol.st_info = efile.readByte();
1010
            symbol.st_info = efile.readByte();
811
            symbol.st_other = efile.readByte();
1011
            symbol.st_other = efile.readByte();
812
            symbol.st_shndx = efile.readShortE();
1012
            symbol.st_shndx = efile.readShortE();
1013
				}
1014
				break; 
1015
				case ELFhdr.ELFCLASS64:
1016
				{
1017
					byte[] addrArray = new byte[ELF64_ADDR_SIZE];
1018
					
1019
					symbol.st_name = efile.readIntE();
1020
					symbol.st_info = efile.readByte();
1021
					symbol.st_other = efile.readByte();
1022
					symbol.st_shndx = efile.readShortE();
1023
					efile.readFullyE(addrArray);
1024
					symbol.st_value = new Addr64(addrArray);
1025
					symbol.st_size = readUnsignedLong(efile);
1026
				}
1027
				break; 
1028
				case ELFhdr.ELFCLASSNONE:
1029
				default: 
1030
					throw new IOException("Unknown ELF class " + ehdr.e_ident[ELFhdr.EI_CLASS]);
1031
			}
813
            if ( symbol.st_info == 0 )
1032
            if ( symbol.st_info == 0 )
814
                continue;
1033
                continue;
815
            symList.add(symbol);
1034
            symList.add(symbol);
Lines 865-871 Link Here
865
1084
866
	
1085
	
867
	/* return the address of the function that address is in */
1086
	/* return the address of the function that address is in */
868
	public Symbol getSymbol( long vma ) {
1087
	public Symbol getSymbol( IAddress vma ) {
869
		if ( symbols == null ) {
1088
		if ( symbols == null ) {
870
			return null;
1089
			return null;
871
		}
1090
		}
Lines 873-879 Link Here
873
		//@@@ If this works, move it to a single instance in this class.
1092
		//@@@ If this works, move it to a single instance in this class.
874
		SymbolComparator symbol_comparator = new SymbolComparator();
1093
		SymbolComparator symbol_comparator = new SymbolComparator();
875
		
1094
		
876
		int ndx = Arrays.binarySearch(symbols, new Long(vma), symbol_comparator);
1095
		int ndx = Arrays.binarySearch(symbols, vma, symbol_comparator);
877
		if ( ndx > 0 )
1096
		if ( ndx > 0 )
878
			return symbols[ndx];
1097
			return symbols[ndx];
879
		if ( ndx == -1 ) {
1098
		if ( ndx == -1 ) {
Lines 882-888 Link Here
882
		ndx = -ndx - 1;
1101
		ndx = -ndx - 1;
883
		return symbols[ndx-1];
1102
		return symbols[ndx-1];
884
	}
1103
	}
885
		
1104
	/*
886
	public long swapInt( long val ) {
1105
	public long swapInt( long val ) {
887
		if ( ehdr.e_ident[ELFhdr.EI_DATA] == ELFhdr.ELFDATA2LSB ) {
1106
		if ( ehdr.e_ident[ELFhdr.EI_DATA] == ELFhdr.ELFDATA2LSB ) {
888
			short tmp[] = new short[4];
1107
			short tmp[] = new short[4];
Lines 904-911 Link Here
904
		}
1123
		}
905
		return val;
1124
		return val;
906
	}
1125
	}
907
1126
*/
908
    public String getFilename() {
1127
    public String getFilename() {
909
        return file;
1128
        return file;
910
    }
1129
    }
1130
    
1131
    private final long readUnsignedLong(ERandomAccessFile file) throws IOException
1132
    {
1133
    	long result = file.readLongE();
1134
    	if(result < 0)
1135
    	{
1136
    		throw new IOException( "Maximal file offset is " + Long.toHexString(Long.MAX_VALUE) +
1137
    				               " given offset is " + Long.toHexString(result));
1138
    	}
1139
    	return result;
1140
    }
911
}
1141
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/elf/ERandomAccessFile.java (+34 lines)
Lines 59-64 Link Here
59
		return ((val[0] << 24) + (val[1] << 16) + (val[2] << 8) + val[3]);
59
		return ((val[0] << 24) + (val[1] << 16) + (val[2] << 8) + val[3]);
60
	}
60
	}
61
61
62
	public final long readLongE() throws IOException
63
	{
64
		byte [] bytes = new byte[8];
65
		long result = 0;
66
		super.readFully(bytes);
67
		int shift = 0;		
68
		if ( isle ) 
69
			for(int i=7; i >= 0; i-- )
70
			{
71
				shift = i*8;
72
				result += ( ((long)bytes[i]) << shift ) & ( 0xffL << shift );
73
			}
74
	    else
75
			for(int i=0; i <= 7; i++ )
76
			{
77
				shift = (7-i)*8;
78
				result += ( ((long)bytes[i]) << shift ) & ( 0xffL << shift );
79
			}
80
		return result;
81
	}
82
	
83
	public final void readFullyE(byte [] bytes) throws IOException
84
	{
85
		super.readFully(bytes);
86
		byte tmp = 0;
87
		if( isle )
88
			for(int i=0; i <= bytes.length / 2; i++)
89
			{
90
				tmp = bytes[i];
91
				bytes[i] = bytes[bytes.length - i -1];
92
				bytes[bytes.length - i -1] = tmp; 
93
			}
94
	}
95
62
    public void setFileOffset( long offset ) throws IOException {
96
    public void setFileOffset( long offset ) throws IOException {
63
        ptr_offset = offset;
97
        ptr_offset = offset;
64
        super.seek( offset );
98
        super.seek( offset );
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/elf/parser/ElfBinaryObject.java (+1 lines)
Lines 120-125 Link Here
120
		info.isLittleEndian = attribute.isLittleEndian();
120
		info.isLittleEndian = attribute.isLittleEndian();
121
		info.hasDebug = attribute.hasDebug();
121
		info.hasDebug = attribute.hasDebug();
122
		info.cpu = attribute.getCPU();
122
		info.cpu = attribute.getCPU();
123
		info.addressFactory = attribute.getAddressFactory(); 
123
	}
124
	}
124
125
125
	protected void loadSymbols(ElfHelper helper) throws IOException {
126
	protected void loadSymbols(ElfHelper helper) throws IOException {
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/elf/parser/GNUElfBinaryObject.java (-2 / +4 lines)
Lines 11-18 Link Here
11
import java.io.ByteArrayInputStream;
11
import java.io.ByteArrayInputStream;
12
import java.io.IOException;
12
import java.io.IOException;
13
import java.io.InputStream;
13
import java.io.InputStream;
14
import java.math.BigInteger;
14
import java.util.List;
15
import java.util.List;
15
16
17
import org.eclipse.cdt.core.IAddress;
16
import org.eclipse.cdt.utils.Addr2line;
18
import org.eclipse.cdt.utils.Addr2line;
17
import org.eclipse.cdt.utils.CPPFilt;
19
import org.eclipse.cdt.utils.CPPFilt;
18
import org.eclipse.cdt.utils.Objdump;
20
import org.eclipse.cdt.utils.Objdump;
Lines 124-130 Link Here
124
					cppfilt = null;
126
					cppfilt = null;
125
				}
127
				}
126
			}
128
			}
127
			long addr = array[i].st_value;
129
			IAddress addr = array[i].st_value;
128
			long size = array[i].st_size;
130
			long size = array[i].st_size;
129
			if (addr2line != null) {
131
			if (addr2line != null) {
130
				try {
132
				try {
Lines 133-139 Link Here
133
					// the file.
135
					// the file.
134
					IPath file = (filename != null && !filename.equals("??")) ? new Path(filename) : Path.EMPTY; //$NON-NLS-1$
136
					IPath file = (filename != null && !filename.equals("??")) ? new Path(filename) : Path.EMPTY; //$NON-NLS-1$
135
					int startLine = addr2line.getLineNumber(addr);
137
					int startLine = addr2line.getLineNumber(addr);
136
					int endLine = addr2line.getLineNumber(addr + size - 1);
138
					int endLine = addr2line.getLineNumber(addr.add(BigInteger.valueOf(size - 1)));
137
					list.add(new GNUSymbol(this, name, type, addr, size, file, startLine, endLine));
139
					list.add(new GNUSymbol(this, name, type, addr, size, file, startLine, endLine));
138
				} catch (IOException e) {
140
				} catch (IOException e) {
139
					addr2line = null;
141
					addr2line = null;
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/elf/parser/GNUSymbol.java (-3 / +5 lines)
Lines 11-29 Link Here
11
package org.eclipse.cdt.utils.elf.parser;
11
package org.eclipse.cdt.utils.elf.parser;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.math.BigInteger;
14
15
16
import org.eclipse.cdt.core.IAddress;
15
import org.eclipse.cdt.utils.Addr2line;
17
import org.eclipse.cdt.utils.Addr2line;
16
import org.eclipse.cdt.utils.Symbol;
18
import org.eclipse.cdt.utils.Symbol;
17
import org.eclipse.core.runtime.IPath;
19
import org.eclipse.core.runtime.IPath;
18
20
19
public class GNUSymbol extends Symbol {
21
public class GNUSymbol extends Symbol {
20
22
21
	public GNUSymbol(GNUElfBinaryObject binary, String name, int type, long addr, long size, IPath sourceFile, int startLine, int endLine) {
23
	public GNUSymbol(GNUElfBinaryObject binary, String name, int type, IAddress addr, long size, IPath sourceFile, int startLine, int endLine) {
22
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
24
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
23
		// TODO Auto-generated constructor stub
25
		// TODO Auto-generated constructor stub
24
	}
26
	}
25
27
26
	public GNUSymbol(GNUElfBinaryObject binary, String name, int type, long addr, long size) {
28
	public GNUSymbol(GNUElfBinaryObject binary, String name, int type, IAddress addr, long size) {
27
		super(binary, name, type, addr, size);
29
		super(binary, name, type, addr, size);
28
	}
30
	}
29
		
31
		
Lines 35-41 Link Here
35
		Addr2line addr2line = ((GNUElfBinaryObject)binary).getAddr2line(true);
37
		Addr2line addr2line = ((GNUElfBinaryObject)binary).getAddr2line(true);
36
		if (addr2line != null) {
38
		if (addr2line != null) {
37
			try {
39
			try {
38
				return addr2line.getLineNumber(getAddress() + offset);
40
				return addr2line.getLineNumber(getAddress().add(BigInteger.valueOf(offset)));
39
			} catch (IOException e) {
41
			} catch (IOException e) {
40
				// ignore
42
				// ignore
41
			}
43
			}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/macho/parser/ARMember.java (-1 / +2 lines)
Lines 15-20 Link Here
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.utils.Addr2line;
21
import org.eclipse.cdt.utils.Addr2line;
Lines 72-78 Link Here
72
73
73
	protected void addSymbols(MachO.Symbol[] array, int type, Addr2line addr2line, CPPFilt cppfilt, List list) {
74
	protected void addSymbols(MachO.Symbol[] array, int type, Addr2line addr2line, CPPFilt cppfilt, List list) {
74
		for (int i = 0; i < array.length; i++) {
75
		for (int i = 0; i < array.length; i++) {
75
			list.add(new Symbol(this, array[i].toString(), type, array[i].n_value, 4));
76
			list.add(new Symbol(this, array[i].toString(), type, new Addr32(array[i].n_value), 4));
76
		}
77
		}
77
	}
78
	}
78
79
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/macho/parser/MachOBinaryObject.java (-1 / +2 lines)
Lines 15-20 Link Here
15
import java.util.Arrays;
15
import java.util.Arrays;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.IBinaryParser;
19
import org.eclipse.cdt.core.IBinaryParser;
19
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
20
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 161-167 Link Here
161
			int size = 0;
162
			int size = 0;
162
			String filename = array[i].getFilename();
163
			String filename = array[i].getFilename();
163
			IPath filePath = (filename != null) ? new Path(filename) : null; //$NON-NLS-1$
164
			IPath filePath = (filename != null) ? new Path(filename) : null; //$NON-NLS-1$
164
			list.add(new Symbol(this, name, type, array[i].n_value, size, filePath, array[i].getLineNumber(addr), array[i].getLineNumber(addr + size - 1)));
165
			list.add(new Symbol(this, name, type, new Addr32(array[i].n_value), size, filePath, array[i].getLineNumber(addr), array[i].getLineNumber(addr + size - 1)));
165
		}
166
		}
166
	}
167
	}
167
168
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/som/parser/ARMember.java (-3 / +3 lines)
Lines 15-29 Link Here
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.core.runtime.IPath;
22
23
import org.eclipse.cdt.utils.CPPFilt;
22
import org.eclipse.cdt.utils.CPPFilt;
24
import org.eclipse.cdt.utils.Symbol;
23
import org.eclipse.cdt.utils.Symbol;
25
import org.eclipse.cdt.utils.som.AR;
24
import org.eclipse.cdt.utils.som.AR;
26
import org.eclipse.cdt.utils.som.SOM;
25
import org.eclipse.cdt.utils.som.SOM;
26
import org.eclipse.core.runtime.IPath;
27
27
28
/**
28
/**
29
 * A member of a SOM archive
29
 * A member of a SOM archive
Lines 61-67 Link Here
61
						cppfilt = null;
61
						cppfilt = null;
62
					}
62
					}
63
				}
63
				}
64
				Symbol sym = new Symbol(this, name, peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE, peSyms[i].symbol_value, 1);
64
				Symbol sym = new Symbol(this, name, peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE, new Addr32(peSyms[i].symbol_value), 1);
65
65
66
				list.add(sym);
66
				list.add(sym);
67
			}
67
			}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/som/parser/SOMBinaryObject.java (-3 / +5 lines)
Lines 13-22 Link Here
13
import java.io.ByteArrayInputStream;
13
import java.io.ByteArrayInputStream;
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.math.BigInteger;
16
import java.util.ArrayList;
17
import java.util.ArrayList;
17
import java.util.Arrays;
18
import java.util.Arrays;
18
import java.util.List;
19
import java.util.List;
19
20
21
import org.eclipse.cdt.core.Addr32;
22
import org.eclipse.cdt.core.IAddress;
20
import org.eclipse.cdt.core.IBinaryParser;
23
import org.eclipse.cdt.core.IBinaryParser;
21
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
24
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
22
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
25
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 25-31 Link Here
25
import org.eclipse.cdt.utils.CPPFilt;
28
import org.eclipse.cdt.utils.CPPFilt;
26
import org.eclipse.cdt.utils.Objdump;
29
import org.eclipse.cdt.utils.Objdump;
27
import org.eclipse.cdt.utils.som.SOM;
30
import org.eclipse.cdt.utils.som.SOM;
28
import org.eclipse.cdt.utils.som.parser.SOMParser;
29
import org.eclipse.core.runtime.IPath;
31
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.Path;
32
import org.eclipse.core.runtime.Path;
31
33
Lines 162-168 Link Here
162
					continue;
164
					continue;
163
				}
165
				}
164
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
166
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
165
				int addr = peSyms[i].symbol_value;
167
				IAddress addr = new Addr32(peSyms[i].symbol_value);
166
				int size = 4;
168
				int size = 4;
167
				if (cppfilt != null) {
169
				if (cppfilt != null) {
168
					try {
170
					try {
Lines 181-187 Link Here
181
183
182
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
184
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
183
						int startLine = addr2line.getLineNumber(addr);
185
						int startLine = addr2line.getLineNumber(addr);
184
						int endLine = addr2line.getLineNumber(addr + size - 1);
186
						int endLine = addr2line.getLineNumber(addr.add(BigInteger.valueOf(size - 1)));
185
						list.add(new SomSymbol(this, name, type, addr, size, file, startLine, endLine));
187
						list.add(new SomSymbol(this, name, type, addr, size, file, startLine, endLine));
186
					} catch (IOException e) {
188
					} catch (IOException e) {
187
						addr2line = null;
189
						addr2line = null;
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/som/parser/SomSymbol.java (-3 / +5 lines)
Lines 11-17 Link Here
11
package org.eclipse.cdt.utils.som.parser;
11
package org.eclipse.cdt.utils.som.parser;
12
12
13
import java.io.IOException;
13
import java.io.IOException;
14
import java.math.BigInteger;
14
15
16
import org.eclipse.cdt.core.IAddress;
15
import org.eclipse.cdt.utils.Addr2line;
17
import org.eclipse.cdt.utils.Addr2line;
16
import org.eclipse.cdt.utils.BinaryObjectAdapter;
18
import org.eclipse.cdt.utils.BinaryObjectAdapter;
17
import org.eclipse.cdt.utils.Symbol;
19
import org.eclipse.cdt.utils.Symbol;
Lines 34-40 Link Here
34
	 * @param startLine
36
	 * @param startLine
35
	 * @param endLine
37
	 * @param endLine
36
	 */
38
	 */
37
	public SomSymbol(BinaryObjectAdapter binary, String name, int type, long addr, long size, IPath sourceFile, int startLine, int endLine) {
39
	public SomSymbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size, IPath sourceFile, int startLine, int endLine) {
38
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
40
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
39
		// TODO Auto-generated constructor stub
41
		// TODO Auto-generated constructor stub
40
	}
42
	}
Lines 46-52 Link Here
46
	 * @param addr
48
	 * @param addr
47
	 * @param size
49
	 * @param size
48
	 */
50
	 */
49
	public SomSymbol(BinaryObjectAdapter binary, String name, int type, long addr, long size) {
51
	public SomSymbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size) {
50
		super(binary, name, type, addr, size);
52
		super(binary, name, type, addr, size);
51
		// TODO Auto-generated constructor stub
53
		// TODO Auto-generated constructor stub
52
	}
54
	}
Lines 59-65 Link Here
59
		Addr2line addr2line = ((SOMBinaryObject)binary).getAddr2line(true);
61
		Addr2line addr2line = ((SOMBinaryObject)binary).getAddr2line(true);
60
		if (addr2line != null) {
62
		if (addr2line != null) {
61
			try {
63
			try {
62
				return addr2line.getLineNumber(getAddress() + offset);
64
				return addr2line.getLineNumber(getAddress().add(BigInteger.valueOf(offset)));
63
			} catch (IOException e) {
65
			} catch (IOException e) {
64
				// ignore
66
				// ignore
65
			}
67
			}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/Symbol.java (-14 / +11 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.utils;
11
package org.eclipse.cdt.utils;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
14
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
14
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
15
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.IPath;
Lines 19-32 Link Here
19
	protected final BinaryObjectAdapter binary;
20
	protected final BinaryObjectAdapter binary;
20
	private final String name;
21
	private final String name;
21
22
22
	private final long addr;
23
	private final IAddress addr;
23
	private final int type;
24
	private final int type;
24
	private final long size;
25
	private final long size;
25
	private final int startLine;
26
	private final int startLine;
26
	private final int endLine;
27
	private final int endLine;
27
	private final IPath sourceFile;
28
	private final IPath sourceFile;
28
29
29
	public Symbol(BinaryObjectAdapter binary, String name, int type, long addr, long size, IPath sourceFile, int startLine, int endLine) {
30
	public Symbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size, IPath sourceFile, int startLine, int endLine) {
30
		this.binary = binary;
31
		this.binary = binary;
31
		this.name = name;
32
		this.name = name;
32
		this.type = type;
33
		this.type = type;
Lines 37-43 Link Here
37
		this.sourceFile = sourceFile;
38
		this.sourceFile = sourceFile;
38
	}
39
	}
39
40
40
	public Symbol(BinaryObjectAdapter binary, String name, int type, long addr, long size) {
41
	public Symbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size) {
41
		this.binary = binary;
42
		this.binary = binary;
42
		this.name = name;
43
		this.name = name;
43
		this.type = type;
44
		this.type = type;
Lines 81-87 Link Here
81
	 * 
82
	 * 
82
	 * @see org.eclipse.cdt.core.IBinaryParser.ISymbol#getAdress()
83
	 * @see org.eclipse.cdt.core.IBinaryParser.ISymbol#getAdress()
83
	 */
84
	 */
84
	public long getAddress() {
85
	public IAddress getAddress() {
85
		return addr;
86
		return addr;
86
	}
87
	}
87
88
Lines 122-138 Link Here
122
	}
123
	}
123
124
124
	public int compareTo(Object obj) {
125
	public int compareTo(Object obj) {
125
		long thisVal = 0;
126
		IAddress thisVal = this.addr;
126
		long anotherVal = 0;
127
		IAddress anotherVal = null;
127
		if (obj instanceof Symbol) {
128
		if (obj instanceof Symbol) {
128
			Symbol sym = (Symbol) obj;
129
			anotherVal = ((Symbol) obj).addr;
129
			thisVal = this.addr;
130
		} else if (obj instanceof IAddress) {
130
			anotherVal = sym.addr;
131
			anotherVal  = (IAddress) obj;
131
		} else if (obj instanceof Long) {
132
			Long val = (Long) obj;
133
			anotherVal = val.longValue();
134
			thisVal = this.addr;
135
		}
132
		}
136
		return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
133
		return thisVal.compareTo(anotherVal);
137
	}
134
	}
138
}
135
}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/xcoff/parser/ARMember.java (-1 / +2 lines)
Lines 15-20 Link Here
15
import java.io.InputStream;
15
import java.io.InputStream;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.cdt.core.Addr32;
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
21
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 87-93 Link Here
87
						cppfilt = null;
88
						cppfilt = null;
88
					}
89
					}
89
				}
90
				}
90
				Symbol sym = new Symbol(this, name, peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE, peSyms[i].n_value, 1);
91
				Symbol sym = new Symbol(this, name, peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE, new Addr32(peSyms[i].n_value), 1);
91
92
92
				list.add(sym);
93
				list.add(sym);
93
			}
94
			}
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/xcoff/parser/XCOFFBinaryObject.java (-2 / +5 lines)
Lines 11-20 Link Here
11
import java.io.ByteArrayInputStream;
11
import java.io.ByteArrayInputStream;
12
import java.io.IOException;
12
import java.io.IOException;
13
import java.io.InputStream;
13
import java.io.InputStream;
14
import java.math.BigInteger;
14
import java.util.ArrayList;
15
import java.util.ArrayList;
15
import java.util.Arrays;
16
import java.util.Arrays;
16
import java.util.List;
17
import java.util.List;
17
18
19
import org.eclipse.cdt.core.Addr32;
20
import org.eclipse.cdt.core.IAddress;
18
import org.eclipse.cdt.core.IBinaryParser;
21
import org.eclipse.cdt.core.IBinaryParser;
19
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
22
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
20
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
23
import org.eclipse.cdt.core.IBinaryParser.ISymbol;
Lines 164-170 Link Here
164
					continue;
167
					continue;
165
				}
168
				}
166
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
169
				int type = peSyms[i].isFunction() ? ISymbol.FUNCTION : ISymbol.VARIABLE;
167
				int addr = peSyms[i].n_value;
170
				IAddress addr = new Addr32(peSyms[i].n_value);
168
				int size = 4;
171
				int size = 4;
169
				if (cppfilt != null) {
172
				if (cppfilt != null) {
170
					try {
173
					try {
Lines 184-190 Link Here
184
187
185
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
188
						IPath file = filename != null ? new Path(filename) : Path.EMPTY;
186
						int startLine = addr2line.getLineNumber(addr);
189
						int startLine = addr2line.getLineNumber(addr);
187
						int endLine = addr2line.getLineNumber(addr + size - 1);
190
						int endLine = addr2line.getLineNumber(addr.add(BigInteger.valueOf(size - 1)));
188
						list.add(new XCoffSymbol(this, name, type, addr, size, file, startLine, endLine));
191
						list.add(new XCoffSymbol(this, name, type, addr, size, file, startLine, endLine));
189
					} catch (IOException e) {
192
					} catch (IOException e) {
190
						addr2line = null;
193
						addr2line = null;
(-)workspace-old/org.eclipse.cdt.core/src-cdtcore/org/eclipse/cdt/utils/xcoff/parser/XCoffSymbol.java (-3 / +5 lines)
Lines 7-13 Link Here
7
package org.eclipse.cdt.utils.xcoff.parser;
7
package org.eclipse.cdt.utils.xcoff.parser;
8
8
9
import java.io.IOException;
9
import java.io.IOException;
10
import java.math.BigInteger;
10
11
12
import org.eclipse.cdt.core.IAddress;
11
import org.eclipse.cdt.utils.Addr2line;
13
import org.eclipse.cdt.utils.Addr2line;
12
import org.eclipse.cdt.utils.BinaryObjectAdapter;
14
import org.eclipse.cdt.utils.BinaryObjectAdapter;
13
import org.eclipse.cdt.utils.Symbol;
15
import org.eclipse.cdt.utils.Symbol;
Lines 32-38 Link Here
32
	 * @param startLine
34
	 * @param startLine
33
	 * @param endLine
35
	 * @param endLine
34
	 */
36
	 */
35
	public XCoffSymbol(BinaryObjectAdapter binary, String name, int type, long addr, long size, IPath sourceFile, int startLine,
37
	public XCoffSymbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size, IPath sourceFile, int startLine,
36
			int endLine) {
38
			int endLine) {
37
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
39
		super(binary, name, type, addr, size, sourceFile, startLine, endLine);
38
		// TODO Auto-generated constructor stub
40
		// TODO Auto-generated constructor stub
Lines 45-51 Link Here
45
	 * @param addr
47
	 * @param addr
46
	 * @param size
48
	 * @param size
47
	 */
49
	 */
48
	public XCoffSymbol(BinaryObjectAdapter binary, String name, int type, long addr, long size) {
50
	public XCoffSymbol(BinaryObjectAdapter binary, String name, int type, IAddress addr, long size) {
49
		super(binary, name, type, addr, size);
51
		super(binary, name, type, addr, size);
50
		// TODO Auto-generated constructor stub
52
		// TODO Auto-generated constructor stub
51
	}
53
	}
Lines 58-64 Link Here
58
		Addr2line addr2line = ((XCOFFBinaryObject)binary).getAddr2line(true);
60
		Addr2line addr2line = ((XCOFFBinaryObject)binary).getAddr2line(true);
59
		if (addr2line != null) {
61
		if (addr2line != null) {
60
			try {
62
			try {
61
				return addr2line.getLineNumber(getAddress() + offset);
63
				return addr2line.getLineNumber(getAddress().add(BigInteger.valueOf(offset)));
62
			} catch (IOException e) {
64
			} catch (IOException e) {
63
				// ignore
65
				// ignore
64
			}
66
			}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/CDebugUtils.java (-25 lines)
Lines 91-109 Link Here
91
		}
91
		}
92
	}
92
	}
93
	
93
	
94
	public static String toHexAddressString( long address )
95
	{
96
		String addressString = Long.toHexString( address );
97
		StringBuffer sb = new StringBuffer( 10 );
98
		sb.append( "0x" ); //$NON-NLS-1$
99
		for ( int i = 0; i < 8 - addressString.length(); ++i )
100
		{
101
			sb.append( '0' );
102
		}
103
		sb.append( addressString );
104
		return sb.toString();
105
	}
106
107
	public static char[] getByteText( byte b )
94
	public static char[] getByteText( byte b )
108
	{
95
	{
109
		return new char[]{ charFromByte( (byte)((b >>> 4) & 0x0f) ), 
96
		return new char[]{ charFromByte( (byte)((b >>> 4) & 0x0f) ), 
Lines 201-218 Link Here
201
		return Long.parseLong( bytesToString( bytes, le, false ), 16 );
188
		return Long.parseLong( bytesToString( bytes, le, false ), 16 );
202
	}  
189
	}  
203
	
190
	
204
	public static long toLongLong( char[] bytes, boolean le )
205
	{
206
		if ( bytes.length != 16 )
207
			return 0;
208
		return Long.parseLong( bytesToString( bytes, le, false ), 16 );
209
	}
210
	
211
	public static long toUnsignedLongLong( char[] bytes, boolean le )
212
	{
213
		return 0;
214
	}
215
	
216
	private static String bytesToString( char[] bytes, boolean le, boolean signed )
191
	private static String bytesToString( char[] bytes, boolean le, boolean signed )
217
	{
192
	{
218
		char[] copy = new char[bytes.length];
193
		char[] copy = new char[bytes.length];
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.core.cdi.event;
11
package org.eclipse.cdt.debug.core.cdi.event;
12
12
13
import org.eclipse.cdt.core.IAddress;
14
13
/**
15
/**
14
 * 
16
 * 
15
 * Notifies that the originator has changed.
17
 * Notifies that the originator has changed.
Lines 19-23 Link Here
19
	/**
21
	/**
20
	 * @return the modified addresses.
22
	 * @return the modified addresses.
21
	 */
23
	 */
22
	Long[] getAddresses();
24
	IAddress[] getAddresses();
23
}
25
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/ICDILocation.java (-1 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.core.cdi;
11
package org.eclipse.cdt.debug.core.cdi;
12
12
13
import org.eclipse.cdt.core.IAddress;
14
13
15
14
/**
16
/**
15
 * 
17
 * 
Lines 24-30 Link Here
24
	 * 
26
	 * 
25
	 * @return the address of this location
27
	 * @return the address of this location
26
	 */
28
	 */
27
	long getAddress();
29
	IAddress getAddress();
28
	
30
	
29
	/**
31
	/**
30
	 * Returns the source file of this location or <code>null</code>
32
	 * Returns the source file of this location or <code>null</code>
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/ICDIMemoryManager.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi;
12
package org.eclipse.cdt.debug.core.cdi;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
15
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
15
16
16
/**
17
/**
Lines 41-47 Link Here
41
	 * @return a memory block with the specified identifier
42
	 * @return a memory block with the specified identifier
42
	 * @throws CDIException on failure. Reasons include:
43
	 * @throws CDIException on failure. Reasons include:
43
	 */
44
	 */
44
	ICDIMemoryBlock createMemoryBlock(long address, int length)
45
	ICDIMemoryBlock createMemoryBlock(IAddress address, int length)
45
		throws CDIException;
46
		throws CDIException;
46
47
47
	/**
48
	/**
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/ICDISourceManager.java (-3 / +4 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi;
12
package org.eclipse.cdt.debug.core.cdi;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
15
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
15
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
16
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
16
17
Lines 40-46 Link Here
40
	 *  @param endAddress is the end address
41
	 *  @param endAddress is the end address
41
	 *  @throws CDIException on failure.
42
	 *  @throws CDIException on failure.
42
	 */
43
	 */
43
	ICDIInstruction[] getInstructions(long startAddress, long endAddress)
44
	ICDIInstruction[] getInstructions(IAddress startAddress, IAddress endAddress)
44
		throws CDIException;
45
		throws CDIException;
45
46
46
	/**
47
	/**
Lines 66-73 Link Here
66
	 *  @throws CDIException on failure.
67
	 *  @throws CDIException on failure.
67
	 */
68
	 */
68
	ICDIMixedInstruction[] getMixedInstructions(
69
	ICDIMixedInstruction[] getMixedInstructions(
69
		long startAddress,
70
		IAddress startAddress,
70
		long endAddress)
71
	    IAddress endAddress)
71
		throws CDIException;
72
		throws CDIException;
72
73
73
	/**
74
	/**
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi;
12
package org.eclipse.cdt.debug.core.cdi;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint;
15
import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint;
15
16
16
/**
17
/**
Lines 155-159 Link Here
155
	 * @param address - an address
156
	 * @param address - an address
156
	 * @return an ICDILocation object 
157
	 * @return an ICDILocation object 
157
	 */
158
	 */
158
	ICDILocation createLocation( long address );
159
	ICDILocation createLocation( IAddress address );
159
}
160
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java (-1 / +3 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi.model;
12
package org.eclipse.cdt.debug.core.cdi.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
15
14
/**
16
/**
15
 * 
17
 * 
16
 * Represents a machine instruction.
18
 * Represents a machine instruction.
Lines 22-28 Link Here
22
	 * Returns the Address.
24
	 * Returns the Address.
23
	 * @return the address.
25
	 * @return the address.
24
	 */
26
	 */
25
	long getAdress();
27
	IAddress getAdress();
26
	
28
	
27
	/**
29
	/**
28
	 * @return the function name.
30
	 * @return the function name.
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi.model;
12
package org.eclipse.cdt.debug.core.cdi.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
16
16
/**
17
/**
Lines 26-32 Link Here
26
	 * 
27
	 * 
27
	 * @return the start address of this memory block
28
	 * @return the start address of this memory block
28
	 */
29
	 */
29
	long getStartAddress();
30
	IAddress getStartAddress();
30
	
31
	
31
	/**
32
	/**
32
	 * Returns the length of this memory block in bytes.
33
	 * Returns the length of this memory block in bytes.
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.core.cdi.model;
11
package org.eclipse.cdt.debug.core.cdi.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
15
15
/**
16
/**
Lines 32-45 Link Here
32
	 * 
33
	 * 
33
	 * @return the start address of this library
34
	 * @return the start address of this library
34
	 */
35
	 */
35
	long getStartAddress();
36
	IAddress getStartAddress();
36
37
37
	/**
38
	/**
38
	 * Returns the end address of this library.
39
	 * Returns the end address of this library.
39
	 * 
40
	 * 
40
	 * @return the end address of this library
41
	 * @return the end address of this library
41
	 */
42
	 */
42
	long getEndAddress();
43
	IAddress getEndAddress();
43
44
44
	/**
45
	/**
45
	 * Returns whether the symbols of this library are read.
46
	 * Returns whether the symbols of this library are read.
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi.model;
12
package org.eclipse.cdt.debug.core.cdi.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
16
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
16
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
17
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
Lines 182-187 Link Here
182
	/**
183
	/**
183
	 * Returns a ICDILocation
184
	 * Returns a ICDILocation
184
	 */
185
	 */
185
	ICDILocation createLocation(long address);
186
	ICDILocation createLocation(IAddress address);
186
187
187
}
188
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java (-1 / +2 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.cdi.model.type;
12
package org.eclipse.cdt.debug.core.cdi.model.type;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
16
16
17
Lines 22-26 Link Here
22
 */
23
 */
23
public interface ICDIPointerValue extends ICDIDerivedValue {
24
public interface ICDIPointerValue extends ICDIDerivedValue {
24
	
25
	
25
	long pointerValue() throws CDIException;
26
	IAddress pointerValue() throws CDIException;
26
}
27
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java (-1 / +2 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.core.cdi.model.type;
11
package org.eclipse.cdt.debug.core.cdi.model.type;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
15
15
/**
16
/**
16
 */
17
 */
17
public interface ICDIReferenceValue extends ICDIDerivedValue {
18
public interface ICDIReferenceValue extends ICDIDerivedValue {
18
19
19
	long referenceValue() throws CDIException;
20
	IAddress referenceValue() throws CDIException;
20
}
21
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/CDIDebugModel.java (-2 / +4 lines)
Lines 12-17 Link Here
12
12
13
import java.text.MessageFormat;
13
import java.text.MessageFormat;
14
import java.util.HashMap;
14
import java.util.HashMap;
15
16
import org.eclipse.cdt.core.IAddress;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
17
import org.eclipse.cdt.debug.core.cdi.CDIException;
16
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
18
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
17
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
19
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
Lines 255-261 Link Here
255
	 */
257
	 */
256
	public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, 
258
	public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, 
257
															   IResource resource, 
259
															   IResource resource, 
258
															   long address, 
260
															   IAddress address, 
259
															   boolean enabled, 
261
															   boolean enabled, 
260
															   int ignoreCount, 
262
															   int ignoreCount, 
261
															   String condition, 
263
															   String condition, 
Lines 266-272 Link Here
266
		attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
268
		attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
267
		attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
269
		attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
268
		attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
270
		attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
269
		attributes.put( ICLineBreakpoint.ADDRESS, Long.toString( address ) );
271
		attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
270
		attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
272
		attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
271
		attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
273
		attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
272
		attributes.put( ICBreakpoint.CONDITION, condition );
274
		attributes.put( ICBreakpoint.CONDITION, condition );
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IAsmInstruction.java (-1 / +3 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
14
13
/**
15
/**
14
 * An instruction of disassemby.
16
 * An instruction of disassemby.
15
 */
17
 */
Lines 20-26 Link Here
20
	 * 
22
	 * 
21
	 * @return the address of this instruction
23
	 * @return the address of this instruction
22
	 */
24
	 */
23
	long getAdress();
25
	IAddress getAdress();
24
	
26
	
25
	/**
27
	/**
26
	 * Returns the function name of this instruction, 
28
	 * Returns the function name of this instruction, 
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IBreakpointTarget.java (-1 / +2 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
15
15
/**
16
/**
Lines 30-34 Link Here
30
	 * @return the target address of the given breakpoint
31
	 * @return the target address of the given breakpoint
31
	 * @throws DebugException if the address is not available
32
	 * @throws DebugException if the address is not available
32
	 */
33
	 */
33
	long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException;
34
	IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException;
34
}
35
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/ICSharedLibrary.java (-2 / +3 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.model.IDebugElement;
15
import org.eclipse.debug.core.model.IDebugElement;
15
16
Lines 30-43 Link Here
30
	 * 
31
	 * 
31
	 * @return the start address of this library
32
	 * @return the start address of this library
32
	 */
33
	 */
33
	long getStartAddress();
34
	IAddress getStartAddress();
34
35
35
	/**
36
	/**
36
	 * Returns the end address of this library.
37
	 * Returns the end address of this library.
37
	 * 
38
	 * 
38
	 * @return the end address of this library
39
	 * @return the end address of this library
39
	 */
40
	 */
40
	long getEndAddress();
41
	IAddress getEndAddress();
41
42
42
	/**
43
	/**
43
	 * Returns whether the symbols of this library are read.
44
	 * Returns whether the symbols of this library are read.
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/ICStackFrame.java (-1 / +2 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.model.IStackFrame;
15
import org.eclipse.debug.core.model.IStackFrame;
15
import org.eclipse.debug.core.model.IValue;
16
import org.eclipse.debug.core.model.IValue;
Lines 24-30 Link Here
24
	 * 
25
	 * 
25
	 * @return the address of this stack frame
26
	 * @return the address of this stack frame
26
	 */
27
	 */
27
	public long getAddress();
28
	public IAddress getAddress();
28
	
29
	
29
	/**
30
	/**
30
	 * Returns the source file of this stack frame or <code>null</code>
31
	 * Returns the source file of this stack frame or <code>null</code>
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IFormattedMemoryBlock.java (-5 / +8 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.model.IMemoryBlock;
15
import org.eclipse.debug.core.model.IMemoryBlock;
15
16
Lines 104-116 Link Here
104
105
105
	char getPaddingCharacter();
106
	char getPaddingCharacter();
106
107
107
	long nextRowAddress();
108
	public IAddress getRealStartAddress();
108
	
109
	
109
	long previousRowAddress();
110
	IAddress nextRowAddress();
110
	
111
	
111
	long nextPageAddress();
112
	IAddress previousRowAddress();
112
	
113
	
113
	long previousPageAddress();
114
	IAddress nextPageAddress();
115
	
116
	IAddress previousPageAddress();
114
117
115
	void reformat( int format,
118
	void reformat( int format,
116
				   int wordSize,
119
				   int wordSize,
Lines 124-130 Link Here
124
				   char paddingChar ) throws DebugException;
127
				   char paddingChar ) throws DebugException;
125
	void dispose();
128
	void dispose();
126
129
127
	Long[] getChangedAddresses();
130
	IAddress[] getChangedAddresses();
128
	
131
	
129
	boolean isFrozen();
132
	boolean isFrozen();
130
	
133
	
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IFormattedMemoryBlockRow.java (-1 / +3 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.core.model;
12
package org.eclipse.cdt.debug.core.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
15
14
/**
16
/**
15
 * 
17
 * 
16
 * Represents a row in the output table of formatted memory block.
18
 * Represents a row in the output table of formatted memory block.
Lines 24-30 Link Here
24
	 * 
26
	 * 
25
	 * @return the address of this row
27
	 * @return the address of this row
26
	 */
28
	 */
27
	long getAddress();
29
	IAddress getAddress();
28
30
29
	/**
31
	/**
30
	 * Returns the array of memory words.
32
	 * Returns the array of memory words.
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IJumpToAddress.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 ***********************************************************************/
10
 ***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
15
15
/**
16
/**
Lines 22-33 Link Here
22
	 * 
23
	 * 
23
	 * @return whether this operation is currently available
24
	 * @return whether this operation is currently available
24
	 */
25
	 */
25
	public boolean canJumpToAddress( long address );
26
	public boolean canJumpToAddress( IAddress address );
26
27
27
	/**
28
	/**
28
	 * Causes this element to resume the execution at the specified address.
29
	 * Causes this element to resume the execution at the specified address.
29
	 * 
30
	 * 
30
	 * @exception DebugException on failure. Reasons include:
31
	 * @exception DebugException on failure. Reasons include:
31
	 */
32
	 */
32
	public void jumpToAddress( long address ) throws DebugException;
33
	public void jumpToAddress( IAddress address ) throws DebugException;
33
}
34
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/core/model/IRunToAddress.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 ***********************************************************************/
10
 ***********************************************************************/
11
package org.eclipse.cdt.debug.core.model;
11
package org.eclipse.cdt.debug.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.debug.core.DebugException;
14
import org.eclipse.debug.core.DebugException;
14
15
15
/**
16
/**
Lines 22-33 Link Here
22
	 * 
23
	 * 
23
	 * @return whether this operation is currently available
24
	 * @return whether this operation is currently available
24
	 */
25
	 */
25
	public boolean canRunToAddress( long address );
26
	public boolean canRunToAddress( IAddress address );
26
27
27
	/**
28
	/**
28
	 * Causes this element to run to specified address.
29
	 * Causes this element to run to specified address.
29
	 * 
30
	 * 
30
	 * @exception DebugException on failure. Reasons include:
31
	 * @exception DebugException on failure. Reasons include:
31
	 */
32
	 */
32
	public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException;
33
	public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException;
33
}
34
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/breakpoints/CAddressBreakpoint.java (-4 / +2 lines)
Lines 10-22 Link Here
10
 ***********************************************************************/
10
 ***********************************************************************/
11
package org.eclipse.cdt.debug.internal.core.breakpoints;
11
package org.eclipse.cdt.debug.internal.core.breakpoints;
12
12
13
import java.text.MessageFormat;
14
import java.util.Map;
13
import java.util.Map;
15
14
16
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
15
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
17
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
18
import org.eclipse.core.resources.IResource;
16
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.osgi.framework.msg.MessageFormat;
20
19
21
/**
20
/**
22
 * A breakpoint that suspend the execution when a particular address is reached.
21
 * A breakpoint that suspend the execution when a particular address is reached.
Lines 58-65 Link Here
58
			sb.append( name );
57
			sb.append( name );
59
		}
58
		}
60
		try {
59
		try {
61
			long address = Long.parseLong( getAddress() );
60
			sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { getAddress() } ) ); //$NON-NLS-1$
62
			sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$
63
		}
61
		}
64
		catch( NumberFormatException e ) {
62
		catch( NumberFormatException e ) {
65
		}
63
		}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java (-5 / +7 lines)
Lines 15-20 Link Here
15
import java.util.HashMap;
15
import java.util.HashMap;
16
import java.util.Map;
16
import java.util.Map;
17
import java.util.Set;
17
import java.util.Set;
18
19
import org.eclipse.cdt.core.IAddress;
18
import org.eclipse.cdt.debug.core.CDIDebugModel;
20
import org.eclipse.cdt.debug.core.CDIDebugModel;
19
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
21
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
20
import org.eclipse.cdt.debug.core.CDebugUtils;
22
import org.eclipse.cdt.debug.core.CDebugUtils;
Lines 256-262 Link Here
256
		return getBreakpointMap().getCBreakpoint( cdiBreakpoint );
258
		return getBreakpointMap().getCBreakpoint( cdiBreakpoint );
257
	}
259
	}
258
260
259
	public long getBreakpointAddress( ICBreakpoint breakpoint ) {
261
	public IAddress getBreakpointAddress( ICBreakpoint breakpoint ) {
260
		if ( breakpoint != null ) {
262
		if ( breakpoint != null ) {
261
			ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
263
			ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
262
			if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
264
			if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
Lines 269-275 Link Here
269
				}
271
				}
270
			}
272
			}
271
		}
273
		}
272
		return 0;
274
		return fDebugTarget.getAddressFactory().getZero();
273
	}
275
	}
274
276
275
	public void setBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
277
	public void setBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
Lines 493-499 Link Here
493
495
494
	private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
496
	private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
495
		ICDITarget cdiTarget = getCDITarget();
497
		ICDITarget cdiTarget = getCDITarget();
496
		ICDILocation location = cdiTarget.createLocation( Long.parseLong( breakpoint.getAddress() ) );
498
		ICDILocation location = cdiTarget.createLocation( getDebugTarget().getAddressFactory().createAddress(breakpoint.getAddress()));
497
		ICDIBreakpoint cdiBreakpoint = null;
499
		ICDIBreakpoint cdiBreakpoint = null;
498
		synchronized ( getBreakpointMap() ) {
500
		synchronized ( getBreakpointMap() ) {
499
			cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
501
			cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
Lines 563-569 Link Here
563
					else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
565
					else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
564
						breakpoint = createFunctionBreakpoint( cdiBreakpoint );
566
						breakpoint = createFunctionBreakpoint( cdiBreakpoint );
565
					}
567
					}
566
					else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
568
					else if ( ! cdiBreakpoint.getLocation().getAddress().isZero() ) {
567
						breakpoint = createAddressBreakpoint( cdiBreakpoint );
569
						breakpoint = createAddressBreakpoint( cdiBreakpoint );
568
					}
570
					}
569
				}
571
				}
Lines 571-577 Link Here
571
			else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
573
			else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
572
				breakpoint = createFunctionBreakpoint( cdiBreakpoint );
574
				breakpoint = createFunctionBreakpoint( cdiBreakpoint );
573
			}
575
			}
574
			else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
576
			else if ( ! cdiBreakpoint.getLocation().getAddress().isZero()) {
575
				breakpoint = createAddressBreakpoint( cdiBreakpoint );
577
				breakpoint = createAddressBreakpoint( cdiBreakpoint );
576
			}
578
			}
577
		}
579
		}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java (-1 / +2 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.internal.core.model;
11
package org.eclipse.cdt.debug.internal.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
14
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
14
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
15
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
15
16
Lines 30-36 Link Here
30
	/* (non-Javadoc)
31
	/* (non-Javadoc)
31
	 * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
32
	 * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
32
	 */
33
	 */
33
	public long getAdress() {
34
	public IAddress getAdress() {
34
		return fCDIInstruction.getAdress();
35
		return fCDIInstruction.getAdress();
35
	}
36
	}
36
37
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java (-7 / +28 lines)
Lines 15-21 Link Here
15
import java.util.Iterator;
15
import java.util.Iterator;
16
import java.util.List;
16
import java.util.List;
17
import java.util.StringTokenizer;
17
import java.util.StringTokenizer;
18
18
import org.eclipse.cdt.core.CCorePlugin;
19
import org.eclipse.cdt.core.CCorePlugin;
20
import org.eclipse.cdt.core.IAddress;
21
import org.eclipse.cdt.core.IAddressFactory;
19
import org.eclipse.cdt.core.model.CModelException;
22
import org.eclipse.cdt.core.model.CModelException;
20
import org.eclipse.cdt.core.model.CoreModel;
23
import org.eclipse.cdt.core.model.CoreModel;
21
import org.eclipse.cdt.core.model.IBinary;
24
import org.eclipse.cdt.core.model.IBinary;
Lines 205-210 Link Here
205
	 */
208
	 */
206
	private Preferences fPreferences = null;
209
	private Preferences fPreferences = null;
207
210
211
	private IAddressFactory fAddressFactory;
212
208
	/**
213
	/**
209
	 * Constructor for CDebugTarget.
214
	 * Constructor for CDebugTarget.
210
	 */
215
	 */
Lines 754-760 Link Here
754
	 * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
759
	 * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
755
	 */
760
	 */
756
	public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException {
761
	public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException {
757
		return null;
762
 		//IPF_TODO look into implementation
763
 		throw new RuntimeException("Method getMemoryBlock should not be called from CDT");
758
	}
764
	}
759
765
760
	/* (non-Javadoc)
766
	/* (non-Javadoc)
Lines 1521-1527 Link Here
1521
	/* (non-Javadoc)
1527
	/* (non-Javadoc)
1522
	 * @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
1528
	 * @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
1523
	 */
1529
	 */
1524
	public boolean canRunToAddress( long address ) {
1530
	public boolean canRunToAddress( IAddress address ) {
1525
		// for now
1531
		// for now
1526
		return canResume();
1532
		return canResume();
1527
	}
1533
	}
Lines 1529-1535 Link Here
1529
	/* (non-Javadoc)
1535
	/* (non-Javadoc)
1530
	 * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(long, boolean)
1536
	 * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(long, boolean)
1531
	 */
1537
	 */
1532
	public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException {
1538
	public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException {
1533
		if ( !canRunToAddress( address ) )
1539
		if ( !canRunToAddress( address ) )
1534
			return;
1540
			return;
1535
		if ( skipBreakpoints ) {
1541
		if ( skipBreakpoints ) {
Lines 1625-1631 Link Here
1625
	/* (non-Javadoc)
1631
	/* (non-Javadoc)
1626
	 * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(long)
1632
	 * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(long)
1627
	 */
1633
	 */
1628
	public boolean canJumpToAddress( long address ) {
1634
	public boolean canJumpToAddress( IAddress address ) {
1629
		// check if supports jump to address
1635
		// check if supports jump to address
1630
		return canResume();
1636
		return canResume();
1631
	}
1637
	}
Lines 1633-1639 Link Here
1633
	/* (non-Javadoc)
1639
	/* (non-Javadoc)
1634
	 * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(long)
1640
	 * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(long)
1635
	 */
1641
	 */
1636
	public void jumpToAddress( long address ) throws DebugException {
1642
	public void jumpToAddress( IAddress address ) throws DebugException {
1637
		if ( !canJumpToAddress( address ) )
1643
		if ( !canJumpToAddress( address ) )
1638
			return;
1644
			return;
1639
		ICDILocation location = getCDITarget().createLocation( address );
1645
		ICDILocation location = getCDITarget().createLocation( address );
Lines 1783-1790 Link Here
1783
	/* (non-Javadoc)
1789
	/* (non-Javadoc)
1784
	 * @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
1790
	 * @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
1785
	 */
1791
	 */
1786
	public long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
1792
	public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
1787
		return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : 0;
1793
		return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : getAddressFactory().getZero();
1788
	}
1794
	}
1789
1795
1790
	/* (non-Javadoc)
1796
	/* (non-Javadoc)
Lines 1861-1864 Link Here
1861
	public boolean isPostMortem() {
1867
	public boolean isPostMortem() {
1862
		return false;
1868
		return false;
1863
	}
1869
	}
1870
 	public IAddressFactory getAddressFactory()
1871
 	{
1872
 		if ( fAddressFactory == null )
1873
 		{
1874
 			if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
1875
 			{
1876
 				ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
1877
 				if ( cFile instanceof IBinary )
1878
 				{
1879
 					fAddressFactory = ((IBinary)cFile).getAddressFactory();
1880
 				}
1881
 			}
1882
 		}
1883
 		return fAddressFactory;
1884
 	}
1864
}
1885
}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java (-21 / +29 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.internal.core.model;
11
package org.eclipse.cdt.debug.internal.core.model;
12
12
13
import java.math.BigInteger;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.List;
15
import java.util.List;
15
16
17
import org.eclipse.cdt.core.IAddress;
16
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
18
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
17
import org.eclipse.cdt.debug.core.CDebugUtils;
19
import org.eclipse.cdt.debug.core.CDebugUtils;
18
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.CDIException;
Lines 43-56 Link Here
43
{
45
{
44
	class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow
46
	class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow
45
	{
47
	{
46
		private long fAddress;
48
		private IAddress fAddress;
47
		private String[] fData;
49
		private String[] fData;
48
		private String fAscii;
50
		private String fAscii;
49
51
50
		/**
52
		/**
51
		 * Constructor for CFormattedMemoryBlockRow.
53
		 * Constructor for CFormattedMemoryBlockRow.
52
		 */
54
		 */
53
		public CFormattedMemoryBlockRow( long address, String[] data, String ascii )
55
		public CFormattedMemoryBlockRow( IAddress address, String[] data, String ascii )
54
		{
56
		{
55
			fAddress = address;
57
			fAddress = address;
56
			fData = data;
58
			fData = data;
Lines 60-66 Link Here
60
		/* (non-Javadoc)
62
		/* (non-Javadoc)
61
		 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow#getAddress()
63
		 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow#getAddress()
62
		 */
64
		 */
63
		public long getAddress()
65
		public IAddress getAddress()
64
		{
66
		{
65
			return fAddress;
67
			return fAddress;
66
		}
68
		}
Lines 92-98 Link Here
92
	private boolean fDisplayAscii = true;
94
	private boolean fDisplayAscii = true;
93
	private char fPaddingChar = '.';
95
	private char fPaddingChar = '.';
94
	private List fRows = null;
96
	private List fRows = null;
95
	private Long[] fChangedAddresses = new Long[0];
97
	private IAddress[] fChangedAddresses = new IAddress[0];
96
	private boolean fStartAddressChanged = false;
98
	private boolean fStartAddressChanged = false;
97
99
98
	/**
100
	/**
Lines 219-251 Link Here
219
	/* (non-Javadoc)
221
	/* (non-Javadoc)
220
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress()
222
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress()
221
	 */
223
	 */
222
	public long nextRowAddress()
224
	public IAddress nextRowAddress()
223
	{
225
	{
224
		return 0;
226
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
225
	}
227
	}
226
228
227
	/* (non-Javadoc)
229
	/* (non-Javadoc)
228
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress()
230
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress()
229
	 */
231
	 */
230
	public long previousRowAddress()
232
	public IAddress previousRowAddress()
231
	{
233
	{
232
		return 0;
234
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
233
	}
235
	}
234
236
235
	/* (non-Javadoc)
237
	/* (non-Javadoc)
236
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress()
238
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress()
237
	 */
239
	 */
238
	public long nextPageAddress()
240
	public IAddress nextPageAddress()
239
	{
241
	{
240
		return 0;
242
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
241
	}
243
	}
242
244
243
	/* (non-Javadoc)
245
	/* (non-Javadoc)
244
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress()
246
	 * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress()
245
	 */
247
	 */
246
	public long previousPageAddress()
248
	public IAddress previousPageAddress()
247
	{
249
	{
248
		return 0;
250
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
249
	}
251
	}
250
252
251
	/* (non-Javadoc)
253
	/* (non-Javadoc)
Lines 285-297 Link Here
285
	 */
287
	 */
286
	public long getStartAddress()
288
	public long getStartAddress()
287
	{
289
	{
290
		//IPF_TODO look into implementation
291
		throw new RuntimeException("Method IMemoryBlock.getStartAddress shoud not be called in CDT debug");
292
	}
293
294
	public IAddress getRealStartAddress()
295
	{
288
		if ( fCDIMemoryBlock != null )
296
		if ( fCDIMemoryBlock != null )
289
		{
297
		{
290
			return fCDIMemoryBlock.getStartAddress();
298
			return fCDIMemoryBlock.getStartAddress();
291
		}
299
		}
292
		return 0;
300
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
293
	}
301
	}
294
295
	/* (non-Javadoc)
302
	/* (non-Javadoc)
296
	 * @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
303
	 * @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
297
	 */
304
	 */
Lines 510-528 Link Here
510
		fireTerminateEvent();
517
		fireTerminateEvent();
511
	}
518
	}
512
	
519
	
513
	public Long[] getChangedAddresses()
520
	public IAddress[] getChangedAddresses()
514
	{
521
	{
515
		return fChangedAddresses;
522
		return fChangedAddresses;
516
	}
523
	}
517
524
518
	protected void setChangedAddresses( Long[] changedAddresses )
525
	protected void setChangedAddresses( IAddress[] changedAddresses )
519
	{
526
	{
520
		fChangedAddresses = changedAddresses;
527
		fChangedAddresses = changedAddresses;
521
	}
528
	}
522
	
529
	
523
	protected void resetChangedAddresses()
530
	protected void resetChangedAddresses()
524
	{
531
	{
525
		fChangedAddresses = new Long[0];
532
		fChangedAddresses = new IAddress[0];
526
	}
533
	}
527
534
528
	/**
535
	/**
Lines 679-690 Link Here
679
		return fStartAddressChanged;
686
		return fStartAddressChanged;
680
	}
687
	}
681
	
688
	
682
	private long getRowAddress( int offset )
689
	private IAddress getRowAddress(int offset )
683
	{
690
	{
684
		long result = getStartAddress() + offset;		
691
		IAddress result = getRealStartAddress().add(BigInteger.valueOf(offset));
685
		if ( result > 0xFFFFFFFFL )
692
		IAddress max = ((CDebugTarget)getDebugTarget()).getAddressFactory().getMax();
693
		if ( result.compareTo(max) > 0 )
686
		{
694
		{
687
			result -= 0xFFFFFFFFL;
695
			result = result.add(result.getMaxOffset().negate());
688
		}
696
		}
689
		return result;
697
		return result;
690
	}
698
	}
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/CSharedLibrary.java (-4 / +5 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.internal.core.model;
11
package org.eclipse.cdt.debug.internal.core.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
14
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
15
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
15
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
16
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
Lines 52-72 Link Here
52
	/* (non-Javadoc)
53
	/* (non-Javadoc)
53
	 * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getStartAddress()
54
	 * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getStartAddress()
54
	 */
55
	 */
55
	public long getStartAddress()
56
	public IAddress getStartAddress()
56
	{
57
	{
57
		if ( getCDISharedLibrary() != null )
58
		if ( getCDISharedLibrary() != null )
58
			return getCDISharedLibrary().getStartAddress();
59
			return getCDISharedLibrary().getStartAddress();
59
		return 0;
60
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
60
	}
61
	}
61
62
62
	/* (non-Javadoc)
63
	/* (non-Javadoc)
63
	 * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getEndAddress()
64
	 * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getEndAddress()
64
	 */
65
	 */
65
	public long getEndAddress()
66
	public IAddress getEndAddress()
66
	{
67
	{
67
		if ( getCDISharedLibrary() != null )
68
		if ( getCDISharedLibrary() != null )
68
			return getCDISharedLibrary().getEndAddress();
69
			return getCDISharedLibrary().getEndAddress();
69
		return 0;
70
		return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
70
	}
71
	}
71
72
72
	/* (non-Javadoc)
73
	/* (non-Javadoc)
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java (-1 / +3 lines)
Lines 16-21 Link Here
16
import java.util.Arrays;
16
import java.util.Arrays;
17
import java.util.Iterator;
17
import java.util.Iterator;
18
import java.util.List;
18
import java.util.List;
19
20
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
21
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
22
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
21
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
23
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
Lines 530-536 Link Here
530
	/* (non-Javadoc)
532
	/* (non-Javadoc)
531
	 * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress()
533
	 * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress()
532
	 */
534
	 */
533
	public long getAddress() {
535
	public IAddress getAddress() {
534
		return getCDIStackFrame().getLocation().getAddress();
536
		return getCDIStackFrame().getLocation().getAddress();
535
	}
537
	}
536
538
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/CValue.java (-27 / +36 lines)
Lines 16-21 Link Here
16
import java.util.Collections;
16
import java.util.Collections;
17
import java.util.Iterator;
17
import java.util.Iterator;
18
import java.util.List;
18
import java.util.List;
19
20
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
21
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
22
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
21
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
23
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
Lines 274-285 Link Here
274
	private String getLongValueString( ICDILongValue value ) throws CDIException {
276
	private String getLongValueString( ICDILongValue value ) throws CDIException {
275
		CVariableFormat format = getParentVariable().getFormat(); 
277
		CVariableFormat format = getParentVariable().getFormat(); 
276
		if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.DECIMAL.equals( format ) ) {
278
		if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.DECIMAL.equals( format ) ) {
277
			return (isUnsigned()) ? Long.toString( value.longValue() ) : Integer.toString( value.intValue() );
279
			if ( isUnsigned() ) {
280
				BigInteger bigValue = new BigInteger( value.getValueString() );
281
				return bigValue.toString();
282
			}
283
			return Long.toString( value.longValue() );
278
		}
284
		}
279
		else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) {
285
		else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) {
280
			StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$
286
			StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$
281
			String stringValue = Long.toHexString( (isUnsigned()) ? value.longValue() : value.intValue() );
287
			if ( isUnsigned() ) {
282
			sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue );
288
				BigInteger bigValue = new BigInteger( value.getValueString() );
289
				sb.append( bigValue.toString( 16 ) );
290
			}
291
			else
292
				sb.append( Long.toHexString( value.longValue() ) );
283
			return sb.toString();
293
			return sb.toString();
284
		}
294
		}
285
		return null;
295
		return null;
Lines 351-383 Link Here
351
		return null;
361
		return null;
352
	}
362
	}
353
363
354
	private String getPointerValueString( ICDIPointerValue value ) throws CDIException {
364
  	private String getPointerValueString( ICDIPointerValue value ) throws CDIException
355
		long longValue = value.pointerValue();
365
  	{
356
		CVariableFormat format = getParentVariable().getFormat(); 
366
 		//IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references
357
		if ( CVariableFormat.DECIMAL.equals( format ) ) {
367
 		IAddress address = value.pointerValue();
358
			return Long.toString( longValue );
368
 		if(address == null) return "";
359
		}
369
		CVariableFormat format = getParentVariable().getFormat(); 
360
		else if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) {
370
        if( CVariableFormat.NATURAL.equals( format ) ||
361
			StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$
371
            CVariableFormat.HEXADECIMAL.equals( format ) )
362
			String stringValue = Long.toHexString( longValue );
372
            return address.toHexAddressString();
363
			sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue );
373
		if( CVariableFormat.DECIMAL.equals( format ))
364
			return sb.toString();
374
  			return address.toString();
365
		}
366
		return null;
375
		return null;
367
	}
376
	}
368
377
369
	private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException {
378
  	private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException
370
		long longValue = value.referenceValue();
379
  	{
371
		CVariableFormat format = getParentVariable().getFormat(); 
380
  		//NOTE: Reference should be displayed identically to address
372
		if ( CVariableFormat.DECIMAL.equals( format ) ) {
381
 		//IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references
373
			return Long.toString( longValue );
382
 		IAddress address = value.referenceValue();
374
		}
383
 		if(address == null) return "";
375
		else if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) {
384
		CVariableFormat format = getParentVariable().getFormat(); 
376
			StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$
385
        if( CVariableFormat.NATURAL.equals( format ) ||
377
			String stringValue = Long.toHexString( longValue );
386
            CVariableFormat.HEXADECIMAL.equals( format ) )
378
			sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue );
387
            return address.toHexAddressString();
379
			return sb.toString();
388
        if( CVariableFormat.DECIMAL.equals( format ))
380
		}
389
            return address.toString();
381
		return null;
390
		return null;
382
	}
391
	}
383
392
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java (-4 / +6 lines)
Lines 16-21 Link Here
16
import java.io.IOException;
16
import java.io.IOException;
17
import java.io.LineNumberReader;
17
import java.io.LineNumberReader;
18
18
19
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
20
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
20
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
21
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
21
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
22
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
Lines 39-47 Link Here
39
	
40
	
40
	private IAsmSourceLine[] fSourceLines;
41
	private IAsmSourceLine[] fSourceLines;
41
42
42
	private long fStartAddress = 0;
43
	private IAddress fStartAddress;
43
44
44
	private long fEndAddress = 0;
45
	private IAddress fEndAddress;
45
	
46
	
46
	private boolean fMixedMode = false;
47
	private boolean fMixedMode = false;
47
48
Lines 100-107 Link Here
100
	public boolean contains( ICStackFrame frame ) {
101
	public boolean contains( ICStackFrame frame ) {
101
		if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
102
		if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
102
			return false;
103
			return false;
103
		long address = frame.getAddress();
104
		IAddress address = frame.getAddress();
104
		return (address >= fStartAddress && address <= fEndAddress);
105
		return ( address.compareTo(fStartAddress) >= 0 && 
106
				 address.compareTo(fEndAddress)   <= 0    );
105
	}
107
	}
106
108
107
	/* (non-Javadoc)
109
	/* (non-Javadoc)
(-)workspace-old/org.eclipse.cdt.debug.core/src-cdtdebugcore/org/eclipse/cdt/debug/internal/core/model/Disassembly.java (-7 / +7 lines)
Lines 10-17 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.internal.core.model;
11
package org.eclipse.cdt.debug.internal.core.model;
12
12
13
import java.math.BigInteger;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
15
16
import org.eclipse.cdt.core.IAddress;
15
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
17
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
16
import org.eclipse.cdt.debug.core.ICDebugConstants;
18
import org.eclipse.cdt.debug.core.ICDebugConstants;
17
import org.eclipse.cdt.debug.core.cdi.CDIException;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
Lines 62-68 Link Here
62
				String fileName = frame.getFile();
64
				String fileName = frame.getFile();
63
				int lineNumber = frame.getLineNumber();
65
				int lineNumber = frame.getLineNumber();
64
				ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
66
				ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
65
				long address = frame.getAddress();				
67
				IAddress address = frame.getAddress();				
66
				if ( fileName != null && fileName.length() > 0 ) {
68
				if ( fileName != null && fileName.length() > 0 ) {
67
					try {
69
					try {
68
						mixedInstrs = sm.getMixedInstructions( fileName, 
70
						mixedInstrs = sm.getMixedInstructions( fileName, 
Lines 73-91 Link Here
73
						targetRequestFailed( e.getMessage(), e );
75
						targetRequestFailed( e.getMessage(), e );
74
					}
76
					}
75
				}
77
				}
76
				if ( mixedInstrs.length == 0 ||
77
				// Double check if debugger returns correct address range.
78
				// Double check if debugger returns correct address range.
79
				if ( mixedInstrs.length == 0 ||
78
						!containsAddress( mixedInstrs, address ) ) {
80
						!containsAddress( mixedInstrs, address ) ) {
79
					if ( address >= 0 ) {
80
						try {
81
						try {
81
							ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
82
							ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( address, address.add(BigInteger.valueOf(DISASSEMBLY_BLOCK_SIZE)) ) );
82
							return DisassemblyBlock.create( this, instructions );
83
							return DisassemblyBlock.create( this, instructions );
83
						}
84
						}
84
						catch( CDIException e ) {
85
						catch( CDIException e ) {
85
							targetRequestFailed( e.getMessage(), e );
86
							targetRequestFailed( e.getMessage(), e );
86
						}
87
						}
87
					}
88
					}
88
				}
89
				else {
89
				else {
90
					return DisassemblyBlock.create( this, mixedInstrs );
90
					return DisassemblyBlock.create( this, mixedInstrs );
91
				}
91
				}
Lines 94-104 Link Here
94
		return null;
94
		return null;
95
	}
95
	}
96
96
97
	private boolean containsAddress( ICDIMixedInstruction[] mi, long address ) {
97
	private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
98
		for( int i = 0; i < mi.length; ++i ) {
98
		for( int i = 0; i < mi.length; ++i ) {
99
			ICDIInstruction[] instructions = mi[i].getInstructions();
99
			ICDIInstruction[] instructions = mi[i].getInstructions();
100
			for ( int j = 0; j < instructions.length; ++j )
100
			for ( int j = 0; j < instructions.length; ++j )
101
				if ( instructions[j].getAdress() == address )
101
				if ( address.equals(instructions[j].getAdress()))
102
					return true;
102
					return true;
103
		}
103
		}
104
		return false;
104
		return false;
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java (-1 / +2 lines)
Lines 16-21 Link Here
16
import java.util.List;
16
import java.util.List;
17
import java.util.Map;
17
import java.util.Map;
18
18
19
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
21
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
21
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
22
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
Lines 649-655 Link Here
649
	/**
650
	/**
650
	 * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long)
651
	 * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long)
651
	 */
652
	 */
652
	public ICDILocation createLocation(long address) {
653
	public ICDILocation createLocation(IAddress address) {
653
		return new Location(address);
654
		return new Location(address);
654
	}
655
	}
655
656
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/event/CreatedEvent.java (-1 / +1 lines)
Lines 95-101 Link Here
95
		MISession miSession = mblock.getMISession();
95
		MISession miSession = mblock.getMISession();
96
		ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession);
96
		ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession);
97
		for (int i = 0; i < blocks.length; i++) {
97
		for (int i = 0; i < blocks.length; i++) {
98
			if (blocks[i].getStartAddress() == mblock.getAddress() &&
98
			if (blocks[i].getStartAddress().equals(mblock.getAddress()) &&
99
			    blocks[i].getLength() == mblock.getLength()) {
99
			    blocks[i].getLength() == mblock.getLength()) {
100
				source = blocks[i];
100
				source = blocks[i];
101
				break;
101
				break;
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java (-7 / +8 lines)
Lines 13-18 Link Here
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.List;
14
import java.util.List;
15
15
16
import org.eclipse.cdt.core.IAddress;
16
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
17
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
17
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
18
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
18
import org.eclipse.cdt.debug.mi.core.cdi.Session;
19
import org.eclipse.cdt.debug.mi.core.cdi.Session;
Lines 36-51 Link Here
36
	/**
37
	/**
37
	 * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses()
38
	 * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses()
38
	 */
39
	 */
39
	public Long[] getAddresses() {
40
	public IAddress[] getAddresses() {
40
	 	/* But only returns the address that are in the block.  */
41
	 	/* But only returns the address that are in the block.  */
41
		Long[] longs = miMem.getAddresses();
42
		IAddress[] mi_addresses = miMem.getAddresses();
42
		List aList = new ArrayList(longs.length);
43
		List aList = new ArrayList(mi_addresses.length);
43
		for (int i = 0; i < longs.length; i++) {
44
		for (int i = 0; i < mi_addresses.length; i++) {
44
			if (source.contains(longs[i])) {
45
			if (source.contains(mi_addresses[i])) {
45
				aList.add(longs[i]);
46
				aList.add(mi_addresses[i]);
46
			}
47
			}
47
		}
48
		}
48
		return (Long[])aList.toArray(new Long[0]);
49
		return (IAddress[])aList.toArray(new IAddress[0]);
49
	}
50
	}
50
51
51
	/**
52
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java (-1 / +2 lines)
Lines 16-21 Link Here
16
import java.util.Observable;
16
import java.util.Observable;
17
import java.util.Observer;
17
import java.util.Observer;
18
18
19
import org.eclipse.cdt.core.IAddress;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.CDIException;
20
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
21
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
21
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
22
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
Lines 119-125 Link Here
119
				MemoryManager mgr = (MemoryManager)session.getMemoryManager();
120
				MemoryManager mgr = (MemoryManager)session.getMemoryManager();
120
				MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession());
121
				MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession());
121
				MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent;
122
				MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent;
122
				Long[] addresses = miMem.getAddresses();
123
				IAddress[] addresses = miMem.getAddresses();
123
				for (int i = 0; i < blocks.length; i++) {
124
				for (int i = 0; i < blocks.length; i++) {
124
					if (blocks[i].contains(addresses) &&
125
					if (blocks[i].contains(addresses) &&
125
						(! blocks[i].isFrozen() || blocks[i].isDirty())) {
126
						(! blocks[i].isFrozen() || blocks[i].isDirty())) {
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/Location.java (-8 / +9 lines)
Lines 10-31 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.mi.core.cdi;
11
package org.eclipse.cdt.debug.mi.core.cdi;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
14
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
14
15
15
/**
16
/**
16
 */
17
 */
17
public class Location implements ICDILocation {
18
public class Location implements ICDILocation {
18
19
19
	long addr;
20
	IAddress addr;
20
	String file = ""; //$NON-NLS-1$
21
	String file = ""; //$NON-NLS-1$
21
	String function = ""; //$NON-NLS-1$
22
	String function = ""; //$NON-NLS-1$
22
	int line;
23
	int line;
23
24
24
	public Location(String f, String fnct, int l) {
25
	public Location(String f, String fnct, int l) {
25
		this(f, fnct, l, 0);
26
		this(f, fnct, l, null);
26
	}
27
	}
27
28
28
	public Location(String f, String fnct, int l, long a) {
29
	public Location(String f, String fnct, int l, IAddress a) {
29
		if (f != null)
30
		if (f != null)
30
			file = f;
31
			file = f;
31
		if (fnct != null)
32
		if (fnct != null)
Lines 34-47 Link Here
34
		addr = a;  
35
		addr = a;  
35
	}
36
	}
36
37
37
	public Location(long address) {
38
	public Location(IAddress address) {
38
		addr = address;
39
		addr = address;
39
	}
40
	}
40
41
41
	/**
42
	/**
42
	 * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress()
43
	 * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress()
43
	 */
44
	 */
44
	public long getAddress() {
45
	public IAddress getAddress() {
45
		return addr;
46
		return addr;
46
	}
47
	}
47
48
Lines 86-94 Link Here
86
				}
87
				}
87
			}
88
			}
88
		}
89
		}
89
		long oaddr = location.getAddress();
90
		IAddress oaddr = location.getAddress();
90
		if (addr != 0 && oaddr != 0) {
91
		if (addr != null && oaddr != null) { //IPF_TODO: check ZERO addresses
91
			if (addr == oaddr) {
92
			if (addr.equals(oaddr)) {
92
				return true;
93
				return true;
93
			}
94
			}
94
		}
95
		}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java (-12 / +15 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.mi.core.cdi;
11
package org.eclipse.cdt.debug.mi.core.cdi;
12
12
13
import java.math.BigInteger;
13
import java.util.ArrayList;
14
import java.util.ArrayList;
14
import java.util.Arrays;
15
import java.util.Arrays;
15
import java.util.Collections;
16
import java.util.Collections;
Lines 17-22 Link Here
17
import java.util.List;
18
import java.util.List;
18
import java.util.Map;
19
import java.util.Map;
19
20
21
import org.eclipse.cdt.core.IAddress;
20
import org.eclipse.cdt.debug.core.cdi.CDIException;
22
import org.eclipse.cdt.debug.core.cdi.CDIException;
21
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
23
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
22
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
24
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
Lines 100-111 Link Here
100
	/**
102
	/**
101
	 * update one Block.
103
	 * update one Block.
102
	 */
104
	 */
103
	public Long[] update(MemoryBlock block, List aList) throws CDIException {
105
	public IAddress[] update(MemoryBlock block, List aList) throws CDIException {
104
		Target target = (Target)block.getTarget();
106
		Target target = (Target)block.getTarget();
105
		MISession miSession = target.getMISession();
107
		MISession miSession = target.getMISession();
106
		MemoryBlock newBlock = cloneBlock(block);
108
		MemoryBlock newBlock = cloneBlock(block);
107
		boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() );
109
		boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() );
108
		Long[] array = compareBlocks(block, newBlock);
110
		IAddress[] array = compareBlocks(block, newBlock);
109
		// Update the block MIDataReadMemoryInfo.
111
		// Update the block MIDataReadMemoryInfo.
110
		block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
112
		block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
111
		if (array.length > 0 || newAddress) {
113
		if (array.length > 0 || newAddress) {
Lines 126-146 Link Here
126
	 * oldBlock.getLength() == newBlock.getLength();
128
	 * oldBlock.getLength() == newBlock.getLength();
127
	 * @return Long[] array of modified addresses.
129
	 * @return Long[] array of modified addresses.
128
	 */
130
	 */
129
	Long[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException {
131
	IAddress[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException {
130
		byte[] oldBytes = oldBlock.getBytes();
132
		byte[] oldBytes = oldBlock.getBytes();
131
		byte[] newBytes = newBlock.getBytes();
133
		byte[] newBytes = newBlock.getBytes();
132
		List aList = new ArrayList(newBytes.length);
134
		List aList = new ArrayList(newBytes.length);
133
		long diff = newBlock.getStartAddress() - oldBlock.getStartAddress();
135
		BigInteger distance = newBlock.getStartAddress().distance(oldBlock.getStartAddress());
134
		if ( Math.abs( diff ) < newBytes.length ) {
136
		//IPF_TODO enshure it is OK here
137
		int diff = distance.intValue();
138
		if ( Math.abs(diff) <  newBytes.length) {
135
			for (int i = 0; i < newBytes.length; i++) {
139
			for (int i = 0; i < newBytes.length; i++) {
136
				if (i + (int)diff < oldBytes.length && i + (int)diff >= 0) {
140
				if (i + diff < oldBytes.length && i + diff >= 0) {
137
					if (oldBytes[i + (int)diff] != newBytes[i]) {
141
					if (oldBytes[i + diff] != newBytes[i]) {
138
						aList.add(new Long(newBlock.getStartAddress() + i));
142
						aList.add(newBlock.getStartAddress().add(BigInteger.valueOf(i)));
139
					}
143
					}
140
				}
144
				}
141
			}
145
			}
142
		}
146
		}
143
		return (Long[])aList.toArray(new Long[0]);
147
		return (IAddress[])aList.toArray(new IAddress[0]);
144
	}
148
	}
145
149
146
	/**
150
	/**
Lines 176-185 Link Here
176
	/**
180
	/**
177
	 * @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int)
181
	 * @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int)
178
	 */
182
	 */
179
	public ICDIMemoryBlock createMemoryBlock(long address, int length)
183
	public ICDIMemoryBlock createMemoryBlock(IAddress address, int length)
180
		throws CDIException {
184
		throws CDIException {
181
		String addr = "0x" + Long.toHexString(address); //$NON-NLS-1$
185
		return createMemoryBlock(address.toHexAddressString(), length);
182
		return createMemoryBlock(addr, length);
183
	}
186
	}
184
		
187
		
185
	/**
188
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java (-1 / +1 lines)
Lines 153-159 Link Here
153
				fLocation = new Location (miBreakpoint.getFile(),
153
				fLocation = new Location (miBreakpoint.getFile(),
154
					miBreakpoint.getFunction(),
154
					miBreakpoint.getFunction(),
155
					miBreakpoint.getLine(),
155
					miBreakpoint.getLine(),
156
					miBreakpoint.getAddress());
156
					((Target)getTarget()).getAddressFactory().createAddress(miBreakpoint.getAddress()));
157
			}
157
			}
158
		}
158
		}
159
		return fLocation;
159
		return fLocation;
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java (-2 / +3 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.mi.core.cdi.model;
11
package org.eclipse.cdt.debug.mi.core.cdi.model;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
14
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
14
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
15
import org.eclipse.cdt.debug.mi.core.output.MIAsm;
15
16
Lines 26-33 Link Here
26
	/**
27
	/**
27
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress()
28
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress()
28
	 */
29
	 */
29
	public long getAdress() {
30
	public IAddress getAdress() {
30
		return asm.getAddress();
31
		return ((Target)getTarget()).getAddressFactory().createAddress(asm.getAddress());
31
	}
32
	}
32
33
33
	/**
34
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java (-7 / +11 lines)
Lines 11-19 Link Here
11
11
12
package org.eclipse.cdt.debug.mi.core.cdi.model;
12
package org.eclipse.cdt.debug.mi.core.cdi.model;
13
13
14
import java.math.BigInteger;
14
import java.util.ArrayList;
15
import java.util.ArrayList;
15
import java.util.List;
16
import java.util.List;
16
17
18
import org.eclipse.cdt.core.IAddress;
17
import org.eclipse.cdt.debug.core.cdi.CDIException;
19
import org.eclipse.cdt.debug.core.cdi.CDIException;
18
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
20
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
19
import org.eclipse.cdt.debug.mi.core.MIException;
21
import org.eclipse.cdt.debug.mi.core.MIException;
Lines 68-74 Link Here
68
	/**
70
	/**
69
	 * @return true if any address in the array is within the block.
71
	 * @return true if any address in the array is within the block.
70
	 */
72
	 */
71
	public boolean contains(Long[] adds) {
73
	public boolean contains(IAddress[] adds) {
72
		for (int i = 0; i < adds.length; i++) {
74
		for (int i = 0; i < adds.length; i++) {
73
			if (contains(adds[i])) {
75
			if (contains(adds[i])) {
74
				return true;
76
				return true;
Lines 80-89 Link Here
80
	/**
82
	/**
81
	 * @return true if the address is within the block.
83
	 * @return true if the address is within the block.
82
	 */
84
	 */
83
	public boolean contains(Long addr) {
85
	public boolean contains(IAddress addr) {
84
		long start = getStartAddress();
86
		IAddress start = getStartAddress();
85
		long length = getLength();
87
		long length = getLength();
86
		if (start <= addr.longValue() && addr.longValue() <= start + length) {
88
		if ( start.compareTo(addr) <= 0 && 
89
		     addr.compareTo(start.add(BigInteger.valueOf(length))) <= 0 ) 
90
		{
87
			return true;
91
			return true;
88
		}
92
		}
89
		return false;
93
		return false;
Lines 130-136 Link Here
130
		Target target = (Target)getTarget();
134
		Target target = (Target)getTarget();
131
		MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager();
135
		MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager();
132
		setDirty(true);
136
		setDirty(true);
133
		Long[] addresses = mgr.update(this, null);
137
		IAddress[] addresses = mgr.update(this, null);
134
		// Check if this affects other blocks.
138
		// Check if this affects other blocks.
135
		if (addresses.length > 0) {
139
		if (addresses.length > 0) {
136
			MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession());
140
			MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession());
Lines 154-161 Link Here
154
	/**
158
	/**
155
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress()
159
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress()
156
	 */
160
	 */
157
	public long getStartAddress() {
161
	public IAddress getStartAddress() {
158
		return mem.getAddress();
162
		return ((Target)getTarget()).getAddressFactory().createAddress(mem.getAddress());
159
	}
163
	}
160
164
161
	/**
165
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java (-4 / +5 lines)
Lines 11-16 Link Here
11
11
12
package org.eclipse.cdt.debug.mi.core.cdi.model;
12
package org.eclipse.cdt.debug.mi.core.cdi.model;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
16
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
16
import org.eclipse.cdt.debug.mi.core.cdi.Session;
17
import org.eclipse.cdt.debug.mi.core.cdi.Session;
Lines 47-61 Link Here
47
	/**
48
	/**
48
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress()
49
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress()
49
	 */
50
	 */
50
	public long getStartAddress() {
51
	public IAddress getStartAddress() {
51
		return miShared.getFrom();
52
		return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getFrom());
52
	}
53
	}
53
54
54
	/**
55
	/**
55
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress()
56
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress()
56
	 */
57
	 */
57
	public long getEndAddress() {
58
	public IAddress getEndAddress() {
58
		return miShared.getTo();
59
		return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getTo());
59
	}
60
	}
60
61
61
	/**
62
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java (-3 / +5 lines)
Lines 130-139 Link Here
130
	 */
130
	 */
131
	public ICDILocation getLocation() {
131
	public ICDILocation getLocation() {
132
		if (frame != null) {
132
		if (frame != null) {
133
			return new Location(frame.getFile(), frame.getFunction(),
133
			return new Location(frame.getFile(), 
134
					frame.getLine(), frame.getAddress());
134
					            frame.getFunction(),
135
					            frame.getLine(),  
136
								((Target)getTarget()).getAddressFactory().createAddress(frame.getAddress()));
135
		}
137
		}
136
		return new Location("", "", 0, 0); //$NON-NLS-1$ //$NON-NLS-2$
138
		return new Location("", "", 0, ((Target)getTarget()).getAddressFactory().getZero()); //$NON-NLS-1$ //$NON-NLS-2$
137
	}
139
	}
138
140
139
	/**
141
	/**
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java (-7 / +45 lines)
Lines 13-18 Link Here
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.List;
14
import java.util.List;
15
15
16
import org.eclipse.cdt.core.IAddress;
17
import org.eclipse.cdt.core.IAddressFactory;
16
import org.eclipse.cdt.debug.core.cdi.CDIException;
18
import org.eclipse.cdt.debug.core.cdi.CDIException;
17
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
19
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
18
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
20
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
Lines 26-31 Link Here
26
import org.eclipse.cdt.debug.mi.core.MIException;
28
import org.eclipse.cdt.debug.mi.core.MIException;
27
import org.eclipse.cdt.debug.mi.core.MISession;
29
import org.eclipse.cdt.debug.mi.core.MISession;
28
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
30
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
31
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
29
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
32
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
30
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
33
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
31
import org.eclipse.cdt.debug.mi.core.cdi.Session;
34
import org.eclipse.cdt.debug.mi.core.cdi.Session;
Lines 52-58 Link Here
52
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
55
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
53
import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo;
56
import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo;
54
import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
57
import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
55
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
56
58
57
/**
59
/**
58
 */
60
 */
Lines 63-73 Link Here
63
	Thread[] noThreads = new Thread[0];
65
	Thread[] noThreads = new Thread[0];
64
	Thread[] currentThreads;
66
	Thread[] currentThreads;
65
	int currentThreadId;
67
	int currentThreadId;
68
	IAddressFactory addressFactory;
66
	
69
	
67
	public Target(Session s, MISession mi) {
70
	public Target(Session s, MISession mi, IAddressFactory addrFactory) {
68
		session = s;
71
		session = s;
69
		miSession = mi;
72
		miSession = mi;
70
		currentThreads = noThreads;
73
		currentThreads = noThreads;
74
		addressFactory = addrFactory;
71
	}
75
	}
72
76
73
	public MISession getMISession() {
77
	public MISession getMISession() {
Lines 464-471 Link Here
464
			loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
468
			loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
465
		} else if (location.getFunction() != null && location.getFunction().length() > 0) {
469
		} else if (location.getFunction() != null && location.getFunction().length() > 0) {
466
			loc = location.getFunction();
470
			loc = location.getFunction();
467
		} else if (location.getAddress() != 0) {
471
		} else if ( ! location.getAddress().isZero() ) {
468
			loc = "*" + location.getAddress(); //$NON-NLS-1$
472
			loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
469
		}
473
		}
470
		MIExecUntil until = factory.createMIExecUntil(loc);
474
		MIExecUntil until = factory.createMIExecUntil(loc);
471
		try {
475
		try {
Lines 575-582 Link Here
575
			loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
579
			loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
576
		} else if (location.getFunction() != null && location.getFunction().length() > 0) {
580
		} else if (location.getFunction() != null && location.getFunction().length() > 0) {
577
			loc = location.getFunction();
581
			loc = location.getFunction();
578
		} else if (location.getAddress() != 0) {
582
		} else if (! location.getAddress().isZero()) {
579
			loc = "*" + location.getAddress(); //$NON-NLS-1$
583
			loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
580
		}
584
		}
581
		MIJump jump = factory.createMIJump(loc);
585
		MIJump jump = factory.createMIJump(loc);
582
		try {
586
		try {
Lines 742-751 Link Here
742
	/* (non-Javadoc)
746
	/* (non-Javadoc)
743
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long)
747
	 * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long)
744
	 */
748
	 */
745
	public ICDILocation createLocation(long address) {
749
	public ICDILocation createLocation(IAddress address) {
746
		BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
750
		BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
747
		return bMgr.createLocation(address);
751
		return bMgr.createLocation(address);
748
	}
752
	}
753
/*	
754
	private IAddressFactory createAddressFactory() throws CDIException 
755
	{
756
		MISession mi = ((Session)getSession()).getMISession();
757
		CommandFactory cf = mi.getCommandFactory();
758
		MIGDBShowAddressSize as = cf.createMIGDBShowAddressSize();
759
		try 
760
		{
761
			mi.postCommand(as );
762
			MIGDBShowAddressSizeInfo info = (MIGDBShowAddressSizeInfo)as.getMIInfo();
763
			if (info == null)
764
			{
765
				throw new CDIException("Target is not responding");
766
			}
767
			switch ( info.getAddressSize() )
768
			{
769
				case 32:
770
					return new Addr32Factory();
771
				case 64:
772
					return new Addr64Factory();
773
				default:
774
				    throw new CDIException("Undefined address size");
775
			}
776
		}
777
		catch (MIException e) 
778
		{
779
			throw new MI2CDIException(e);
780
		}
781
	}
782
*/
783
	public IAddressFactory getAddressFactory()
784
	{
785
		return addressFactory;
786
	}
749
787
750
	
788
	
751
}
789
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java (-7 / +11 lines)
Lines 11-18 Link Here
11
11
12
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
12
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
16
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
17
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
16
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
18
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
17
19
18
/**
20
/**
Lines 29-45 Link Here
29
	/* (non-Javadoc)
31
	/* (non-Javadoc)
30
	 * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
32
	 * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
31
	 */
33
	 */
32
	public long pointerValue() throws CDIException {
34
	public IAddress pointerValue() throws CDIException {
33
		long value = 0;
35
		String valueString = getValueString().trim();
34
		String valueString = getValueString();
35
		int space = valueString.indexOf(' ');
36
		int space = valueString.indexOf(' ');
36
		if (space != -1) {
37
		if (space != -1) {
37
			valueString = valueString.substring(0, space).trim();
38
			valueString = valueString.substring(0, space).trim();
38
		}
39
		}
39
		try {
40
		try{
40
			value = Long.decode(valueString).longValue();
41
			
41
		} catch (NumberFormatException e) {
42
			return ((Target)getTarget()).getAddressFactory().createAddress(valueString);
43
		}
44
		catch(Exception e)
45
		{
46
			return null;
42
		}
47
		}
43
		return value;
44
	}
48
	}
45
}
49
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java (-6 / +11 lines)
Lines 11-18 Link Here
11
11
12
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
12
package org.eclipse.cdt.debug.mi.core.cdi.model.type;
13
13
14
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
15
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
16
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
17
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
16
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
18
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
17
19
18
/**
20
/**
Lines 32-39 Link Here
32
	/* (non-Javadoc)
34
	/* (non-Javadoc)
33
	 * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
35
	 * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
34
	 */
36
	 */
35
	public long referenceValue() throws CDIException {
37
	public IAddress referenceValue() throws CDIException {
36
		long value = 0;
37
		String valueString = getValueString().trim();
38
		String valueString = getValueString().trim();
38
		if ( valueString.startsWith("@") ) //$NON-NLS-1$
39
		if ( valueString.startsWith("@") ) //$NON-NLS-1$
39
			valueString = valueString.substring( 1 );
40
			valueString = valueString.substring( 1 );
Lines 41-50 Link Here
41
		if (space != -1) {
42
		if (space != -1) {
42
			valueString = valueString.substring(0, space).trim();
43
			valueString = valueString.substring(0, space).trim();
43
		}
44
		}
44
		try {
45
		try{
45
			value = Long.decode(valueString).longValue();
46
			
46
		} catch (NumberFormatException e) {
47
			return ((Target)getTarget()).getAddressFactory().createAddress(valueString);
48
		}
49
		catch(Exception e)
50
		{
51
			return null;
47
		}
52
		}
48
		return value;
53
		
49
	}
54
	}
50
}
55
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/Session.java (-4 / +5 lines)
Lines 13-18 Link Here
13
13
14
import java.util.Properties;
14
import java.util.Properties;
15
15
16
import org.eclipse.cdt.core.IAddressFactory;
16
import org.eclipse.cdt.debug.core.cdi.CDIException;
17
import org.eclipse.cdt.debug.core.cdi.CDIException;
17
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
18
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
18
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
19
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
Lines 54-72 Link Here
54
	SourceManager sourceManager;
55
	SourceManager sourceManager;
55
	ICDIConfiguration configuration;
56
	ICDIConfiguration configuration;
56
57
57
	public Session(MISession miSession, boolean attach) {
58
	public Session(MISession miSession, IAddressFactory addrFactory, boolean attach) {
58
		commonSetup();
59
		commonSetup();
59
		setConfiguration(new Configuration(miSession, attach));
60
		setConfiguration(new Configuration(miSession, attach));
60
61
61
		Target target = new Target(this, miSession);
62
		Target target = new Target(this, miSession, addrFactory);
62
		addTargets(new Target[] { target }, target);
63
		addTargets(new Target[] { target }, target);
63
	}
64
	}
64
65
65
	public Session(MISession miSession) {
66
	public Session(MISession miSession, IAddressFactory addrFactory) {
66
		commonSetup();
67
		commonSetup();
67
		setConfiguration(new CoreFileConfiguration());
68
		setConfiguration(new CoreFileConfiguration());
68
69
69
		Target target = new Target(this, miSession);
70
		Target target = new Target(this, miSession, addrFactory);
70
		addTargets(new Target[] { target }, target);
71
		addTargets(new Target[] { target }, target);
71
	}
72
	}
72
73
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java (-2 / +4 lines)
Lines 17-22 Link Here
17
import java.util.List;
17
import java.util.List;
18
import java.util.Map;
18
import java.util.Map;
19
19
20
import org.eclipse.cdt.core.IAddressFactory;
20
import org.eclipse.cdt.debug.core.cdi.CDIException;
21
import org.eclipse.cdt.debug.core.cdi.CDIException;
21
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
22
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
22
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
23
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
Lines 145-153 Link Here
145
	}
146
	}
146
147
147
	public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) {
148
	public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) {
149
		IAddressFactory af = ((Target)getSession().getCurrentTarget()).getAddressFactory();
148
		return !miLib.getName().equals(lib.getFileName()) ||
150
		return !miLib.getName().equals(lib.getFileName()) ||
149
			miLib.getFrom() != lib.getStartAddress() ||
151
			!af.createAddress(miLib.getFrom()).equals(lib.getStartAddress())   ||
150
			miLib.getTo() != lib.getEndAddress() ||
152
		    !af.createAddress(miLib.getTo()).equals(lib.getEndAddress()) ||
151
			miLib.isRead() != lib.areSymbolsLoaded();
153
			miLib.isRead() != lib.areSymbolsLoaded();
152
	}
154
	}
153
155
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java (-9 / +9 lines)
Lines 12-17 Link Here
12
12
13
import java.util.StringTokenizer;
13
import java.util.StringTokenizer;
14
14
15
import org.eclipse.cdt.core.IAddress;
15
import org.eclipse.cdt.debug.core.cdi.CDIException;
16
import org.eclipse.cdt.debug.core.cdi.CDIException;
16
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
17
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
17
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
18
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
Lines 142-157 Link Here
142
	/**
143
	/**
143
	 * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long)
144
	 * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long)
144
	 */
145
	 */
145
	public ICDIInstruction[] getInstructions(long start, long end) throws CDIException {
146
	public ICDIInstruction[] getInstructions(IAddress start, IAddress end) throws CDIException {
146
		Target target = (Target)getSession().getCurrentTarget();
147
		Target target = (Target)getSession().getCurrentTarget();
147
		return getInstructions(target, start, end);
148
		return getInstructions(target, start, end);
148
	}
149
	}
149
	public ICDIInstruction[] getInstructions(Target target, long start, long end) throws CDIException {
150
	public ICDIInstruction[] getInstructions(Target target, IAddress start, IAddress end) throws CDIException {
150
		MISession mi = target.getMISession();
151
		MISession mi = target.getMISession();
151
		CommandFactory factory = mi.getCommandFactory();
152
		CommandFactory factory = mi.getCommandFactory();
152
		String hex = "0x"; //$NON-NLS-1$
153
		String hex = "0x"; //$NON-NLS-1$
153
		String sa = hex + Long.toHexString(start);
154
		String sa = start.toHexAddressString();
154
		String ea = hex + Long.toHexString(end);
155
		String ea = end.toHexAddressString();
155
		MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false);
156
		MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false);
156
		try {
157
		try {
157
			mi.postCommand(dis);
158
			mi.postCommand(dis);
Lines 202-217 Link Here
202
	/**
203
	/**
203
	 * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long)
204
	 * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long)
204
	 */
205
	 */
205
	public ICDIMixedInstruction[] getMixedInstructions(long start, long end) throws CDIException {	
206
	public ICDIMixedInstruction[] getMixedInstructions(IAddress start, IAddress end) throws CDIException {	
206
		Target target = (Target)getSession().getCurrentTarget();
207
		Target target = (Target)getSession().getCurrentTarget();
207
		return getMixedInstructions(target, start, end);
208
		return getMixedInstructions(target, start, end);
208
	}
209
	}
209
	public ICDIMixedInstruction[] getMixedInstructions(Target target, long start, long end) throws CDIException {
210
	public ICDIMixedInstruction[] getMixedInstructions(Target target, IAddress start, IAddress end) throws CDIException {
210
		MISession mi = target.getMISession();
211
		MISession mi = target.getMISession();
211
		CommandFactory factory = mi.getCommandFactory();
212
		CommandFactory factory = mi.getCommandFactory();
212
		String hex = "0x"; //$NON-NLS-1$
213
		String sa = start.toHexAddressString();
213
		String sa = hex + Long.toHexString(start);
214
		String ea = end.toHexAddressString();
214
		String ea = hex + Long.toHexString(end);
215
		MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true);
215
		MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true);
216
		try {
216
		try {
217
			mi.postCommand(dis);
217
			mi.postCommand(dis);
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/command/CommandFactory.java (+4 lines)
Lines 222-227 Link Here
222
		return new MIGDBShowSolibSearchPath();
222
		return new MIGDBShowSolibSearchPath();
223
	}
223
	}
224
224
225
	public MIGDBShowAddressSize createMIGDBShowAddressSize() {
226
		return new MIGDBShowAddressSize();
227
	}
228
225
	public MIStackInfoDepth createMIStackInfoDepth() {
229
	public MIStackInfoDepth createMIStackInfoDepth() {
226
		return new MIStackInfoDepth();
230
		return new MIStackInfoDepth();
227
	}
231
	}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java (+38 lines)
Line 0 Link Here
1
/*
2
 * Created on Jun 4, 2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
6
 */
7
package org.eclipse.cdt.debug.mi.core.command;
8
9
import org.eclipse.cdt.debug.mi.core.MIException;
10
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowAddressSizeInfo;
11
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
12
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
13
14
/**
15
 * @author root
16
 *
17
 * To change the template for this generated type comment go to
18
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
19
 */
20
public class MIGDBShowAddressSize extends MIGDBShow {
21
	
22
	public MIGDBShowAddressSize () {
23
		super(new String[] { "remoteaddresssize" });
24
	}
25
	
26
	public MIInfo getMIInfo() throws MIException {
27
		MIGDBShowAddressSizeInfo info = null;
28
		MIOutput out = getMIOutput();
29
		if (out != null) {
30
			info = new MIGDBShowAddressSizeInfo(out);
31
			if (info.isError()) {
32
				throwMIException(info, out);
33
			}
34
		}
35
		return info;
36
	}
37
38
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java (-5 / +5 lines)
Lines 12-18 Link Here
12
12
13
import org.eclipse.cdt.debug.mi.core.MISession;
13
import org.eclipse.cdt.debug.mi.core.MISession;
14
14
15
15
import org.eclipse.cdt.core.IAddress;
16
16
17
/**
17
/**
18
 * This can not be detected yet by gdb/mi.
18
 * This can not be detected yet by gdb/mi.
Lines 20-37 Link Here
20
 */
20
 */
21
public class MIMemoryChangedEvent extends MIChangedEvent {
21
public class MIMemoryChangedEvent extends MIChangedEvent {
22
22
23
	Long[] addresses;
23
	IAddress[] addresses;
24
24
25
	public MIMemoryChangedEvent(MISession source, Long[] addrs) {
25
	public MIMemoryChangedEvent(MISession source, IAddress[] addrs) {
26
		this(source, 0, addrs);
26
		this(source, 0, addrs);
27
	}
27
	}
28
28
29
	public MIMemoryChangedEvent(MISession source, int token, Long[] addrs) {
29
	public MIMemoryChangedEvent(MISession source, int token, IAddress[] addrs) {
30
		super(source, token);
30
		super(source, token);
31
		addresses = addrs;
31
		addresses = addrs;
32
	}
32
	}
33
33
34
	public Long[] getAddresses() {
34
	public IAddress[] getAddresses() {
35
		return addresses;
35
		return addresses;
36
	}
36
	}
37
}
37
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java (-4 / +5 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.mi.core.event;
11
package org.eclipse.cdt.debug.mi.core.event;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.mi.core.MISession;
14
import org.eclipse.cdt.debug.mi.core.MISession;
14
15
15
16
Lines 20-39 Link Here
20
 */
21
 */
21
public class MIMemoryCreatedEvent extends MICreatedEvent {
22
public class MIMemoryCreatedEvent extends MICreatedEvent {
22
23
23
	long address;
24
	IAddress address;
24
	long totalBytes;
25
	long totalBytes;
25
26
26
	public MIMemoryCreatedEvent(MISession source, long addr, long total) {
27
	public MIMemoryCreatedEvent(MISession source, IAddress addr, long total) {
27
		this(source, 0, addr, total);
28
		this(source, 0, addr, total);
28
	}
29
	}
29
30
30
	public MIMemoryCreatedEvent(MISession source, int token, long addr, long total) {
31
	public MIMemoryCreatedEvent(MISession source, int token, IAddress addr, long total) {
31
		super(source, token);
32
		super(source, token);
32
		address = addr;
33
		address = addr;
33
		totalBytes = total;
34
		totalBytes = total;
34
	}
35
	}
35
36
36
	public long getAddress() {
37
	public IAddress getAddress() {
37
		return address;
38
		return address;
38
	}
39
	}
39
40
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/GDBDebugger.java (-3 / +3 lines)
Lines 73-79 Link Here
73
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
73
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
74
			File cwd = exe.getProject().getLocation().toFile();
74
			File cwd = exe.getProject().getLocation().toFile();
75
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
75
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
76
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit);
76
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, cwd, gdbinit);
77
			initializeLibraries(config, session);
77
			initializeLibraries(config, session);
78
			return session;
78
			return session;
79
		} catch (IOException e) {
79
		} catch (IOException e) {
Lines 105-111 Link Here
105
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
105
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
106
			File cwd = exe.getProject().getLocation().toFile();
106
			File cwd = exe.getProject().getLocation().toFile();
107
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
107
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
108
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit);
108
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, pid, null, cwd, gdbinit);
109
			initializeLibraries(config, session);
109
			initializeLibraries(config, session);
110
			return session;
110
			return session;
111
		} catch (IOException e) {
111
		} catch (IOException e) {
Lines 137-143 Link Here
137
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
137
			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
138
			File cwd = exe.getProject().getLocation().toFile();
138
			File cwd = exe.getProject().getLocation().toFile();
139
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
139
			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
140
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit);
140
			session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, corefile.toFile(), cwd, gdbinit);
141
			initializeLibraries(config, session);
141
			initializeLibraries(config, session);
142
			return session;
142
			return session;
143
		} catch (IOException e) {
143
		} catch (IOException e) {
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java (-2 / +2 lines)
Lines 69-75 Link Here
69
				remote += ":"; //$NON-NLS-1$
69
				remote += ":"; //$NON-NLS-1$
70
				remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$
70
				remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$
71
				String[] args = new String[] {"remote", remote}; //$NON-NLS-1$
71
				String[] args = new String[] {"remote", remote}; //$NON-NLS-1$
72
				session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), 0, args, cwd, gdbinit);
72
				session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, 0, args, cwd, gdbinit);
73
			} else {
73
			} else {
74
				MIPlugin plugin = MIPlugin.getDefault();
74
				MIPlugin plugin = MIPlugin.getDefault();
75
				Preferences prefs = plugin.getPluginPreferences();
75
				Preferences prefs = plugin.getPluginPreferences();
Lines 77-83 Link Here
77
77
78
				String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$
78
				String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$
79
				String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$
79
				String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$
80
				session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), -1, null, cwd, gdbinit);
80
				session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, -1, null, cwd, gdbinit);
81
				ICDITarget[] targets = session.getTargets();
81
				ICDITarget[] targets = session.getTargets();
82
				for (int i = 0; i < targets.length; ++i) {
82
				for (int i = 0; i < targets.length; ++i) {
83
					Target target = (Target)targets[i];
83
					Target target = (Target)targets[i];
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/MIPlugin.java (-11 / +27 lines)
Lines 21-26 Link Here
21
import java.util.MissingResourceException;
21
import java.util.MissingResourceException;
22
import java.util.ResourceBundle;
22
import java.util.ResourceBundle;
23
23
24
import org.eclipse.cdt.core.CCorePlugin;
25
import org.eclipse.cdt.core.IAddressFactory;
26
import org.eclipse.cdt.core.model.IBinary;
27
import org.eclipse.cdt.core.model.ICElement;
24
import org.eclipse.cdt.debug.core.cdi.ICDISession;
28
import org.eclipse.cdt.debug.core.cdi.ICDISession;
25
import org.eclipse.cdt.debug.mi.core.cdi.Session;
29
import org.eclipse.cdt.debug.mi.core.cdi.Session;
26
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
30
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
Lines 30-35 Link Here
30
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
34
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
31
import org.eclipse.cdt.utils.pty.PTY;
35
import org.eclipse.cdt.utils.pty.PTY;
32
import org.eclipse.cdt.utils.spawner.ProcessFactory;
36
import org.eclipse.cdt.utils.spawner.ProcessFactory;
37
import org.eclipse.core.resources.IFile;
38
import org.eclipse.core.runtime.IPluginDescriptor;
33
import org.eclipse.core.runtime.Plugin;
39
import org.eclipse.core.runtime.Plugin;
34
import org.eclipse.core.runtime.Preferences;
40
import org.eclipse.core.runtime.Preferences;
35
import org.osgi.framework.BundleContext;
41
import org.osgi.framework.BundleContext;
Lines 113-119 Link Here
113
	 * @return ICDISession
119
	 * @return ICDISession
114
	 * @throws MIException
120
	 * @throws MIException
115
	 */
121
	 */
116
	public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit) throws IOException, MIException {
122
	public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit) throws IOException, MIException {
117
		PTY pty = null;
123
		PTY pty = null;
118
		boolean failed = false;
124
		boolean failed = false;
119
125
Lines 156-162 Link Here
156
	 * @return ICDISession
162
	 * @return ICDISession
157
	 * @throws IOException
163
	 * @throws IOException
158
	 */
164
	 */
159
	public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit, PTY pty) throws IOException, MIException {
165
	public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit, PTY pty) throws IOException, MIException {
160
		if (gdb == null || gdb.length() == 0) {
166
		if (gdb == null || gdb.length() == 0) {
161
			gdb =  GDB;
167
			gdb =  GDB;
162
		}
168
		}
Lines 170-182 Link Here
170
			if (program == null) {
176
			if (program == null) {
171
				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$
177
				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$
172
			} else {
178
			} else {
173
				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$
179
				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$
174
			}
180
			}
175
		} else {
181
		} else {
176
			if (program == null) {
182
			if (program == null) {
177
				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$
183
				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$
178
			} else {
184
			} else {
179
				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$
185
				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$
180
			}
186
			}
181
		}
187
		}
182
188
Lines 206-212 Link Here
206
			// If an exception is thrown that means ok
212
			// If an exception is thrown that means ok
207
			// we did not attach to any target.
213
			// we did not attach to any target.
208
		}
214
		}
209
		return new Session(session, false);
215
		return new Session(session, getAddressFactory(program), false);
210
	}
216
	}
211
217
212
	/**
218
	/**
Lines 216-222 Link Here
216
	 * @return ICDISession
222
	 * @return ICDISession
217
	 * @throws IOException
223
	 * @throws IOException
218
	 */
224
	 */
219
	public ICDISession createCSession(String gdb, File program, File core, File cwd, String gdbinit) throws IOException, MIException {
225
	public ICDISession createCSession(String gdb, IFile program, File core, File cwd, String gdbinit) throws IOException, MIException {
220
		if (gdb == null || gdb.length() == 0) {
226
		if (gdb == null || gdb.length() == 0) {
221
			gdb =  GDB;
227
			gdb =  GDB;
222
		}
228
		}
Lines 229-235 Link Here
229
		if (program == null) {
235
		if (program == null) {
230
			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$
236
			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$
231
		} else {
237
		} else {
232
			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$
238
			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$
233
		}
239
		}
234
		Process pgdb = getGDBProcess(args);
240
		Process pgdb = getGDBProcess(args);
235
		MISession session;
241
		MISession session;
Lines 239-245 Link Here
239
			pgdb.destroy();
245
			pgdb.destroy();
240
			throw e;
246
			throw e;
241
		}
247
		}
242
		return new Session(session);
248
		return new Session(session, getAddressFactory(program));
243
	}
249
	}
244
250
245
	/**
251
	/**
Lines 249-255 Link Here
249
	 * @return ICDISession
255
	 * @return ICDISession
250
	 * @throws IOException
256
	 * @throws IOException
251
	 */
257
	 */
252
	public ICDISession createCSession(String gdb, File program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException {
258
	public ICDISession createCSession(String gdb, IFile program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException {
253
		if (gdb == null || gdb.length() == 0) {
259
		if (gdb == null || gdb.length() == 0) {
254
			gdb =  GDB;
260
			gdb =  GDB;
255
		}
261
		}
Lines 262-268 Link Here
262
		if (program == null) {
268
		if (program == null) {
263
			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$
269
			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$
264
		} else {
270
		} else {
265
			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$
271
			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$
266
		}
272
		}
267
		Process pgdb = getGDBProcess(args);
273
		Process pgdb = getGDBProcess(args);
268
		MISession session;
274
		MISession session;
Lines 298-304 Link Here
298
		//@@@ We have to manually set the suspended state when we attach
304
		//@@@ We have to manually set the suspended state when we attach
299
		session.getMIInferior().setSuspended();
305
		session.getMIInferior().setSuspended();
300
		session.getMIInferior().update();
306
		session.getMIInferior().update();
301
		return new Session(session, true);
307
		return new Session(session, getAddressFactory(program), true);
302
	}
308
	}
303
309
304
	/**
310
	/**
Lines 423-428 Link Here
423
		getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT);
429
		getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT);
424
	}
430
	}
425
431
432
	protected IAddressFactory getAddressFactory(IFile exe)
433
	{
434
		ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( exe );
435
		if ( cFile instanceof IBinary )
436
		{
437
			return ((IBinary)cFile).getAddressFactory();
438
		}
439
		return null;		 
440
	}
441
	
426
	/* (non-Javadoc)
442
	/* (non-Javadoc)
427
	 * @see org.eclipse.core.runtime.Plugin#shutdown()
443
	 * @see org.eclipse.core.runtime.Plugin#shutdown()
428
	 */
444
	 */
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIAsm.java (-4 / +4 lines)
Lines 14-20 Link Here
14
 * Represent a GDB Tuple MI assembly response.
14
 * Represent a GDB Tuple MI assembly response.
15
 */
15
 */
16
public class MIAsm {
16
public class MIAsm {
17
	long address;
17
	String address;
18
	String function = ""; //$NON-NLS-1$
18
	String function = ""; //$NON-NLS-1$
19
	String opcode = ""; //$NON-NLS-1$
19
	String opcode = ""; //$NON-NLS-1$
20
	String args = ""; //$NON-NLS-1$
20
	String args = ""; //$NON-NLS-1$
Lines 24-30 Link Here
24
		parse(tuple);
24
		parse(tuple);
25
	}
25
	}
26
26
27
	public long getAddress() {
27
	public String getAddress() {
28
		return address;
28
		return address;
29
	}
29
	}
30
30
Lines 43-49 Link Here
43
	public String toString() {
43
	public String toString() {
44
		StringBuffer buffer = new StringBuffer();
44
		StringBuffer buffer = new StringBuffer();
45
		buffer.append('{');
45
		buffer.append('{');
46
		buffer.append("address=\"" + Long.toHexString(address) +"\"");  //$NON-NLS-1$//$NON-NLS-2$
46
		buffer.append("address=\"" + address +"\"");  //$NON-NLS-1$//$NON-NLS-2$
47
		buffer.append(",func-name=\"" + function + "\"");  //$NON-NLS-1$//$NON-NLS-2$
47
		buffer.append(",func-name=\"" + function + "\"");  //$NON-NLS-1$//$NON-NLS-2$
48
		buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$
48
		buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$
49
		buffer.append(",inst=\"" + getInstruction() + "\"");  //$NON-NLS-1$//$NON-NLS-2$
49
		buffer.append(",inst=\"" + getInstruction() + "\"");  //$NON-NLS-1$//$NON-NLS-2$
Lines 64-70 Link Here
64
64
65
			if (var.equals("address")) { //$NON-NLS-1$
65
			if (var.equals("address")) { //$NON-NLS-1$
66
				try {
66
				try {
67
					address = Long.decode(str.trim()).longValue();
67
					address = str.trim();
68
				} catch (NumberFormatException e) {
68
				} catch (NumberFormatException e) {
69
				}
69
				}
70
			} else if (var.equals("func-name")) { //$NON-NLS-1$
70
			} else if (var.equals("func-name")) { //$NON-NLS-1$
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIBreakpoint.java (-3 / +3 lines)
Lines 54-60 Link Here
54
	String type = ""; //$NON-NLS-1$
54
	String type = ""; //$NON-NLS-1$
55
	String disp = ""; //$NON-NLS-1$
55
	String disp = ""; //$NON-NLS-1$
56
	boolean enabled;
56
	boolean enabled;
57
	long address;
57
	String address;
58
	String func = "";  //$NON-NLS-1$
58
	String func = "";  //$NON-NLS-1$
59
	String file = ""; //$NON-NLS-1$
59
	String file = ""; //$NON-NLS-1$
60
	int line;
60
	int line;
Lines 146-152 Link Here
146
		enabled = e;
146
		enabled = e;
147
	}
147
	}
148
148
149
	public long getAddress() {
149
	public String getAddress() {
150
		return address;
150
		return address;
151
	}
151
	}
152
152
Lines 228-234 Link Here
228
				enabled = str.equals("y"); //$NON-NLS-1$
228
				enabled = str.equals("y"); //$NON-NLS-1$
229
			} else if (var.equals("addr")) { //$NON-NLS-1$
229
			} else if (var.equals("addr")) { //$NON-NLS-1$
230
				try {
230
				try {
231
					address = Long.decode(str.trim()).longValue();
231
					address = str.trim();
232
				} catch (NumberFormatException e) {
232
				} catch (NumberFormatException e) {
233
				}
233
				}
234
			} else if (var.equals("func")) { //$NON-NLS-1$
234
			} else if (var.equals("func")) { //$NON-NLS-1$
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIDataReadMemoryInfo.java (-3 / +3 lines)
Lines 18-24 Link Here
18
 */
18
 */
19
public class MIDataReadMemoryInfo extends MIInfo {
19
public class MIDataReadMemoryInfo extends MIInfo {
20
20
21
	long addr;
21
	String addr;
22
	long nextRow;
22
	long nextRow;
23
	long prevRow;
23
	long prevRow;
24
	long nextPage;
24
	long nextPage;
Lines 33-39 Link Here
33
		parse();
33
		parse();
34
	}
34
	}
35
35
36
	public long getAddress() {
36
	public String getAddress() {
37
		return addr;
37
		return addr;
38
	}
38
	}
39
39
Lines 96-102 Link Here
96
96
97
					if (var.equals("addr")) { //$NON-NLS-1$
97
					if (var.equals("addr")) { //$NON-NLS-1$
98
						try {
98
						try {
99
							addr = Long.decode(str.trim()).longValue();
99
							addr = str.trim();
100
						} catch (NumberFormatException e) {
100
						} catch (NumberFormatException e) {
101
						}
101
						}
102
					} else if (var.equals("nr-bytes")) { //$NON-NLS-1$
102
					} else if (var.equals("nr-bytes")) { //$NON-NLS-1$
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIFrame.java (-4 / +4 lines)
Lines 16-22 Link Here
16
public class MIFrame {
16
public class MIFrame {
17
17
18
	int level;
18
	int level;
19
	long addr;
19
	String addr;
20
	String func = ""; //$NON-NLS-1$
20
	String func = ""; //$NON-NLS-1$
21
	String file = ""; //$NON-NLS-1$
21
	String file = ""; //$NON-NLS-1$
22
	int line;
22
	int line;
Lines 42-48 Link Here
42
		return line;
42
		return line;
43
	}
43
	}
44
44
45
	public long getAddress() {
45
	public String getAddress() {
46
		return addr;
46
		return addr;
47
	}
47
	}
48
48
Lines 53-59 Link Here
53
	public String toString() {
53
	public String toString() {
54
		StringBuffer buffer = new StringBuffer();
54
		StringBuffer buffer = new StringBuffer();
55
		buffer.append("level=\"" + level + "\"");  //$NON-NLS-1$//$NON-NLS-2$
55
		buffer.append("level=\"" + level + "\"");  //$NON-NLS-1$//$NON-NLS-2$
56
		buffer.append(",addr=\"" + Long.toHexString(addr) + "\"");  //$NON-NLS-1$//$NON-NLS-2$
56
		buffer.append(",addr=\"" + addr + "\"");  //$NON-NLS-1$//$NON-NLS-2$
57
		buffer.append(",func=\"" + func + "\"");  //$NON-NLS-1$//$NON-NLS-2$
57
		buffer.append(",func=\"" + func + "\"");  //$NON-NLS-1$//$NON-NLS-2$
58
		buffer.append(",file=\"" + file + "\"");  //$NON-NLS-1$//$NON-NLS-2$
58
		buffer.append(",file=\"" + file + "\"");  //$NON-NLS-1$//$NON-NLS-2$
59
		buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
59
		buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
Lines 86-92 Link Here
86
				}
86
				}
87
			} else if (var.equals("addr")) { //$NON-NLS-1$
87
			} else if (var.equals("addr")) { //$NON-NLS-1$
88
				try {
88
				try {
89
					addr = Long.decode(str.trim()).longValue();
89
					addr = str.trim();
90
				} catch (NumberFormatException e) {
90
				} catch (NumberFormatException e) {
91
				}
91
				}
92
			} else if (var.equals("func")) { //$NON-NLS-1$
92
			} else if (var.equals("func")) { //$NON-NLS-1$
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIGDBShowAddressSizeInfo.java (+25 lines)
Line 0 Link Here
1
/*
2
 * Created on Jun 7, 2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
6
 */
7
package org.eclipse.cdt.debug.mi.core.output;
8
9
/**
10
 * @author root
11
 *
12
 * To change the template for this generated type comment go to
13
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
14
 */
15
public class MIGDBShowAddressSizeInfo extends MIGDBShowInfo {
16
17
	public MIGDBShowAddressSizeInfo(MIOutput o) {
18
		super(o);
19
	}
20
21
	public int getAddressSize()
22
	{
23
		return Integer.parseInt(getValue()); 
24
	}
25
}
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java (-16 / +7 lines)
Lines 80-87 Link Here
80
		if (str.length() > 0) {
80
		if (str.length() > 0) {
81
			// Pass the header
81
			// Pass the header
82
			int index = -1;
82
			int index = -1;
83
			long from = 0;
83
			String from = "";
84
			long to = 0;
84
			String to = "";
85
			boolean syms = false;
85
			boolean syms = false;
86
			String name = ""; //$NON-NLS-1$
86
			String name = ""; //$NON-NLS-1$
87
87
Lines 102-117 Link Here
102
						}
102
						}
103
						break;
103
						break;
104
					case 2 : // second column is "To"
104
					case 2 : // second column is "To"
105
						try {
105
							to = sub;
106
							to = Long.decode(sub).longValue();
107
						} catch (NumberFormatException e) {
108
						}
109
						break;
106
						break;
110
					case 3 : // first column is "From"
107
					case 3 : // first column is "From"
111
						try {
108
							from = sub;
112
							from = Long.decode(sub).longValue();
113
						} catch (NumberFormatException e) {
114
						}
115
						break;
109
						break;
116
				}
110
				}
117
			}
111
			}
Lines 123-130 Link Here
123
	}
117
	}
124
118
125
	void parseWinShared(String str, List aList) {
119
	void parseWinShared(String str, List aList) {
126
		long from = 0;
120
		String from = "";
127
		long to = 0;
121
		String to = "";
128
		boolean syms = true;
122
		boolean syms = true;
129
123
130
		int index = str.lastIndexOf(' ');
124
		int index = str.lastIndexOf(' ');
Lines 134-143 Link Here
134
			if (!sub.startsWith("0x")) { //$NON-NLS-1$
128
			if (!sub.startsWith("0x")) { //$NON-NLS-1$
135
				sub = "0x" + sub; //$NON-NLS-1$
129
				sub = "0x" + sub; //$NON-NLS-1$
136
			}
130
			}
137
			try {
131
			from = sub;
138
				from = Long.decode(sub).longValue();
139
			} catch (NumberFormatException e) {
140
			}
141
			str = str.substring(0, index).trim();
132
			str = str.substring(0, index).trim();
142
		}
133
		}
143
		MIShared s = new MIShared(from, to, syms, str.trim());
134
		MIShared s = new MIShared(from, to, syms, str.trim());
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIMemory.java (-4 / +4 lines)
Lines 14-20 Link Here
14
 * GDB/MI memory parsing.
14
 * GDB/MI memory parsing.
15
 */
15
 */
16
public class MIMemory {
16
public class MIMemory {
17
	long addr;
17
	String addr;
18
	long [] data = new long[0];
18
	long [] data = new long[0];
19
	String ascii = ""; //$NON-NLS-1$
19
	String ascii = ""; //$NON-NLS-1$
20
20
Lines 22-28 Link Here
22
		parse(tuple);
22
		parse(tuple);
23
	}
23
	}
24
24
25
	public long getAddress() {
25
	public String getAddress() {
26
		return addr;
26
		return addr;
27
	}
27
	}
28
28
Lines 36-42 Link Here
36
36
37
	public String toSting() {
37
	public String toSting() {
38
		StringBuffer buffer = new StringBuffer();
38
		StringBuffer buffer = new StringBuffer();
39
		buffer.append("addr=\"" + Long.toHexString(addr) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
39
		buffer.append("addr=\"" + addr + "\""); //$NON-NLS-1$ //$NON-NLS-2$
40
		buffer.append("data=[");  //$NON-NLS-1$
40
		buffer.append("data=[");  //$NON-NLS-1$
41
		for (int i = 0 ; i < data.length; i++) {
41
		for (int i = 0 ; i < data.length; i++) {
42
			if (i != 0) {
42
			if (i != 0) {
Lines 63-69 Link Here
63
63
64
			if (var.equals("addr")) { //$NON-NLS-1$
64
			if (var.equals("addr")) { //$NON-NLS-1$
65
				try {
65
				try {
66
					addr = Long.decode(str.trim()).longValue();
66
					addr = str.trim();
67
				} catch (NumberFormatException e) {
67
				} catch (NumberFormatException e) {
68
				}
68
				}
69
			} else if (var.equals("data")) { //$NON-NLS-1$
69
			} else if (var.equals("data")) { //$NON-NLS-1$
(-)workspace-old/org.eclipse.cdt.debug.mi.core/src-cdtmicore/org/eclipse/cdt/debug/mi/core/output/MIShared.java (-5 / +5 lines)
Lines 16-38 Link Here
16
 */
16
 */
17
public class MIShared {
17
public class MIShared {
18
18
19
	long from;
19
	String from;
20
	long to;
20
	String to;
21
	boolean isread;
21
	boolean isread;
22
	String name;
22
	String name;
23
23
24
	public MIShared (long start, long end, boolean read, String location) {
24
	public MIShared (String start, String end, boolean read, String location) {
25
		from = start;
25
		from = start;
26
		to = end;
26
		to = end;
27
		isread = read;
27
		isread = read;
28
		name = location;
28
		name = location;
29
	}
29
	}
30
30
31
	public long getFrom() {
31
	public String getFrom() {
32
		return from;
32
		return from;
33
	}
33
	}
34
34
35
	public long getTo() {
35
	public String getTo() {
36
		return to;
36
		return to;
37
	}
37
	}
38
38
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/actions/JumpToLineActionDelegate.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.actions;
11
package org.eclipse.cdt.debug.internal.ui.actions;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.core.resources.FileStorage;
14
import org.eclipse.cdt.core.resources.FileStorage;
14
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
15
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
15
import org.eclipse.cdt.debug.core.model.IJumpToLine;
16
import org.eclipse.cdt.debug.core.model.IJumpToLine;
Lines 176-182 Link Here
176
		}
177
		}
177
	}
178
	}
178
179
179
	protected void jumpToAddress( long address )
180
	protected void jumpToAddress( IAddress address )
180
	{
181
	{
181
		IJumpToAddress target = (IJumpToAddress)getDebugTarget().getAdapter( IJumpToAddress.class );
182
		IJumpToAddress target = (IJumpToAddress)getDebugTarget().getAdapter( IJumpToAddress.class );
182
		if ( target != null )
183
		if ( target != null )
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/actions/ResumeAtLineActionDelegate.java (-2 / +3 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.actions;
11
package org.eclipse.cdt.debug.internal.ui.actions;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.CDIDebugModel;
14
import org.eclipse.cdt.debug.core.CDIDebugModel;
14
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
15
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
15
import org.eclipse.cdt.debug.core.model.IJumpToLine;
16
import org.eclipse.cdt.debug.core.model.IJumpToLine;
Lines 247-253 Link Here
247
			}
248
			}
248
			ITextSelection textSelection = (ITextSelection)selection;
249
			ITextSelection textSelection = (ITextSelection)selection;
249
			int lineNumber = textSelection.getStartLine() + 1;
250
			int lineNumber = textSelection.getStartLine() + 1;
250
			long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
251
			IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
251
			return jumpToAddress.canJumpToAddress( address );
252
			return jumpToAddress.canJumpToAddress( address );
252
		}
253
		}
253
		return false;
254
		return false;
Lines 287-293 Link Here
287
			else {
288
			else {
288
				ITextSelection textSelection = (ITextSelection)selection;
289
				ITextSelection textSelection = (ITextSelection)selection;
289
				int lineNumber = textSelection.getStartLine() + 1;
290
				int lineNumber = textSelection.getStartLine() + 1;
290
				long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
291
				IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
291
				IJumpToAddress jumpToAddress = (IJumpToAddress)((IAdaptable)debugTarget).getAdapter( IJumpToAddress.class );
292
				IJumpToAddress jumpToAddress = (IJumpToAddress)((IAdaptable)debugTarget).getAdapter( IJumpToAddress.class );
292
				if ( jumpToAddress != null )
293
				if ( jumpToAddress != null )
293
					jumpToAddress.jumpToAddress( address );
294
					jumpToAddress.jumpToAddress( address );
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/actions/RunToLineAdapter.java (-1 / +2 lines)
Lines 10-15 Link Here
10
 ***********************************************************************/
10
 ***********************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.actions;
11
package org.eclipse.cdt.debug.internal.ui.actions;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.CDIDebugModel;
14
import org.eclipse.cdt.debug.core.CDIDebugModel;
14
import org.eclipse.cdt.debug.core.model.IRunToAddress;
15
import org.eclipse.cdt.debug.core.model.IRunToAddress;
15
import org.eclipse.cdt.debug.core.model.IRunToLine;
16
import org.eclipse.cdt.debug.core.model.IRunToLine;
Lines 83-89 Link Here
83
			else {
84
			else {
84
				ITextSelection textSelection = (ITextSelection)selection;
85
				ITextSelection textSelection = (ITextSelection)selection;
85
				int lineNumber = textSelection.getStartLine() + 1;
86
				int lineNumber = textSelection.getStartLine() + 1;
86
				long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
87
				IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
87
				if ( target instanceof IAdaptable ) {
88
				if ( target instanceof IAdaptable ) {
88
					IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
89
					IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
89
					if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) {
90
					if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) {
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/actions/ToggleBreakpointAdapter.java (-2 / +3 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.actions;
11
package org.eclipse.cdt.debug.internal.ui.actions;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.core.model.CModelException;
14
import org.eclipse.cdt.core.model.CModelException;
14
import org.eclipse.cdt.core.model.IDeclaration;
15
import org.eclipse.cdt.core.model.IDeclaration;
15
import org.eclipse.cdt.core.model.IFunction;
16
import org.eclipse.cdt.core.model.IFunction;
Lines 110-117 Link Here
110
					errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
111
					errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
111
				}
112
				}
112
				else {
113
				else {
113
					long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
114
					IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
114
					if ( address == 0 ) {
115
					if ( address == null ) {
115
						errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$						
116
						errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$						
116
					}
117
					}
117
					else {
118
					else {
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java (-10 / +1 lines)
Lines 24-39 Link Here
24
 */
24
 */
25
public class CDebugUIUtils
25
public class CDebugUIUtils
26
{
26
{
27
	static public String toHexAddressString( long address )
27
28
	{
29
		String tmp = Long.toHexString( address );
30
		char[] prefix = new char[10 - tmp.length()];
31
		prefix[0] = '0';
32
		prefix[1] = 'x';
33
		for ( int i = 2; i < prefix.length; ++i )
34
			prefix[i] = '0';
35
		return new String( prefix ) + tmp;
36
	} 
37
28
38
	static public IRegion findWord( IDocument document, int offset ) 
29
	static public IRegion findWord( IDocument document, int offset ) 
39
	{
30
	{
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java (-2 / +1 lines)
Lines 703-711 Link Here
703
703
704
	protected StringBuffer appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws CoreException {
704
	protected StringBuffer appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws CoreException {
705
		try {
705
		try {
706
			long address = Long.parseLong( breakpoint.getAddress() );
707
			label.append( ' ' );
706
			label.append( ' ' );
708
			label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.27" ), new String[]{ CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$
707
			label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.27" ), new String[]{ breakpoint.getAddress() } ) ); //$NON-NLS-1$
709
		}
708
		}
710
		catch( NumberFormatException e ) {
709
		catch( NumberFormatException e ) {
711
		}
710
		}
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/propertypages/CBreakpointPropertyPage.java (-8 / +1 lines)
Lines 13-19 Link Here
13
import java.util.ArrayList;
13
import java.util.ArrayList;
14
import java.util.Iterator;
14
import java.util.Iterator;
15
import java.util.List;
15
import java.util.List;
16
import org.eclipse.cdt.debug.core.CDebugUtils;
16
17
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
17
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
18
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
18
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
19
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
19
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
Lines 293-305 Link Here
293
			ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
293
			ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
294
			addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.6" ) ) );  //$NON-NLS-1$//$NON-NLS-2$
294
			addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.6" ) ) );  //$NON-NLS-1$//$NON-NLS-2$
295
			String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
295
			String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
296
			try {
297
				address = CDebugUtils.toHexAddressString( Long.parseLong( abrkpt.getAddress() ) );
298
			}
299
			catch( CoreException e ) {
300
			}
301
			catch( NumberFormatException e ) {
302
			}
303
			if ( address != null ) {
296
			if ( address != null ) {
304
				addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
297
				addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
305
			}
298
			}
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyEditorInput.java (-19 / +23 lines)
Lines 11-16 Link Here
11
package org.eclipse.cdt.debug.internal.ui.views.disassembly;
11
package org.eclipse.cdt.debug.internal.ui.views.disassembly;
12
12
13
import java.util.Arrays;
13
import java.util.Arrays;
14
15
import org.eclipse.cdt.core.IAddress;
14
import org.eclipse.cdt.debug.core.CDIDebugModel;
16
import org.eclipse.cdt.debug.core.CDIDebugModel;
15
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
17
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
16
import org.eclipse.cdt.debug.core.model.IAsmSourceLine;
18
import org.eclipse.cdt.debug.core.model.IAsmSourceLine;
Lines 20-26 Link Here
20
import org.eclipse.cdt.debug.core.model.ICStackFrame;
22
import org.eclipse.cdt.debug.core.model.ICStackFrame;
21
import org.eclipse.cdt.debug.core.model.IDisassembly;
23
import org.eclipse.cdt.debug.core.model.IDisassembly;
22
import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
24
import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
23
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
24
import org.eclipse.core.runtime.CoreException;
25
import org.eclipse.core.runtime.CoreException;
25
import org.eclipse.debug.core.DebugException;
26
import org.eclipse.debug.core.DebugException;
26
import org.eclipse.debug.core.DebugPlugin;
27
import org.eclipse.debug.core.DebugPlugin;
Lines 67-73 Link Here
67
	 * @param disassembly
68
	 * @param disassembly
68
	 * @param instructions
69
	 * @param instructions
69
	 */
70
	 */
70
	private DisassemblyEditorInput( IDisassemblyBlock block ) {
71
	private DisassemblyEditorInput( IDisassemblyBlock block) {
71
		fBlock = block;
72
		fBlock = block;
72
		createContents();
73
		createContents();
73
	}
74
	}
Lines 125-131 Link Here
125
		return fContents;
126
		return fContents;
126
	}
127
	}
127
128
128
	public int getInstructionLine( long address ) {
129
	public int getInstructionLine( IAddress address ) {
129
		if ( fBlock != null ) {
130
		if ( fBlock != null ) {
130
			IAsmSourceLine[] lines = fBlock.getSourceLines();
131
			IAsmSourceLine[] lines = fBlock.getSourceLines();
131
			int result = 0;
132
			int result = 0;
Lines 134-146 Link Here
134
				++result;
135
				++result;
135
				for ( int j = 0; j < instructions.length; ++j ) {
136
				for ( int j = 0; j < instructions.length; ++j ) {
136
					++result;
137
					++result;
137
					if ( instructions[j].getAdress() == address ) {
138
					if ( address.compareTo(instructions[j].getAdress()) ==  0) {
138
						return result;
139
						return result;
139
					}
140
					}
140
				}
141
				}
141
			}
142
			}
142
		}
143
		}
143
		return 0;
144
		return -1;
144
	}
145
	}
145
146
146
	public int getInstructionLine( ICLineBreakpoint breakpoint ) {
147
	public int getInstructionLine( ICLineBreakpoint breakpoint ) {
Lines 150-157 Link Here
150
				IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
151
				IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
151
				if ( bt != null ) {
152
				if ( bt != null ) {
152
					try {
153
					try {
153
						long address = bt.getBreakpointAddress( breakpoint );
154
						IAddress address = bt.getBreakpointAddress( breakpoint );
154
						if ( address != 0 )
155
						if ( ! address.isZero()  )
155
							return getInstructionLine( address );
156
							return getInstructionLine( address );
156
					}
157
					}
157
					catch( DebugException e ) {
158
					catch( DebugException e ) {
Lines 159-168 Link Here
159
				}
160
				}
160
			}
161
			}
161
		}
162
		}
162
		return 0;
163
		return -1;
163
	}
164
	}
164
165
165
	public long getAddress( int lineNumber ) {
166
	public IAddress getAddress( int lineNumber ) {
166
		if ( fBlock != null ) {
167
		if ( fBlock != null ) {
167
			IAsmSourceLine[] lines = fBlock.getSourceLines();
168
			IAsmSourceLine[] lines = fBlock.getSourceLines();
168
			int current = 0;
169
			int current = 0;
Lines 176-182 Link Here
176
				current += instructions.length;
177
				current += instructions.length;
177
			}
178
			}
178
		}
179
		}
179
		return 0;
180
		return null;
180
	}
181
	}
181
182
182
	public String getModuleFile() {
183
	public String getModuleFile() {
Lines 185-194 Link Here
185
186
186
	public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException {
187
	public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException {
187
		DisassemblyEditorInput input = null;
188
		DisassemblyEditorInput input = null;
188
		IDisassembly disassembly = ((ICDebugTarget)frame.getDebugTarget()).getDisassembly();
189
		ICDebugTarget target = ((ICDebugTarget)frame.getDebugTarget());
190
		IDisassembly disassembly = target.getDisassembly();
189
		if ( disassembly != null ) {
191
		if ( disassembly != null ) {
190
			IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame );
192
			IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame );
191
			input = new DisassemblyEditorInput( block );
193
			input = new DisassemblyEditorInput( block);
192
		}
194
		}
193
		return input;
195
		return input;
194
	}
196
	}
Lines 216-222 Link Here
216
					}
218
					}
217
				}
219
				}
218
			}
220
			}
219
			int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset );
221
			int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset,
222
														 fBlock.getSourceLines()[0].getInstructions()[0].getAdress().getCharsNum());
220
			int argPosition = instrPos + maxOpcodeLength + 1;
223
			int argPosition = instrPos + maxOpcodeLength + 1;
221
			if ( fBlock.isMixedMode() )
224
			if ( fBlock.isMixedMode() )
222
				fSourceRegions = new IRegion[mi.length]; 
225
				fSourceRegions = new IRegion[mi.length]; 
Lines 241-247 Link Here
241
		Arrays.fill( spaces, ' ' );
244
		Arrays.fill( spaces, ' ' );
242
		StringBuffer sb = new StringBuffer();
245
		StringBuffer sb = new StringBuffer();
243
		if ( instruction != null ) {
246
		if ( instruction != null ) {
244
			sb.append( CDebugUIUtils.toHexAddressString( instruction.getAdress() ) );
247
			sb.append( instruction.getAdress().toHexAddressString() );
245
			sb.append( ' ' );
248
			sb.append( ' ' );
246
			String functionName = instruction.getFunctionName();
249
			String functionName = instruction.getFunctionName();
247
			if ( functionName != null && functionName.length() > 0 ) {
250
			if ( functionName != null && functionName.length() > 0 ) {
Lines 262-269 Link Here
262
		return sb.toString();
265
		return sb.toString();
263
	}
266
	}
264
267
265
	private int calculateInstructionPosition( int maxFunctionName, long maxOffset ) {
268
	private int calculateInstructionPosition( int maxFunctionName, long maxOffset, int addressLength ) {
266
		return (16 + maxFunctionName + Long.toString( maxOffset ).length());
269
	    //(Address prefix address representation in chars) + (space) + (<) + (+) + (>) + (:) + (space)
270
	    return ( addressLength + 6 + maxFunctionName + Long.toString( maxOffset ).length() );
267
	}
271
	}
268
272
269
	private String getSourceLineString( IAsmSourceLine line ) {
273
	private String getSourceLineString( IAsmSourceLine line ) {
Lines 282-289 Link Here
282
		return ( fBlock != null ) ? fBlock.getDisassembly() : null;
286
		return ( fBlock != null ) ? fBlock.getDisassembly() : null;
283
	}
287
	}
284
288
285
	public ICLineBreakpoint breakpointExists( long address ) throws CoreException {
289
	public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
286
		Assert.isTrue( address != 0 );
290
		Assert.isTrue( address != null );
287
		IDisassembly dis = getDisassembly();
291
		IDisassembly dis = getDisassembly();
288
		if ( dis != null ) {
292
		if ( dis != null ) {
289
			IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
293
			IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
Lines 294-300 Link Here
294
					if ( bps[i] instanceof ICLineBreakpoint ) {
298
					if ( bps[i] instanceof ICLineBreakpoint ) {
295
						ICLineBreakpoint b = (ICLineBreakpoint)bps[i];
299
						ICLineBreakpoint b = (ICLineBreakpoint)bps[i];
296
						try {
300
						try {
297
							if ( address == bt.getBreakpointAddress( b )  )
301
							if ( address.compareTo(bt.getBreakpointAddress( b )) == 0)
298
								return b;
302
								return b;
299
						}
303
						}
300
						catch( NumberFormatException e ) {
304
						catch( NumberFormatException e ) {
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/views/disassembly/DisassemblyInstructionPointerAnnotation.java (-2 / +3 lines)
Lines 10-15 Link Here
10
***********************************************************************/
10
***********************************************************************/
11
package org.eclipse.cdt.debug.internal.ui.views.disassembly;
11
package org.eclipse.cdt.debug.internal.ui.views.disassembly;
12
12
13
import org.eclipse.cdt.core.IAddress;
13
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
14
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
14
import org.eclipse.cdt.debug.core.model.ICStackFrame;
15
import org.eclipse.cdt.debug.core.model.ICStackFrame;
15
import org.eclipse.cdt.debug.core.model.IDisassembly;
16
import org.eclipse.cdt.debug.core.model.IDisassembly;
Lines 63-70 Link Here
63
		IDisassembly disassembly = getDisassembly( frame );
64
		IDisassembly disassembly = getDisassembly( frame );
64
		hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0);
65
		hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0);
65
		if ( frame != null ) {
66
		if ( frame != null ) {
66
			long address = frame.getAddress();
67
			IAddress address = frame.getAddress();
67
			hashCode = 37*hashCode + (int)(address^(address>>>32));
68
			hashCode = 37*hashCode + address.hashCode();
68
		}
69
		}
69
		return hashCode;
70
		return hashCode;
70
	}
71
	}
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryControlArea.java (-2 / +1 lines)
Lines 13-19 Link Here
13
import org.eclipse.cdt.debug.core.CDebugModel;
13
import org.eclipse.cdt.debug.core.CDebugModel;
14
import org.eclipse.cdt.debug.core.ICMemoryManager;
14
import org.eclipse.cdt.debug.core.ICMemoryManager;
15
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
15
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
16
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
17
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
16
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
18
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
17
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
19
import org.eclipse.debug.core.DebugException;
18
import org.eclipse.debug.core.DebugException;
Lines 430-436 Link Here
430
				}
429
				}
431
			}
430
			}
432
			if ( getMemoryBlock() != null ) {
431
			if ( getMemoryBlock() != null ) {
433
				fAddressText.setText( CDebugUIUtils.toHexAddressString( getMemoryBlock().getStartAddress() ) );
432
				fAddressText.setText( getMemoryBlock().getRealStartAddress().toHexAddressString() );
434
				handleAddressEnter();
433
				handleAddressEnter();
435
			}
434
			}
436
		}
435
		}
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/views/memory/MemoryPresentation.java (-31 / +30 lines)
Lines 11-25 Link Here
11
11
12
package org.eclipse.cdt.debug.internal.ui.views.memory;
12
package org.eclipse.cdt.debug.internal.ui.views.memory;
13
13
14
import java.math.BigInteger;
14
import java.util.Arrays;
15
import java.util.Arrays;
15
import java.util.LinkedList;
16
import java.util.LinkedList;
16
import java.util.List;
17
import java.util.List;
17
18
19
import org.eclipse.cdt.core.IAddress;
18
import org.eclipse.cdt.debug.core.CDebugUtils;
20
import org.eclipse.cdt.debug.core.CDebugUtils;
19
import org.eclipse.cdt.debug.core.ICMemoryManager;
21
import org.eclipse.cdt.debug.core.ICMemoryManager;
20
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
22
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
21
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlockRow;
23
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlockRow;
22
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
23
import org.eclipse.debug.core.DebugException;
24
import org.eclipse.debug.core.DebugException;
24
import org.eclipse.swt.graphics.Point;
25
import org.eclipse.swt.graphics.Point;
25
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Display;
Lines 77-83 Link Here
77
		{
78
		{
78
			int offset = sb.length();
79
			int offset = sb.length();
79
			sb.append( getRowText( rows[i] ) );
80
			sb.append( getRowText( rows[i] ) );
80
			fAddressZones.add( new Point( offset, offset + getAddressLength() ) );
81
			fAddressZones.add( new Point( offset, offset + rows[i].getAddress().getCharsNum()  ) );
81
		}
82
		}
82
		return sb.toString();
83
		return sb.toString();
83
	}
84
	}
Lines 104-110 Link Here
104
	public Point[] getChangedZones()
105
	public Point[] getChangedZones()
105
	{
106
	{
106
		fChangedZones.clear();
107
		fChangedZones.clear();
107
		Long[] changedAddresses = getChangedAddresses();
108
		IAddress[] changedAddresses = getChangedAddresses();
108
		for ( int i = 0; i < changedAddresses.length; ++i )
109
		for ( int i = 0; i < changedAddresses.length; ++i )
109
		{
110
		{
110
			int dataOffset = getDataItemOffsetByAddress( changedAddresses[i] );
111
			int dataOffset = getDataItemOffsetByAddress( changedAddresses[i] );
Lines 126-132 Link Here
126
	
127
	
127
	public String getStartAddress()
128
	public String getStartAddress()
128
	{
129
	{
129
		return ( fBlock != null ) ? getAddressString( fBlock.getStartAddress() ) : "";  //$NON-NLS-1$
130
		return ( fBlock != null ) ? fBlock.getRealStartAddress().toHexAddressString() : "";  //$NON-NLS-1$
130
	}
131
	}
131
132
132
	public String getAddressExpression()
133
	public String getAddressExpression()
Lines 141-155 Link Here
141
		return new String( chars );
142
		return new String( chars );
142
	}
143
	}
143
144
144
	private String getAddressString( long address )
145
	{
146
		return CDebugUIUtils.toHexAddressString( address );
147
	}
148
149
	private String getRowText( IFormattedMemoryBlockRow row )
145
	private String getRowText( IFormattedMemoryBlockRow row )
150
	{
146
	{
151
		StringBuffer result = new StringBuffer( getRowLength() ); 
147
		StringBuffer result = new StringBuffer( getRowLength( ) ); 
152
		result.append( getAddressString( row.getAddress() ) ); 
148
		result.append(  row.getAddress().toHexAddressString() ); 
153
		result.append( getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA ) );
149
		result.append( getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA ) );
154
		String[] items = row.getData();
150
		String[] items = row.getData();
155
		for ( int i = 0; i < items.length; ++i )
151
		for ( int i = 0; i < items.length; ++i )
Lines 175-183 Link Here
175
			   getDataBytesPerRow() : 0 ) + 1;
171
			   getDataBytesPerRow() : 0 ) + 1;
176
	}
172
	}
177
173
178
	private int getAddressLength()
174
179
	{
175
   private int getAddressLength() {
180
		return 10;
176
   		return fBlock.getRealStartAddress().getCharsNum();
181
	}
177
	}
182
	
178
	
183
	private boolean isInAsciiArea( int offset )
179
	private boolean isInAsciiArea( int offset )
Lines 293-304 Link Here
293
		return IFormattedMemoryBlock.MEMORY_FORMAT_HEX;
289
		return IFormattedMemoryBlock.MEMORY_FORMAT_HEX;
294
	}
290
	}
295
	
291
	
296
	private Long[] getChangedAddresses()
292
	private IAddress[] getChangedAddresses()
297
	{
293
	{
298
		return ( getMemoryBlock() != null ) ? getMemoryBlock().getChangedAddresses() : new Long[0];
294
		return ( getMemoryBlock() != null ) ? getMemoryBlock().getChangedAddresses() : new IAddress[0];
299
	}
295
	}
300
	
296
	
301
	private int getDataItemOffsetByAddress( Long address )
297
	private int getDataItemOffsetByAddress( IAddress address )
302
	{
298
	{
303
		if ( getMemoryBlock() != null )
299
		if ( getMemoryBlock() != null )
304
		{
300
		{
Lines 307-321 Link Here
307
			{
303
			{
308
				int wordSize = getMemoryBlock().getWordSize();
304
				int wordSize = getMemoryBlock().getWordSize();
309
				int numberOfColumns = getMemoryBlock().getNumberOfColumns();
305
				int numberOfColumns = getMemoryBlock().getNumberOfColumns();
310
				if ( address.longValue() >= rows[i].getAddress() && 
306
311
					 address.longValue() < rows[i].getAddress() + (wordSize * numberOfColumns) )
307
				if(  address.compareTo( rows[i].getAddress())  >=0 && 
308
					 address.compareTo( rows[i].getAddress().add(BigInteger.valueOf(wordSize * numberOfColumns)))  <0)
312
				{
309
				{
313
					for ( int j = 1; j <= numberOfColumns; ++j )
310
					for ( int j = 1; j <= numberOfColumns; ++j )
314
					{
311
					{
315
						if ( address.longValue() >= rows[i].getAddress() + ((j - 1) * wordSize) &&
312
						if(  address.compareTo( rows[i].getAddress().add(BigInteger.valueOf( (j - 1) * wordSize)))    >=0 && 
316
							 address.longValue() < rows[i].getAddress() + (j * wordSize) )
313
							 address.compareTo( rows[i].getAddress().add(BigInteger.valueOf(    j      * wordSize)))      <0)
317
						{
314
						{
318
							return (i * getRowLength()) + ((j - 1) * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS)) + getAddressLength() + INTERVAL_BETWEEN_ADDRESS_AND_DATA;
315
							return (i * getRowLength()) + ((j - 1) * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS)) + address.getCharsNum()  + INTERVAL_BETWEEN_ADDRESS_AND_DATA;
319
						}
316
						}
320
					}
317
					}
321
				}
318
				}
Lines 325-331 Link Here
325
		return -1;
322
		return -1;
326
	}
323
	}
327
	
324
	
328
	private int getAsciiOffsetByAddress( Long address )
325
	private int getAsciiOffsetByAddress( IAddress address )
329
	{
326
	{
330
		if ( getMemoryBlock() != null )
327
		if ( getMemoryBlock() != null )
331
		{
328
		{
Lines 334-347 Link Here
334
			{
331
			{
335
				IFormattedMemoryBlockRow firstRow = rows[0];
332
				IFormattedMemoryBlockRow firstRow = rows[0];
336
				IFormattedMemoryBlockRow lastRow = rows[rows.length - 1];
333
				IFormattedMemoryBlockRow lastRow = rows[rows.length - 1];
337
				if ( address.longValue() >= firstRow.getAddress() && address.longValue() <= lastRow.getAddress() )
334
				
335
				if (address.compareTo( firstRow.getAddress()) >=0 && address.compareTo( lastRow.getAddress()) <=0)
336
				
338
				{
337
				{
339
					int asciiOffset = (int)(address.longValue() - firstRow.getAddress());
338
					BigInteger asciiOffset = address.distance( firstRow.getAddress());
340
					int asciiRowlength = getMemoryBlock().getWordSize() * getMemoryBlock().getNumberOfColumns();
339
					int asciiRowlength = getMemoryBlock().getWordSize() * getMemoryBlock().getNumberOfColumns();
341
					int numberOfRows = asciiOffset / asciiRowlength;
340
					int numberOfRows = asciiOffset.intValue()  / asciiRowlength;
342
					int offsetInRow = asciiOffset % asciiRowlength;
341
					int offsetInRow = asciiOffset.intValue()  % asciiRowlength;
343
					return (numberOfRows * getRowLength()) + 
342
					return (numberOfRows * getRowLength()) + 
344
						   getAddressLength() + INTERVAL_BETWEEN_ADDRESS_AND_DATA +
343
						   address.getCharsNum() + INTERVAL_BETWEEN_ADDRESS_AND_DATA +
345
						   (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getMemoryBlock().getNumberOfColumns() +
344
						   (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getMemoryBlock().getNumberOfColumns() +
346
						   INTERVAL_BETWEEN_DATA_AND_ASCII + offsetInRow;
345
						   INTERVAL_BETWEEN_DATA_AND_ASCII + offsetInRow;
347
				}
346
				}
Lines 513-525 Link Here
513
	{
512
	{
514
		if ( getMemoryBlock() != null )
513
		if ( getMemoryBlock() != null )
515
		{
514
		{
516
			int index = getDataItemIndex( offset );
515
			int index = getDataItemIndex(offset );
517
			if ( index != -1 )
516
			if ( index != -1 )
518
			{
517
			{
519
				char[] chars = getDataItemChars( index );
518
				char[] chars = getDataItemChars( index );
520
				if ( isInDataArea( offset ) )
519
				if ( isInDataArea( offset ) )
521
				{
520
				{
522
					int charIndex = getOffsetInDataItem( offset, index );
521
					int charIndex = getOffsetInDataItem(offset, index );
523
					chars[charIndex] = newChar;
522
					chars[charIndex] = newChar;
524
				}
523
				}
525
				if ( isInAsciiArea( offset ) )
524
				if ( isInAsciiArea( offset ) )
Lines 539-545 Link Here
539
			int index = getDataItemIndex( offset );
538
			int index = getDataItemIndex( offset );
540
			if ( index != -1 )
539
			if ( index != -1 )
541
			{
540
			{
542
				String newValue = getNewItemValue( offset, ch );
541
				String newValue = getNewItemValue(offset, ch );
543
				if ( newValue != null )
542
				if ( newValue != null )
544
				{
543
				{
545
					try
544
					try
(-)workspace-old/org.eclipse.cdt.debug.ui/src-cdtdebugui/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java (-5 / +2 lines)
Lines 13-19 Link Here
13
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
13
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
14
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
14
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
15
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
15
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
16
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
17
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
16
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
18
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
17
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
19
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
18
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
Lines 83-93 Link Here
83
					case 2:
82
					case 2:
84
						return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$
83
						return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$
85
					case 3:
84
					case 3:
86
						return ( library.getStartAddress() > 0 ) ? 
85
						return library.getStartAddress().toHexAddressString(); //$NON-NLS-1$
87
									CDebugUIUtils.toHexAddressString( library.getStartAddress() ) : ""; //$NON-NLS-1$
88
					case 4:
86
					case 4:
89
						return ( library.getEndAddress() > 0 ) ? 
87
						return library.getEndAddress().toHexAddressString(); //$NON-NLS-1$
90
									CDebugUIUtils.toHexAddressString( library.getEndAddress() ) : ""; //$NON-NLS-1$
91
				}
88
				}
92
			}
89
			}
93
			return null;
90
			return null;

Return to bug 69908