Author Topic: Valgrind  (Read 3492 times)

Offline Satyajit

  • Single posting newcomer
  • *
  • Posts: 5
Valgrind
« on: December 02, 2016, 11:06:22 am »
I am using Code::Blocks 13.12 on my linux ubuntu machine. I also installed valgrind using terminal. When I open a program on codeblock it also gives me some options to use valgrind also. Options are-

   (i) Run MemCheck
  (ii) Open MemCheck Xml log file
 (iii) Run Cachegrind

  But nothing is happening using those options. So finally question is how to use those options?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Valgrind
« Reply #1 on: December 02, 2016, 11:59:12 am »
Is there any output in the Valgrind-tab in "Logs and others" ?

Offline Satyajit

  • Single posting newcomer
  • *
  • Posts: 5
Re: Valgrind
« Reply #2 on: December 02, 2016, 12:46:04 pm »
When I click on "Run MemCheck" Valgrind tab in "logs & others" shows



valgrind--version
valgrind-3.10.1
setting dynamic linker path to: .:
Executing command:valgrind--leak-check=full--track-origins=yes--xml=yes--xml-file=/home/..../.../.../code_name/valgrindOut.xml "/home/.../.../.../code_name/bin/Debug/code_name"

---------- Application output -----------

valgrind: C++: command not found


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2463
Re: Valgrind
« Reply #3 on: December 02, 2016, 08:40:20 pm »
--- Application output -----------

valgrind: C++: command not found

Isn't it obvious that you have to install valgrind if the command is not found?

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Valgrind
« Reply #4 on: December 02, 2016, 09:32:42 pm »
--- Application output -----------

valgrind: C++: command not found

Isn't it obvious that you have to install valgrind if the command is not found?
The previous post shows, that valgrind returns a version-number, so it seems to run.

It looks like it calls c++, which does not exist or is not in the path.
I don't see this behaviour on linux, even if I remove my c++-compiler, so this is only a guess.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: Valgrind
« Reply #5 on: December 03, 2016, 12:48:25 pm »
Satyajit: does valgrind work from command line?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Valgrind
« Reply #6 on: December 03, 2016, 01:34:59 pm »
@Satyajit:
Does the program run without valgrind ?

Offline Satyajit

  • Single posting newcomer
  • *
  • Posts: 5
Re: Valgrind
« Reply #7 on: December 06, 2016, 07:13:33 am »
oBFusCATed: Using XTerm first I go to my code file directory then I run valgrind by the command

                    valgrind ./code_name.cbp

and output is

                    valgrind: ./code_name.cbp: Permission denied

Offline Satyajit

  • Single posting newcomer
  • *
  • Posts: 5
Re: Valgrind
« Reply #8 on: December 06, 2016, 07:20:15 am »
jens: Program is running but at last stage of data printing it shows error sometimes like this,

 free():invalid next size(normal): 0*000000....
 Aborted (core dumped)

or sometimes like this,

 double free or corruption(!prev):0*00000....
 Aborted (core dumped)


etc.


And that is why want to use valgrind to debug those problems. :)

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5177
Re: Valgrind
« Reply #9 on: December 06, 2016, 07:47:40 am »
oBFusCATed: Using XTerm first I go to my code file directory then I run valgrind by the command

                    valgrind ./code_name.cbp

and output is

                    valgrind: ./code_name.cbp: Permission denied

you should run valgrind on your executable(the program you build), not on a codeblocks project file.

Offline Satyajit

  • Single posting newcomer
  • *
  • Posts: 5
Re: Valgrind
« Reply #10 on: December 06, 2016, 08:09:22 am »
killerbot: Thanks  :)

   But still question remains, how to use valgrind from code::blocks solely without using terminal?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2463
Re: Valgrind
« Reply #11 on: December 06, 2016, 11:49:06 am »
But still question remains, how to use valgrind from code::blocks solely without using terminal?
does it work without codeblocks?