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
			}

Return to bug 69908