Core dumped, but core file is not in the current directory?
By : user1685466
Date : March 29 2020, 07:55 AM
|
gcc debugging, Segmentation Fault (core dumped) but no core
By : RentaroSato520
Date : March 29 2020, 07:55 AM
help you fix your problem As @JonathanLeffler noted, the core dump goes in the current directory. You can use strace to see if the process has done a chdir(). Unfortunately strace does not show where the core dump itself went, but: code :
$ cat crash.c
int main(void) {
chdir("/tmp");
*(int *)0 = 0;
return 0;
}
$ cc -o crash crash.c
$ strace ./crash
execve("./crash", ["./crash"], [/* 53 vars */]) = 0
... [lots of libc trace stuff snipped] ...
chdir("/tmp") = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault
$ ls /tmp
|
Why am I getting Segmentation fault (core dumped) or bus error (core dumped) when trying to populate a struct?
By : GG2
Date : March 29 2020, 07:55 AM
will be helpful for those in need So I am trying to use a pointer to a struct of MonsterAttacks as the data that belongs to an element of a linked list. In order to do this I try to populate a struct of MonsterAttacks and then pass that along with a null ptr to a next node to a function called create. However somewhere in the populate method a segmentation fault error occurs. I am working with three files list_demo.c, linked_list.h and linked_list.c. I will build all the the functions that make up a fully functioning linked list, well hoping I can as soon as I get pass this error. Been dealing with this error for about two days and I showed my professor and he could not figure out why its happening, it seems to come from the populate function. I have tried to return a pointer to a strut in which case I get a bus error, and I have tried almost every variation of getting input and storing it on the strut. I even deleted the function and tried to populate it in main, but nothing works. I am new to C and my professor helped me out for about an hour debug this problem and he finally gave up, so any help would be appreciated. code :
new_node->monsterAttack->attackID = 0;
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
// Moved the two structs out to make a minimal reproducible code
/* #include "linked_list.h" */
struct MonsterAttacks{
unsigned int attackID;
char monsterName[41];
char attackLocation[41];
unsigned int numOfVictims;
};
typedef struct node{
struct MonsterAttacks *monsterAttack;
struct node* next;
} node;
void populate(struct MonsterAttacks *m){
printf("Enter the name for the Monster \n");
scanf("%40s",m->monsterName);
puts("What is his/her attack location?");
scanf("%40s",m->attackLocation);
puts("What are the number of victims this monster has demolished?");
scanf("%ud", &m->numOfVictims);
m->attackID = 0;
}
node* create(struct MonsterAttacks *m,node* next)
{
node* new_node = (node*)malloc(sizeof(node));
if(new_node == NULL)
{
printf("Error creating a new node.\n");
exit(0);
}
// Just add this line
new_node->monsterAttack = malloc(sizeof (struct MonsterAttacks));
new_node->monsterAttack->attackID = 0;
new_node->next = next;
strncpy(new_node->monsterAttack->monsterName,m->monsterName,41);
strncpy(new_node->monsterAttack->attackLocation, m->attackLocation, 41);
new_node->monsterAttack->numOfVictims = m->numOfVictims;
return new_node;
}
int main(void)
{
node* tmp = NULL;
struct MonsterAttacks *tmpMonst = (struct MonsterAttacks *)
malloc(sizeof(struct MonsterAttacks));
if(tmpMonst == NULL){
printf("Error allocating memory");
}
else {
populate(tmpMonst);
}
node *head = create(tmpMonst,tmp);
printf("Name: %s\n", tmpMonst->monsterName);
printf("num victim: %d\n", tmpMonst->numOfVictims);
free(tmpMonst);
return 0;
}
|
.NET Core 2.2 docker core dumped troubleshooting
By : Jonathan Hylton
Date : March 29 2020, 07:55 AM
hope this fix your issue There might be a problem with this Newtonsoft.Json version (12.0.1), I changed it back to 11.0.2 and the error stopped. @prd for the insight.
|
compiling outdated PHP yields core dump with OpenSSL functions. OpenSSL version mismatch?
By : user3226829
Date : March 29 2020, 07:55 AM
will help you Use LD_LIBRARY_PATH will fix the problem in general, but not for yours in this case. I have rewritten the Dockerfile based on yours in order to fix the segfault. code :
# https://pastebin.com/ziZzvTh8
--- ziZzvTh8.txt 2019-10-08 10:31:33.229217226 +0800
+++ Dockerfile 2019-10-08 12:07:03.271948150 +0800
@@ -8,7 +8,7 @@
&& wget --no-check-certificate http://www.openssl.org/source/openssl-0.9.8x.tar.gz \
&& tar xvfz openssl-0.9.8x.tar.gz \
&& cd openssl-0.9.8x \
- && ./config --prefix=/usr/local/openssl-0.9.8 \
+ && ./config shared --prefix=/usr/local/openssl-0.9.8 \
&& make \
&& make install
@@ -23,7 +23,8 @@
&& ln -s /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/ \
&& ln -s /usr/lib/x86_64-linux-gnu/libmysqlclient.so /usr/lib/libmysqlclient.so \
&& mkdir /usr/kerberos \
- && ln -s /usr/lib/x86_64-linux-gnu /usr/kerberos/lib
+ && ln -s /usr/lib/x86_64-linux-gnu/mit-krb5 /usr/kerberos/lib
+
RUN apt-get build-dep -y php5
@@ -43,7 +44,6 @@
--with-zlib \
--with-gd \
--with-pgsql \
- --disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
@@ -62,7 +62,6 @@
--enable-gd-native-ttf \
--with-openssl=/usr/local/openssl-0.9.8 \
--with-openssl-dir=/usr/local/openssl-0.9.8 \
- --with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-imap \
--with-imap-ssl \
@@ -72,4 +71,6 @@
&& make \
&& make install-cli
+ADD test.php /root/test.php
+
CMD ["bash"]
<?php
$key = <<<EOF
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmHzD76i8DA25nC+Qsswi
OM0lW+gViiQD4tEm7suxBc2BGibtdlrsprVIId92hSjQKx4x8+XVWU6k89T5vy8Y
txpXN759OWdGkDi8uvZuYclMjW9Rao+oqSvbXH37R7oSY287I+6uOHclGhniQN3q
RyoXBkbhDk0/FTI/i549q/gGk1UZYv449KLrDOqmtohRcIyAYVnvvWtD1kIzourq
hMtEIrPqwoBqTaUA9kOIXw1jMovao2TN52j48KgOg9KjqtdwUwD9e6n7hJd/subF
6woc8L7zjJFOHH5gacUC7vtiMpBpnSyLQpjFLepYYwftjsRmg4xLdh+Zvgw3xqi4
lwIDAQAB
-----END PUBLIC KEY-----
EOF;
var_dump(openssl_public_encrypt($data, $crypted, $key));
var_dump($crypted);
root@7c5df089bcb0:/# php -v
PHP 4.4.9 (cli) (built: Oct 8 2019 04:09:29)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
root@7c5df089bcb0:/# php -i | grep OpenSSL
CURL Information => libcurl/7.26.0 OpenSSL/0.9.8x zlib/1.2.7 libidn/1.25 libssh2/1.4.2 librtmp/2.3
OpenSSL support => enabled
OpenSSL Version => OpenSSL 0.9.8x 10 May 2012
root@7c5df089bcb0:/# php /root/test.php
bool(true)
string(256) "W`r�b��e��',뱌Zł^�$�֗��S����w�j�د<������� �)<��j��JL(f@�A���5_S�X=g-?0M�(�d�����+��� �nD*gzË��ڞc'�\'͗�'vnmo�G�Bv�
#~�y D!��lb�t^���| )[za��5���y�G{�\�"
root@7c5df089bcb0:/# ldd `which php` | egrep 'libssl|libcrypto'
libssl.so.0.9.8 => /usr/local/openssl-0.9.8/lib/libssl.so.0.9.8 (0x00007efe86da1000)
libcrypto.so.0.9.8 => /usr/local/openssl-0.9.8/lib/libcrypto.so.0.9.8 (0x00007efe86a0b000)
libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007efe8401b000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007efe83c21000)
root@7c5df089bcb0:/# objdump -p `which php` | grep RPATH
RPATH /usr/lib/x86_64-linux-gnu:/usr/kerberos/lib:/usr/local/openssl-0.9.8/lib
|