Segmentation Error while trying to volume up - c++

I have a simulation that I am trying to profile it with gprof.
I didn't write it and I am not allowed to add any code. Normally the program runs without errors. It is written in C++.
While program running, when I try to change the volume of the system from keyboard, the program gives the error: Segmentation fault (core dumped) every time.
My system is Linux 3.8.0-37-generic #53~precise1-Ubuntu x86_64 x86_64 x86_64 GNU/Linux.
Does it arrive because of the code, which runs perfectly in other systems ? If not what could be the reason? How can I avoid it?

Related

Debugging gdb: exit code 139 in VSCode

I am working on a large codebase and trying to debug the same using gdb(C/C++) extension on VSCode.
On running a particular configuration, I get an error with exit code 139. I know this is a segmentation fault, but am unable to exactly pinpoint where the seg fault is occurring. Is there any way I can monitor that?
Probably some file that I am missing where the details are being captured?
I can debug segfault using gdb from the terminal. But since the code requires certain configurations and is spread over hundreds of files, I am not sure how to do that.

GCC: Random builds causing Segmentation Fault during execution

I'm currently struggle to unterstand a certain behavior which randomly happens after a software build. The software consists of multiple modules and, after building it, it will exit with a segmentation fault during execution.
I've identified two different steps during execution where this behavior happens.
The software exits with seg fault while executing a certain task.
The software exits with seg fault after completion of the task.
And in some cases, no seg fault occures at all. The problem is, that using a debug build, will only show me the cause of the second case (which is caused by a call to a third-party library). But I'm not really able to identify why this is happing.
It's a 32 bit build using gcc (SUSE Linux) 7.5.0.
You could use valgrind to check your program for any memory issues

Debugging segmentation faults (core dumped) for big projects

I tried to run this code [the-git-link] (https://github.com/DropIn/SequentialTextReading), but I experience a "Segmentation fault (core dumped)". Do you have any idea about this error? I am running it on Ubuntu 14.4 and
the code is too big to use traditional debug methods on it like using gdb.
Any idea how to solve this problem or what tools should i use to solve it knowing that there are many files and main in the project?
You can also load your coredump to gdb and find the root cause, after your program crashed.
You may benefit from reading How to generate core dump file in Ubuntu, and How to analyze a program's core dump file with gdb?

debugging stripped-down linux system

I'm having a problem on my embedded linux board. My program runs, then somewhere in a particular function throws a segmentation fault. So i'm trying to track down why this is happening so I can fix it.
The problem is that my target board runs a filesystem image which does not include gdb or gdbserver. Is there any way I can debug this application as it runs on the embedded target without rebuilding the kernel or my application?

FORTRAN Segmentation Fault

The project written in Fortran runs in different machine fine, but when taken to some other Linux machines it does not. It says segmentation fault on one of them, and on the other it says segmentation fault (core dumped). I did gdb of my program, it is very surprising that it points the segfault to the first line in the program where it should print value of a variable kept in module.
I am compiling all of them as follows:
gfortran -mcmodel=large -fPIC -fopenmp -lgfortran ...
Do you know why this might be the case? The gfortran version is 4.7.2 on Ubuntu 12.10.
Perhaps you need to increase the stack size on those machines. There are answers on this subject on Stackoverflow. Check ulimit.