473,655 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Valgrind is preventing the crash in my program

2 New Member
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 3631
Motoma
3,237 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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
developerchris
1 New Member
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
2942
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 jfj@cluster:~/> valgrind python ==10517== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
1
3405
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 reachable in loss record 14 of 16 ==5336== at 0x40026B30: __builtin_new (vg_replace_malloc.c:172) ==5336== by 0x4028C531: AnObject::AnObject(AnObject const &)
0
657
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 leak stemming from several mysql_init and one mysql_real_connect. I have read http://www.mysql.com/doc/en/Threaded_clients.html but despite adding my_thread_init(), my_thread_end() and linking against mysqlclient_r a leak is still reported. Here...
2
2544
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 can see it looks like some kind of memory problem. However, when I run it through valgrind no errors are reported and the bug seems to be gone! I print some status from the program and at some point this becomes wrong but when the program is run...
2
22789
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: operator delete(void*) (vg_replace_malloc.c:156) ==11604== by 0x804A1BA: __gnu_cxx::new_allocator<Foo>::deallocate(Foo*, unsigned) (new_allocator.h:86) ==11604== by 0x8049C08: std::_Vector_base<Foo, std::allocator<Foo> >::_M_deallocate(Foo*,...
5
16163
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 DB_IS_FLD_EMPTY(x) (((x) && *(x)) ? 0 : 1) int db_is_fld_empty(char *fld) { return DB_IS_FLD_EMPTY(fld);
2
1807
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
5080
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 than within free_node_list(), Valgrind reports 0 leaks? OS: SuSE 9.3 Linux 2.6.11.4-21.11-default i686 i386 GCC: 3.3.5 20050117
7
10924
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 KNNClassifier.h I have the following declarations: class KNNClassifier{ ... map<int, string> classNames; map<int, DataStore*> lastDataStores; map<int, int*> classificationMap; map<int, int> indexMap;
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8710
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.