segmentation-fault

Tricky Segmentation faults with BST recursion in C

偶尔善良 提交于 2019-12-24 09:35:32
问题 I'm trying to add strings to a Binary Search Tree using a recursive insert method (the usual for BSTs, IIRC) so I can later print them out using recursion as well. Trouble is, I've been getting a segmentation faults I don't really understand. Related code follows (this block of code is from my main function): #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> // Stores the size of the C-strings we will use; // Standardized to 100 (assignment specifications say //

Trie Implementation in C++

青春壹個敷衍的年華 提交于 2019-12-24 09:03:03
问题 I am trying to implement the trie as shown on the TopCoder page. I am modifying it a bit to store the phone numbers of the users. I am getting segmentation fault. Can some one please point out the error. #include<iostream> #include<stdlib.h> using namespace std; struct node{ int words; int prefix; long phone; struct node* children[26]; }; struct node* initialize(struct node* root) { root = new (struct node); for(int i=0;i<26;i++){ root->children[i] = NULL; } root->word = 0; root->prefix = 0;

segfault in g_slice_alloc

吃可爱长大的小学妹 提交于 2019-12-24 08:28:17
问题 I am calling a function with the following lines: void call_system_command(const char *command_params) { GString *cmd = g_string_sized_new(1024); g_string_append_printf(cmd, "/bin/bash /path/to/my/script '%s'", command_params); system(cmd->str); g_string_free(cmd, TRUE); } I am getting segfault in the line with g_string_sized_new. Backtrace from gdb shows: (gdb) bt #0 0x000000320ce56264 in g_slice_alloc () from /lib64/libglib-2.0.so.0 #1 0x000000320ce5c3db in g_string_sized_new () from /lib64

Eclipse constantly segfaults in GDB

走远了吗. 提交于 2019-12-24 07:14:48
问题 While figuring out why Eclipse has been crashing on me, I tried to start eclipse and attach GDB to the eclipse java process. However, almost as soon as I attached GDB and told it to continue, there has been a constant stream of segfaults, almost immediately after I continue. This is part of it: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f445879d700 (LWP 22968)] 0x00007f445739b3f4 in JVM_NewInstanceFromConstructor () from /usr/java/jdk1.7.0_45/jre/lib/amd64

Play Framework causing SIGSEGV fault on first page load with crud moduel

我怕爱的太早我们不能终老 提交于 2019-12-24 06:40:32
问题 Found this bug, which states the problem as well as I could. https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/732707 The question is - are there any potential workarounds? Thanks 回答1: In the bug report they mention they use IcedTea JVM, not Oracle's one. I've never had this problem with Oracle's, so the workaround: use Oracle's JVM. Also, if you are using version 1.1.1 you should be aware there is a huge security hole, you should update to 1.2.3 ASAP. (latest 1.1.x may have it fixed,

Calling a global string variable from Fortran in C causes segmentation fault

…衆ロ難τιáo~ 提交于 2019-12-24 06:38:22
问题 I'm trying to call a global string variable which is defined in a Fortran subroutine, in C. the C code is Cfile.c : #include <stdio.h> typedef struct { int length; char* string; } fstring; extern fstring stringf_; void fortfunc_(); int main() { fstring stringC = stringf_; stringC.string[stringC.length-1] = '\0'; printf("%s \n",stringC.string); return 0; } and FORTRAN code is Ffile.f : subroutine fortfunc() character*30 string common/stringF/ string string = 'this is a string in FROTRAN77'

SDL Error while Creating Window?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 06:06:37
问题 #include<SDL2/SDL.h> #include<stdio.h> #include<stdbool.h> bool init(char *title, int width, int height); void close(); SDL_Window *window = NULL; SDL_Surface *screen = NULL; bool init(char *title, int width, int height){ bool success = true; // SDL_Init 0 on success and returns negative on failure if( SDL_Init(SDL_INIT_EVERYTHING) != 0 ){ SDL_Log("Couldn't initialize SDL: %s",SDL_GetError()); success = false; } // creating Window and Surface window = SDL_CreateWindow(title, SDL_WINDOWPOS

Segfault when calling llvm_sys' LLVMCreateTargetMachine to generate object file in Rust

三世轮回 提交于 2019-12-24 05:53:27
问题 extern crate llvm_sys; use llvm_sys::*; use llvm_sys::prelude::*; use llvm_sys::core::*; pub fn emit(module: LLVMModuleRef) { unsafe { use llvm_sys::target_machine::*; let triple = LLVMGetDefaultTargetTriple(); let mut target: LLVMTargetRef = std::mem::uninitialized(); LLVMGetTargetFromTriple(triple, &mut target, ["Cannot get target.\0".as_ptr() as *mut i8].as_mut_ptr()); let cpu = "x86\0".as_ptr() as *const i8; let feature = "\0".as_ptr() as *const i8; let opt_level = LLVMCodeGenOptLevel:

Error in package msm: *** caught segfault *** 'memory not mapped'

夙愿已清 提交于 2019-12-24 05:16:07
问题 I am trying to run a multistate model using the package msm and I am encountering the following error: *** caught segfault *** address 0x607c00032c60, cause 'memory not mapped' The data dat.long <- structure(list(id = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, 9L, 9L, 9L, 10L, 10L, 10L, 11L, 11L, 11L, 12L, 12L, 12L, 13L, 13L, 13L, 14L, 14L, 14L, 15L, 15L, 15L, 16L, 16L, 16L, 17L, 17L, 17L, 18L, 18L, 18L, 19L, 19L, 19L, 20L, 20L, 20L, 21L,

Check for stdout or stderr

时光总嘲笑我的痴心妄想 提交于 2019-12-24 05:02:55
问题 One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139) And even though, I am redirecting both stdout and stderr to a logfile, the Segmentation Fault error messages is displayed in the terminal when I am running the shell script. Is it possible to redirect this message from Segfault to a logfile ?? 回答1: The Segmentation Fault message you see is printed by the shell that is running your program. This behavior varies from shell to shell, so a