segmentation-fault

Compiling c with -fomit-frame-pointer -mrtd creates segfault on free function pointer

喜夏-厌秋 提交于 2019-12-08 04:50:34
问题 This c code crash with a segmentation fault if I compile with GCC using -fomit-frame-pointer and -mrtd. Is my code wrong in some way? Other function pointers works as expected, but not when its the free-function that is being passed? I get a warning when compiling, but I dont understand why or what I should do to fix. (I usually dont code in c, this error comes from a 3d part library that I use) I need rtd/stdcall because Im on windows and need to call this library from python with ctypes,

Segmentation fault in std function std::_Rb_tree_rebalance_for_erase ()

旧街凉风 提交于 2019-12-08 04:39:02
问题 (Note to any future readers: The error, unsurprisingly, is in my code and not std::_Rb_tree_rebalance_for_erase () ) I'm somewhat new to programming and am unsure how to deal with a segmentation fault that appears to be coming from a std function. I hope I'm doing something stupid (i.e., misusing a container), because I have no idea how to fix it. The precise error is Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x000000000000000c

How to detect out-of-memory segfaults?

ぃ、小莉子 提交于 2019-12-08 04:30:43
问题 How does one detect whether a segfault is being caused by an out-of-memory condition? I have a segfault that defies diagnosis by valgrind and duma/efence because it seems to crash those tools themselves (Valgrind "the impossibe happened", duma: "mprotect() failed: Cannot allocate memory" ) The application (Gazebo) simply crashes with a segfault, and a stack trace that doesn't seem to offer many hints as to why. TLDR: Is there an easy tool or method to either confirm or rule out the out-of

handle SIGSEGV in Linux?

会有一股神秘感。 提交于 2019-12-08 04:24:00
问题 I need handle the SIGSEGV in my Linux app. The reason is some clean up(3-partry lib) must be done before generate core-dump. What is more, the clean up must be performed in the context of calling thread, cannot do in signal handler. So I plan in signal handler to pass the control to the calling thread, after the clean up finished, then use raise(SIGSEGV) to generate the core-dump. The real problem seems the signal_handler cannot pass the control to calling thread, no matter I use post_sem or

Is it possible to get a Linux coredump that only contains callstack, threads, and local variables?

故事扮演 提交于 2019-12-08 04:18:03
问题 My company is utilizing the coredump functionality in Linux (CentOS specifically) to track down some hard to find issues. Unfortunately, we have a bunch of small VMs running with limited HD space and the full core dumps are causing issues because of the large amount of space taken up by the heaps. Is it possible to just have Linux dump the callstack, threads and local variables when a segmentation fault occurs? I tried just limiting the dumps to 50 megs, but it doesn't seem like all the

difference between string pointer and string array

天大地大妈咪最大 提交于 2019-12-08 04:02:47
问题 I was writing code to reinforce my knowledge, I got segmentation fault. So, I also got that I have to restock(completing imperfect knowledge) on my knowledge. The problem is about strtok() . When I run the first code there is no problem, but in second, I get segmantation fault. What is my "imperfect knowledge" ? Thank you for your appreciated answers. First code #include <stdio.h> #include <string.h> int main() { char str[] = "team_name=fenerbahce"; char *token; token = strtok(str,"="); while

While making a function call in C, is the stack of OS used, and is the size of stack fixed?

冷暖自知 提交于 2019-12-08 03:56:23
问题 Here's my code #include<stdio.h> #define ROW 10000 #define COLUMN 10000 void hello(int arr[ROW][COLUMN]){ printf("hoho"); } void main(){ int arr[ROW][COLUMN]; hello(arr); } Now, this gives me segmentation fault. My question is, that I understand that while making a function call, stack is used to keep all the variables passed to the function. So is this the stack of OS? i.e. does OS has a separate memory block designed specially for this? Also, is the size of stack fixed? What if I have to

sprintf access violation

偶尔善良 提交于 2019-12-08 03:17:00
问题 I have a problem with the following code: for(i = 0;(i - 1)< n;i++) { char* b; sprintf(b, "%d", i); } It compiles fine but when I run it it give me the infamous "0XC0000005 Access Violation" error. I have tried setting b to NULL, "", "0", 0 and a bunch of other stuff but then I get the "0XC0000005 Access Violation" error or "Expression: string != NULL. Any help would be appreciated! 回答1: sprintf writes data into an existing buffer, which you pass into it as the first parameter. Currently you

How can I “catch” a seg fault while importing an F2Py module?

徘徊边缘 提交于 2019-12-08 02:36:22
问题 Some background, the relevance of which may fluctuate: I am currently in possesion of some F2Py libraries - Python modules compiled by F2Py from some Fortran code. For all intents and purposes, you can regard these modules as "third party"; I currently do not have access to the Fortran source code, and I am not in charge of the compilation process. The modules themselves are imported into a program I am helping to develop that has Python scripting support and that runs on multiple platforms.

need explanation on why does EXCEPTION_ACCESS_VIOLATION occur

你离开我真会死。 提交于 2019-12-08 01:59:31
问题 Hi I know that this error which I'm going to show can't be fixed through code. I just want to know why and how is it caused and I also know its due to JVM trying to access address space of another program. A fatal error has been detected by the Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6dcd422a, pid=4024, tid=3900 JRE version: 6.0_14-b08 Java VM: Java HotSpot(TM) Server VM (14.0-b16 mixed mode windows-x86 ) Problematic frame: V [jvm.dll+0x17422a] An error