diff --git a/debug/org.eclipse.cdt.debug.application.product/README b/debug/org.eclipse.cdt.debug.application.product/README index c096df5f7a7..41fb2b3e0aa 100644 --- a/debug/org.eclipse.cdt.debug.application.product/README +++ b/debug/org.eclipse.cdt.debug.application.product/README @@ -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. diff --git a/debug/org.eclipse.cdt.debug.application.product/debug.product b/debug/org.eclipse.cdt.debug.application.product/debug.product index 134836afa28..3d89ba2fe3c 100644 --- a/debug/org.eclipse.cdt.debug.application.product/debug.product +++ b/debug/org.eclipse.cdt.debug.application.product/debug.product @@ -32,6 +32,7 @@ + @@ -194,6 +195,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U + @@ -230,6 +232,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U + @@ -286,6 +289,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U + @@ -333,6 +337,7 @@ Java and all Java-based trademarks are trademarks of Oracle Corporation in the U + diff --git a/debug/org.eclipse.cdt.debug.application.product/pom.xml b/debug/org.eclipse.cdt.debug.application.product/pom.xml index 5d426e8ab38..04c2c01875d 100644 --- a/debug/org.eclipse.cdt.debug.application.product/pom.xml +++ b/debug/org.eclipse.cdt.debug.application.product/pom.xml @@ -85,6 +85,11 @@ win32 x86_64 + + macosx + cocoa + x86_64 + diff --git a/debug/org.eclipse.cdt.debug.application/icons/cc.icns b/debug/org.eclipse.cdt.debug.application/icons/cc.icns new file mode 100644 index 00000000000..bb47cf4ac9a Binary files /dev/null and b/debug/org.eclipse.cdt.debug.application/icons/cc.icns differ diff --git a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh old mode 100755 new mode 100644 index 4e51a2a54eb..ba4146d880c --- a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh +++ b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh @@ -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 \ diff --git a/debug/org.eclipse.cdt.debug.application/scripts/install.sh b/debug/org.eclipse.cdt.debug.application/scripts/install.sh old mode 100755 new mode 100644 index 13fa911c815..7ffb4abe5b9 --- a/debug/org.eclipse.cdt.debug.application/scripts/install.sh +++ b/debug/org.eclipse.cdt.debug.application/scripts/install.sh @@ -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" diff --git a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java index f05773e61fc..b0274113cab 100644 --- a/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java +++ b/debug/org.eclipse.cdt.debug.application/src/org/eclipse/cdt/internal/debug/application/CompilerOptionParser.java @@ -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();