create a console application and give main.cpp the following content (so you can try the plug-in) :
#include <iostream>
using namespace std;
int main()
{
// let's go for a memory leak
int* ArrayI = new int[10];
ArrayI[0] = 0;
// read out of bounds
cout << ArrayI[12] << endl;
//write out of bounds
ArrayI[10] = 15;
// uninitialized variable
int UnInitVar;
if(UnInitVar)
{
cout << "Hello" << endl;;
}
// mismatch new[] delete
char* MyString = new char[10];
delete MyString;
// double delete
int* pInt = new int;
delete pInt;
delete pInt;
// double alloc to same variable --> first one lost
int* First = new int;
First = new int;
delete First;
First = 0;
return 0;
} // end of main
The entry for the valgrind-plugin libs is missing frome "debian/codeblocks-contrib.install".
Patch:
--- codeblocks-1.0svn.orig/debian/codeblocks-contrib.install 2008-07-09 21:11:39.000000000 +0200
+++ codeblocks-1.0svn.work/debian/codeblocks-contrib.install 2008-07-09 22:25:02.000000000 +0200
@@ -39,6 +39,7 @@
usr/share/codeblocks/plugins/libRegExTestbed.*
usr/share/codeblocks/plugins/libSymTab.*
usr/share/codeblocks/plugins/libThreadSearch.*
+usr/share/codeblocks/plugins/libValgrind.*
usr/share/codeblocks/plugins/libwxsmith.*
usr/share/codeblocks/plugins/libwxsmithcontribitems.*
There is a missing #include in Valgrind.cpp:
Index: src/plugins/contrib/Valgrind/Valgrind.cpp
===================================================================
--- src/plugins/contrib/Valgrind/Valgrind.cpp (revision 5126)
+++ src/plugins/contrib/Valgrind/Valgrind.cpp (working copy)
@@ -13,6 +13,7 @@
#include <wx/fs_zip.h>
#include <wx/intl.h>
#include <wx/string.h>
+#include <wx/menu.h>
#include <wx/xrc/xmlres.h>
#include "cbproject.h"
#include "manager.h"
Without this compilation failes with wxGTK 2.8.
I posted this in a wrong thread, so I put it here and the solution I found:
I am trying to run valgrind plugin, but it says that it needs to specify a XML file.
I have the valgrind version:
that needs the parameter
--xml-file=<file> XML output to <file>
Is there any place where I can specify it?
Thanks in advance.
Workaround
Ok. I needed to find an older version. I did the following after installing apt-show-versions:
apt-show-versions -a valgrind
valgrind 1:3.5.0-2 install ok installed
valgrind 1:3.3.1-3 lenny http.us.debian.org
valgrind 1:3.5.0-2 testing http.us.debian.org
valgrind 1:3.5.0-2 sid ftp.de.debian.org
valgrind/testing uptodate 1:3.5.0-2
Then downgrade:
sudo apt-get install valgrind=1:3.3.1-3
This is just in case other people may have the same problem that me.
Now it launches.
alright I know what to do.
Off course the fun is i will have to check valgrind versions since the changes valgrind has are not backwards compatible.
Old command :
valgrind --leak-check=yes --xml=yes ./DeleteMe
New command :
valgrind --leak-check=yes --xml=yes --xml-file=test.xml ./DeleteMe
Unfortunately the option 'xml-file=test.xml' will be flagged as an error by the old valgrind (valgrind: Bad option '--xml-file=test.xml'; aborting.).
Will start working on it soon.
Why not use:
valgrind --leak-check=yes --xml=yes --xml-fd=1 ./test_cb_stl_debug
--xml-fd=1 -> should mean use file that is the standard output