mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Stand-alone debugger for Mac OS X
This commits adds support for the stand-alone debugger on Mac OS X for both the RCP (product) and the script. The script had to be modified slightly because of the different installation layout on Mac and also the use of non-standard arguments to the 'find' command. Change-Id: I24e4fec98803689dbaadb1dcfa651e431d4188a7 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
parent
f4a98d1894
commit
75c2dcebf9
7 changed files with 76 additions and 21 deletions
|
@ -8,4 +8,4 @@ You can find more information about command-line options in
|
|||
org.eclipse.cdt.debug.application/scripts/README.
|
||||
|
||||
Note that this product is currently only built for the more popular architecture x86 and x86_64 on
|
||||
Linux and Windows.
|
||||
Linux, Windows and Mac.
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
<launcher name="cdtdebug">
|
||||
<linux icon="../org.eclipse.cdt.debug.application/icons/cc.xpm"/>
|
||||
<macosx icon="../org.eclipse.cdt.debug.application/icons/cc.icns"/>
|
||||
<solaris/>
|
||||
<win useIco="true">
|
||||
<ico path="../org.eclipse.cdt.debug.application/icons/cc.ico"/>
|
||||
|
@ -194,6 +195,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
|||
<plugin id="org.eclipse.cdt.core.linux" fragment="true"/>
|
||||
<plugin id="org.eclipse.cdt.core.linux.x86" fragment="true"/>
|
||||
<plugin id="org.eclipse.cdt.core.linux.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.cdt.core.macosx" fragment="true"/>
|
||||
<plugin id="org.eclipse.cdt.core.native"/>
|
||||
<plugin id="org.eclipse.cdt.core.win32" fragment="true"/>
|
||||
<plugin id="org.eclipse.cdt.core.win32.x86" fragment="true"/>
|
||||
|
@ -230,6 +232,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
|||
<plugin id="org.eclipse.core.filesystem"/>
|
||||
<plugin id="org.eclipse.core.filesystem.linux.x86" fragment="true"/>
|
||||
<plugin id="org.eclipse.core.filesystem.linux.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/>
|
||||
<plugin id="org.eclipse.core.filesystem.win32.x86" fragment="true"/>
|
||||
<plugin id="org.eclipse.core.filesystem.win32.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.core.jobs"/>
|
||||
|
@ -286,6 +289,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
|||
<plugin id="org.eclipse.equinox.jsp.jasper"/>
|
||||
<plugin id="org.eclipse.equinox.jsp.jasper.registry"/>
|
||||
<plugin id="org.eclipse.equinox.launcher"/>
|
||||
<plugin id="org.eclipse.equinox.launcher.cocoa.macosx.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.equinox.launcher.gtk.linux.x86" fragment="true"/>
|
||||
<plugin id="org.eclipse.equinox.launcher.gtk.linux.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.equinox.launcher.win32.win32.x86" fragment="true"/>
|
||||
|
@ -333,6 +337,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U
|
|||
<plugin id="org.eclipse.osgi.services"/>
|
||||
<plugin id="org.eclipse.search"/>
|
||||
<plugin id="org.eclipse.swt"/>
|
||||
<plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.swt.gtk.linux.x86" fragment="true"/>
|
||||
<plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/>
|
||||
<plugin id="org.eclipse.swt.win32.win32.x86" fragment="true"/>
|
||||
|
|
|
@ -85,6 +85,11 @@
|
|||
<ws>win32</ws>
|
||||
<arch>x86_64</arch>
|
||||
</environment>
|
||||
<environment>
|
||||
<os>macosx</os>
|
||||
<ws>cocoa</ws>
|
||||
<arch>x86_64</arch>
|
||||
</environment>
|
||||
</environments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
BIN
debug/org.eclipse.cdt.debug.application/icons/cc.icns
Normal file
BIN
debug/org.eclipse.cdt.debug.application/icons/cc.icns
Normal file
Binary file not shown.
17
debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh
Executable file → Normal file
17
debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh
Executable file → Normal file
|
@ -80,18 +80,25 @@ fi
|
|||
|
||||
# Calculate platform-specific jar file names
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) # install.sh will modify this line. DO NOT REMOVE THE FOLLOWING MARKER: @#@#
|
||||
ECLIPSE_EXEC="$ECLIPSE_HOME/eclipse"
|
||||
|
||||
# On Mac OS X, the application layout is a bit different (Eclipse.app)
|
||||
if [[ $ECLIPSE_HOME == *MacOS ]]; then
|
||||
ECLIPSE_HOME="$ECLIPSE_HOME/../Eclipse"
|
||||
fi
|
||||
|
||||
PLUGIN_DIR="$ECLIPSE_HOME/plugins"
|
||||
|
||||
OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -not -name '*source*' -printf "%f\n" | head -1`
|
||||
SWT_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.swt.*.jar' -not -name '*source*' -printf "%f\n" | head -1`
|
||||
OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -not -name '*source*' -exec basename {} \; | head -1`
|
||||
SWT_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.swt.*.jar' -not -name '*source*' -exec basename {} \; | head -1`
|
||||
SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||
FS_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.core.filesystem.*.jar' -not -name '*source*' -printf "%f\n" | grep -v java7 | head -1`
|
||||
FS_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.core.filesystem.*.jar' -not -name '*source*' -exec basename {} \; | grep -v java7 | head -1`
|
||||
FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||
LINUX_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.cdt.core.linux.*.jar' -not -name '*source*' -printf "%f\n" | head -1`
|
||||
LINUX_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.cdt.core.linux.*.jar' -not -name '*source*' -exec basename {} \; | head -1`
|
||||
LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||
|
||||
# Run eclipse with the Stand-alone Debugger product specified
|
||||
"$ECLIPSE_HOME/eclipse" -clean -product org.eclipse.cdt.debug.application.product \
|
||||
"$ECLIPSE_EXEC" -clean -product org.eclipse.cdt.debug.application.product \
|
||||
-data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \
|
||||
-dev file\:"$HOME/cdtdebugger/dev.properties" $options \
|
||||
-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
|
||||
|
|
35
debug/org.eclipse.cdt.debug.application/scripts/install.sh
Executable file → Normal file
35
debug/org.eclipse.cdt.debug.application/scripts/install.sh
Executable file → Normal file
|
@ -15,18 +15,24 @@
|
|||
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
|
||||
IS_MAC=0
|
||||
|
||||
if [ ! -f "$SCRIPT_DIR/../../../eclipse" ]; then
|
||||
echo "$0: error: eclipse executable not found in expected location"
|
||||
echo " "
|
||||
echo "This can occur if you are running this script from your local .eclipse directory"
|
||||
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
||||
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
||||
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
||||
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
||||
echo "of the Eclipse platform, you should not use this script. Instead, install the"
|
||||
echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)"
|
||||
echo "which will install the Stand-alone Debugger for you."
|
||||
exit 1
|
||||
if [ ! -f "$SCRIPT_DIR/../../../../MacOS/eclipse" ]; then
|
||||
echo "$0: error: eclipse executable not found in expected location"
|
||||
echo " "
|
||||
echo "This can occur if you are running this script from your local .eclipse directory"
|
||||
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
||||
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
||||
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
||||
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
||||
echo "of the Eclipse platform, you should not use this script. Instead, install the"
|
||||
echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)"
|
||||
echo "which will install the Stand-alone Debugger for you."
|
||||
exit 1
|
||||
else
|
||||
IS_MAC=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "$HOME/cdtdebugger" ]; then
|
||||
|
@ -37,7 +43,12 @@ cp "$SCRIPT_DIR/dev.properties" "$HOME/cdtdebugger"
|
|||
cp "$SCRIPT_DIR/cdtdebug.sh" "$HOME/cdtdebugger"
|
||||
chmod +x "$HOME/cdtdebugger/cdtdebug.sh"
|
||||
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd)
|
||||
if [ $IS_MAC -eq 0 ]; then
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd)
|
||||
else
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../../../MacOS" && pwd)
|
||||
fi
|
||||
|
||||
# Replace the entire line with tag @#@# by the actual location of the eclipse installation
|
||||
sed -i -e "s,^.*@#@#.*$,ECLIPSE_HOME=$ECLIPSE_HOME," "$HOME/cdtdebugger/cdtdebug.sh"
|
||||
echo "Installation complete"
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.debug.application.GCCCompileOptionsParser;
|
|||
import org.eclipse.cdt.debug.application.Messages;
|
||||
import org.eclipse.cdt.utils.coff.parser.PEParser;
|
||||
import org.eclipse.cdt.utils.elf.parser.GNUElfParser;
|
||||
import org.eclipse.cdt.utils.macho.parser.MachOParser64;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
|
@ -65,13 +66,39 @@ public class CompilerOptionParser implements IWorkspaceRunnable {
|
|||
try {
|
||||
// Calculate how many source files we have to process and use that as a basis
|
||||
// for our work estimate.
|
||||
IBinaryFile bf;
|
||||
IBinaryFile bf = null;
|
||||
try {
|
||||
bf = new GNUElfParser().getBinary(new Path(executable));
|
||||
} catch (IOException e) {
|
||||
// Try Portable Executable (Windows)
|
||||
bf = new PEParser().getBinary(new Path(executable));
|
||||
// Will try other parsers
|
||||
}
|
||||
|
||||
// Try Portable Executable (Windows)
|
||||
if (bf == null) {
|
||||
try {
|
||||
bf = new PEParser().getBinary(new Path(executable));
|
||||
} catch (IOException e) {
|
||||
// Will try other parsers
|
||||
}
|
||||
}
|
||||
|
||||
// Try Mach-O (Mac OS X)
|
||||
if (bf == null) {
|
||||
bf = new MachOParser64().getBinary(new Path(executable));
|
||||
try {
|
||||
bf = new PEParser().getBinary(new Path(executable));
|
||||
} catch (IOException e) {
|
||||
// ignored, see below early return
|
||||
}
|
||||
}
|
||||
|
||||
if (bf == null) {
|
||||
// Doesn't look like a known binary but we can let the debugger try to
|
||||
// debug it. This means that the project will likely be
|
||||
// incomplete and this will affect code navigation.
|
||||
return;
|
||||
}
|
||||
|
||||
ISymbolReader reader = bf.getAdapter(ISymbolReader.class);
|
||||
String[] sourceFiles = reader
|
||||
.getSourceFiles();
|
||||
|
|
Loading…
Add table
Reference in a new issue