segmentation-fault

Why do I get a segmentation fault in my simple c++ program using libexpect.so?

China☆狼群 提交于 2019-12-04 04:01:11
I am busy with a project where I have to automate some processes in bash or ssh so I decided to use the libexpect.so library. If you don't know what libexpect is, it provides an expect extension that I can use in a c++ program, and expect is just a program where you can run automated scripts for things like ssh. So I can execute a script which attempts to ssh somewhere...when the password prompt is found by expect I could have already given expect a password to send. My problem is that when I run a program, even a really simple one, I get a segmentation fault which I narrowed down, with gdb,

Using perlbrew to build a perl with debugging symbols

喜你入骨 提交于 2019-12-04 02:43:56
I'm trying to track down a segmentation fault that I've been able to isolate to just a few lines of code on different versions of Perl. I use perlbrew to manage my various versions for development and testing, but it doesn't build perl with debugging symbols, so using gdb to analyse the core dump file is pretty useless. So what's the best way to have perlbrew build with debugging symbols enabled. And if possible I'd like to be able to have it be a separate perl that I could switch to instead of overriding the standard one for the same version. ikegami perlbrew install -v 5.14.2 --as=5.14.2d

Android Fatal Signal 7 (SIGBUS)

吃可爱长大的小学妹 提交于 2019-12-04 02:21:15
I'm getting a few SIGBUS (7) and SIGSEGV (11) crashes that I am having difficult tracking down. The thread that appears to be causing the crash is primarily used for loading images to be displayed which makes sense since the logs indicate something failing with the SkJPEGImageDecoder. I re-use memory for Bitmaps in accordance with this guide Could it have something to do with that? LogCat output: 05-20 13:46:09.775: A/libc(419): Fatal signal 7 (SIGBUS) at 0x0000001e (code=1), thread 520 (ImageLoaderExec) 05-20 13:46:09.875: I/DEBUG(172): *** *** *** *** *** *** *** *** *** *** *** *** *** ***

Segmentation fault on gcc caused by lambda wrapper over variadic template function call

混江龙づ霸主 提交于 2019-12-04 00:22:20
I've spent quite a few hours today trying to understand why this code segfaults on g++6.2 and g++7.0 , while happily working as intended on clang++3.9 (and 4.0 ) . I reduced the issue to a 85 lines self-contained code snippet , which does not segfault upon normal execution, but always reports an error under UBSAN. The issue is reproducible on wandbox , by compiling with g++7 , enabling optimizations and passing -fsanitize=undefined as an extra flag. This is what UBSAN reports: prog.cc: In function 'int main()': prog.cc:61:49: warning: 'ns#0' is used uninitialized in this function [

EXC_BAD_ACCESS (SIGSEGV) in WebCore::UserGestureIndicator::processingUserGesture

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 22:29:38
I have an iOS application built using a UIWebView and HTML5 websockets. The app experiences seemingly random crashes. It has occurred while a user is interacting with it and during longevity tests where no interaction between user and app occurs. The crash logs all have the following: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000 and the thread logs contain: Thread XX name: WebCore: Worker Thread XX Crashed: 0 WebCore 0x36c8c7a0 WebCore::UserGestureIndicator::processingUserGesture() + 20 1 WebCore 0x36d7070a WebCore::DOMTimer::DOMTimer(WebCore:

C++ strange segmentation fault by object creation

一笑奈何 提交于 2019-12-03 21:59:28
I have a strange problem by initiating a class object. The problem is as strange as well not easily reproducible. However I will try to give an indicating example. I have inheritance classes. class BarClass { public: BarClass() { ... } BarClass(int i, int j) { ... } void doSomething() { ... } }; class FooClass : public BarClass { public: FooClass() { } FooClass(int i, int j) : BarClass(i,j) { ... } }; Sometime if I initiate objects with following manner, I will get segmentation fault error by initialization. FooClass foo1; foo1.doSomething(); FooClass foo2(10, 20); foo2.doSomething(); If I use

C++ in G++ - Segmentation Fault when not using pointers

五迷三道 提交于 2019-12-03 21:43:27
I'm trying to use G++ to compile some C++ code. It seems to work fine in other compilers, but for whatever reason, G++ won't produce working output. Disclosure: This is part of a homework assignment, but I feel like it's more of a compiler issue, since it works in other compilers. Here's the snippet that's wreaking havoc: set<int> t1, t2; It's strange because the following code works just fine: set<int> *t1 = new set<int>(); set<int> *t2 = new set<int>(); Granted, I have to use -> instead of . , but that's expected. The first snippet produces a segmentation fault at runtime. The second does

What exactly happens inside the OS to cause the segmentation fault

跟風遠走 提交于 2019-12-03 21:27:18
I have read a lot about the virtual address and paging. Let me first tell you people what i understood. When a process wants to execute something it tries to load the data from the hard disk to memory. To do this it uses a virtual address. So our MMU validates the virtual address looks into the TLB to find the corresponding physical page, if it doesn't find there it looks into Inverted Page Table and at the end it looks into Page table if it doesn't find an entry over there it generates a page fault and all the swapping of page is done and all the tables will be updated. And as I read all the

Segmentation fault in fgets() - C language

一世执手 提交于 2019-12-03 20:32:56
I am getting a segmentation fault exactly at this line: while (fgets(line, MAX_LEN + 1, stream) != NULL) { .... } where MAX_LEN is 500, line is reading the current line, and stream is open through fopen(filename, "r"); I am reading lines from a file with a specific format and I get a segmentation fault (Core dumps) exactly at this line according to the debugger. I made my code so that it ignores lines that do not match the scanf format. Here is what I am implementing. Something close to it at least: int main(int argc, int **argv) { .... .... if (argc == 1) { printf("enter file name: "); scanf(

Can I write-protect every page in the address space of a Linux process?

烂漫一生 提交于 2019-12-03 20:17:55
问题 I'm wondering if there's a way to write-protect every page in a Linux process' address space (from inside of the process itself, by way of mprotect() ). By "every page", I really mean every page of the process's address space that might be written to by an ordinary program running in user mode -- so, the program text, the constants, the globals, and the heap -- but I would be happy with just constants, globals, and heap. I don't want to write-protect the stack -- that seems like a bad idea.