473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Valgrind is preventing the crash in my program

2
Hello
I have a situation, my program has a crash (SIGSEGV) for a reason that I don't know yet. I tried to analyze it using Valgrind but when I invoke the program with Valgrind, the crash no longer occurs.
Another observation is the crash only happens on SMP linux kernel. When I run the program on thhe non-SMP kernel it doesn't crash.

So does anyone know what exactly does Valgrind do that may have prevented the occurence of the crash??

Any help is appreciated.
Jul 1 '07 #1
4 3580
Motoma
3,237 Expert 2GB
Hello
I have a situation, my program has a crash (SIGSEGV) for a reason that I don't know yet. I tried to analyze it using Valgrind but when I invoke the program with Valgrind, the crash no longer occurs.
Another observation is the crash only happens on SMP linux kernel. When I run the program on thhe non-SMP kernel it doesn't crash.

So does anyone know what exactly does Valgrind do that may have prevented the occurence of the crash??

Any help is appreciated.
What language are you writing your program in?
It sounds like you are running into problems with the SMP kernel, and Valgrind may be subverting your attempts to debug because it is Valgrind running, and stepping through your program, and your program isn't actually running (think virtualization).
Jul 2 '07 #2
eskimo
2
My program is in C++ and Assembly. What happens is:
1) When I run on SMP, I get a crash. If I use Valgrind, the crash is no longer there.
2) When I run on non-SMP, I don't get a crash. Regardless of the use of Valgrind.
Jul 3 '07 #3
Motoma
3,237 Expert 2GB
My program is in C++ and Assembly. What happens is:
1) When I run on SMP, I get a crash. If I use Valgrind, the crash is no longer there.
2) When I run on non-SMP, I don't get a crash. Regardless of the use of Valgrind.
Your assembly may be causing the issue. Do you understand what I was saying about Valgrind emulating a single processor machine?
Jul 3 '07 #4
Hi I am not the original poster but am experiencing exactly the same issue. very frustrating.

I understand what you say and it would appear this seems to be a threading issue as my program uses multiple threads (1 per connection).
As far as I am aware all critical pieces of code are protected with re-entrant mutexes but perhaps I have missed something.

I am new to Linux programming and need to resolve this issue. Any hints you can give as to how I can go about tracing this problem would be appreciated.

As it is I have left the program running under Valgrind as it is considerably more stable :(

Oh also when the program is not under Valgrind and it crashes it does not produce a core dump so I cannot use that.

Thanks in advance
Aug 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jerald | last post by:
Running python 2.3.4 on valgrind (a tool like purify which checks the use of uninitialized memory, etc), gives a lot of errors. See below. jfj@cluster:~/> python -V Python 2.3.4...
1
by: Alexandre | last post by:
Hi, I'm currently investigating a leak in a c++ program. I've run valgrind to detect it and valgrind give me some result like this one... ==5336== 64064 bytes in 728 blocks are still...
0
by: Sitsofe Wheeler | last post by:
Hello, I am using a threaded C program and each thread creates its own connection to mysql database using mysql_init(). When I run Valgrind on the program it reports that there has been a small...
2
by: Andreas Andersen | last post by:
Hi I have been using valgrind to debug a program I have written in C++ and it has been very helpful in eliminating memory errors/leaks. However, I just recently discovered a bug and from what I...
2
by: hvaisane | last post by:
Valgrind says ==11604== Invalid read of size 4 ==11604== at 0x8048ABB: main (foo.cc:36) ==11604== Address 0x1B92415C is 4 bytes inside a block of size 8 free'd ==11604== at 0x1B90514F:...
5
by: Roman Mashak | last post by:
Hello, All! I already posted my question and received valuable feedbacks, I changed my code as was proposed here but still receive the same error of valgrind. SO, the code is: #define...
2
by: Mohsen | last post by:
Dear all, I am running a program and in one of the functions I have to sort the data of an array as follows: .. .. .. for (m=0;m<M;++m) //Sort { k=m; for (j=m+1;j<M;++j)
4
by: Simple Simon | last post by:
It's entirely possible that I'm completely in the wrong line of work, but I don't see what Valgrind is complaining about in this code. Invalid read/writes? If I free the within main(), rather...
7
by: wwfarch | last post by:
I'm working on creating a K-Nearest Neighbor classifier and having some problems that I can't figure out. I have a header file KNNClassifier.h and its class file KNNClassifier.cc In...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.