Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325130

Summary: EmptyStackException during Valgrind massif execution
Product: [Tools] Linux Tools Reporter: fdpntpvxvjcs
Component: ValgrindAssignee: Elliott Baron <ebaron>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 0.6.1   
Target Milestone: 0.6.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Valgrind log file none

Description fdpntpvxvjcs CLA 2010-09-13 12:31:31 EDT
I am trying to run unit tests through massif to see if there is a memory leak, however after executing a few tests, the Valgrind plugin always fails with an EmptyStackException.

Checking the workspace .log file reveals the following stack trace:

!ENTRY org.eclipse.core.jobs 4 2 2010-09-13 11:46:12.937
!MESSAGE An internal error occurred during: "Launching tests (1)".
!STACK 0
java.util.EmptyStackException
	at java.util.Stack.peek(Stack.java:102)
	at org.eclipse.linuxtools.internal.valgrind.core.ValgrindCoreParser.<init>(ValgrindCoreParser.java:70)
	at org.eclipse.linuxtools.internal.valgrind.launch.ValgrindLaunchConfigurationDelegate.parseLogs(ValgrindLaunchConfigurationDelegate.java:194)
	at org.eclipse.linuxtools.internal.valgrind.launch.ValgrindLaunchConfigurationDelegate.launch(ValgrindLaunchConfigurationDelegate.java:160)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
	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)



The environment is the following:
eclipse.buildId=I20100608-0911
java.version=1.6.0_0
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.cpp.product
Command-line arguments:  -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.cpp.product
Comment 1 Elliott Baron CLA 2010-09-13 13:19:18 EDT
Would you be able to post the log file valgrind_[pid].txt located in [workspace]/.metadata/.plugins/org.eclipse.linuxtools.valgrind.launch?
Comment 2 fdpntpvxvjcs CLA 2010-09-13 14:19:04 EDT
Created attachment 178766 [details]
Valgrind log file

As requested in comment #1.
Class and method names have been obfuscated.
Comment 3 Elliott Baron CLA 2010-09-13 19:06:49 EDT
I am able to reproduce the problem by passing a negative integer to new[].

This is an oversight in parsing Valgrind's log files. I'll commit a fix soon.

If you wish there's a macro defined in valgrind.h:  RUNNING_ON_VALGRIND that will allow you to disable certain tests if running under Valgrind. You can read more about it here: http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq
Comment 4 Elliott Baron CLA 2010-09-13 21:19:51 EDT
Problem should be fixed in trunk and 0.6 branch.
Comment 5 fdpntpvxvjcs CLA 2010-09-14 11:42:08 EDT
(In reply to comment #4)
> Problem should be fixed in trunk and 0.6 branch.

Thanks for the quick fix.

I am not sure how to get the latest build though. Linux Tools nighly builds have the name "0.7.0.201008311204" so they seem to be two weeks old. The last 0.6 branch release was end of August.

Which update site should I thus use or where can I get a packaged build?
Comment 6 Elliott Baron CLA 2010-09-14 12:53:21 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > Problem should be fixed in trunk and 0.6 branch.
> 
> Thanks for the quick fix.
> 
> I am not sure how to get the latest build though. Linux Tools nighly builds
> have the name "0.7.0.201008311204" so they seem to be two weeks old. The last
> 0.6 branch release was end of August.
> 
> Which update site should I thus use or where can I get a packaged build?

You're welcome to use the Helios nightly update site: http://download.eclipse.org/technology/linuxtools/updates-nightly-helios/

Please let me know if the problem persists for you, but it should be fixed.
Comment 7 fdpntpvxvjcs CLA 2010-09-14 14:37:01 EDT
(In reply to comment #6)
> Please let me know if the problem persists for you, but it should be fixed.

Thanks, got the update and parsing works now. The issue is fixed for me.