Determine the line of code that causes a segmentation fault?
How does one determine where the mistake is in the code that causes a segmentation fault? Can my compiler (gcc) show the location of the fault in the program? 6 Answers 6
How does one determine where the mistake is in the code that causes a segmentation fault? Can my compiler (gcc) show the location of the fault in the program? 6 Answers 6
I’ve been reading the other posts on tracking down the reasons for getting a SIGSEGV in an Android app. I plan to scour my app for possible NullPointers related to Canvas use, but my SIGSEGV barfs up a different memory address each time. Plus I’ve seen code=1 and code=2. If the memory address was 0x00000000, … Read more
What does the “bus error” message mean, and how does it differ from a segmentation fault? 18 Answers 18
The following code receives seg fault on line 2: char *str = “string”; str[0] = ‘z’; // could be also written as *str=”z” printf(“%s\n”, str); While this works perfectly well: char str[] = “string”; str[0] = ‘z’; printf(“%s\n”, str); Tested with MSVC and GCC. 19 Answers 19
What is a segmentation fault? Is it different in C and C++? How are segmentation faults and dangling pointers related? 17 s 17 Segmentation fault is a specific kind of error caused by accessing memory that “does not belong to you.” It’s a helper mechanism that keeps you from corrupting the memory and introducing hard-to-debug … Read more