Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315396 - EDC launch imported executable causes divide by zero exception
Summary: EDC launch imported executable causes divide by zero exception
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Ken Ryall CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-02 10:10 EDT by David Dubrow CLA
Modified: 2010-06-02 10:23 EDT (History)
1 user (show)

See Also:


Attachments
Fix (1004 bytes, patch)
2010-06-02 10:16 EDT, John Cortell CLA
john.cortell: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Dubrow CLA 2010-06-02 10:10:52 EDT
Importing an executable and launching as C/C++ application (using EDC Create Process Windows Launcher) causes a divide by zero exception in:
ava.lang.ArithmeticException: / by zero
at org.eclipse.cdt.launch.AbstractCLaunchDelegate2$1.run(AbstractCLaunchDelegate2.java:304)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.cdt.launch.AbstractCLaunchDelegate2.buildProject(AbstractCLaunchDelegate2.java:344)
at org.eclipse.cdt.launch.AbstractCLaunchDelegate2.buildForLaunch(AbstractCLaunchDelegate2.java:265)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:821)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 John Cortell CLA 2010-06-02 10:13:34 EDT
My bad. Will fix asap...
Comment 2 John Cortell CLA 2010-06-02 10:16:22 EDT
Created attachment 170804 [details]
Fix

Committed to HEAD.
Comment 3 David Dubrow CLA 2010-06-02 10:17:13 EDT
I was just about to fix it but had the wrong ws open! You beat me to it! :)

I was going to change line 304 to:
final int subtaskTicks = TOTAL_TICKS / Math.max(1, buildCount);
Comment 4 John Cortell CLA 2010-06-02 10:18:00 EDT
Fixed.
Comment 5 John Cortell CLA 2010-06-02 10:18:45 EDT
(In reply to comment #3)
> I was just about to fix it but had the wrong ws open! You beat me to it! :)
> 
> I was going to change line 304 to:
> final int subtaskTicks = TOTAL_TICKS / Math.max(1, buildCount);

There's nothing to build in that case so we should just return.
Comment 6 David Dubrow CLA 2010-06-02 10:20:51 EDT
(In reply to comment #5)
> (In reply to comment #3)
> > I was just about to fix it but had the wrong ws open! You beat me to it! :)
> > 
> > I was going to change line 304 to:
> > final int subtaskTicks = TOTAL_TICKS / Math.max(1, buildCount);
> 
> There's nothing to build in that case so we should just return.

I see that. I was looking at the trees and missed the forest. :P
Comment 7 CDT Genie CLA 2010-06-02 10:23:16 EDT
*** cdt cvs genie on behalf of jcortell ***
Bug 315396: EDC launch imported executable causes divide by zero exception

[*] AbstractCLaunchDelegate2.java 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate2.java?root=Tools_Project&r1=1.8&r2=1.9