1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Stop using jaxb's DatatypeConverter

jaxb is not standard anymore, and having a dependency just
for this simple method is overkill.

This is also a workaround for Bug 579817.

Change-Id: Ic0db6e595b8faa9323c26d29f8caedc0ac4b089e
This commit is contained in:
Jonah Graham 2022-05-02 21:52:30 -04:00
parent 491333aaa4
commit a7d39a80a3
2 changed files with 8 additions and 4 deletions

View file

@ -137,7 +137,6 @@ Require-Bundle: org.eclipse.cdt.core.native;bundle-version="[6.2.0,7.0.0)";visib
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: javax.xml.bind;version="[2.3.3,3.0.0)"
Automatic-Module-Name: org.eclipse.cdt.core
Service-Component: OSGI-INF/*.xml

View file

@ -28,8 +28,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.bind.DatatypeConverter;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICompileOptionsFinder;
import org.eclipse.cdt.core.ISymbolReader;
@ -127,7 +125,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader, ICompileOptions
}
// The build-id location is taken by converting the binary bytes to hex string.
// The first byte is used as a directory specifier (e.g. 51/a4578fe2).
String bName = DatatypeConverter.printHexBinary(byteArray).toLowerCase();
String bName = printHexBinary(byteArray).toLowerCase();
buildId = bName.substring(0, 2) + "/" + bName.substring(2) + ".debug"; //$NON-NLS-1$ //$NON-NLS-2$
// The build-id file should be in the special directory /usr/lib/debug/.build-id
IPath buildIdPath = new Path("/usr/lib/debug/.build-id").append(buildId); //$NON-NLS-1$
@ -288,6 +286,13 @@ public class DwarfReader extends Dwarf implements ISymbolReader, ICompileOptions
m_parsed = false;
}
private static String printHexBinary(byte[] byteArray) {
StringBuilder sb = new StringBuilder(byteArray.length * 2);
for (byte b : byteArray)
sb.append(String.format("%02x", b)); //$NON-NLS-1$
return sb.toString();
}
/*
* Parse line table data of a compilation unit to get names of all source files
* that contribute to the compilation unit.