Gdb Bus Error Core Dumped
Contents |
gdb bus error(core dump), from linking in a library From: Grant Schoep
Bus Error (core Dumped) Centos
Date: Wed, 17 Mar 2004 11:05:59 -0700 Subject: gdb bus error(core dump), from linking in bus error c++ a library Help!.. gdb keeps core dumping on me(with a bus error). I've stripped the app down to a hello world c program. It still
Bus Error Linux
core'd. I figured out it is a particular library that I am linking in(pkgl in my below example). Anyone know why linking in a certain library would cause gdb to core dump? This is just driving me nuts as I can't stand having to do printf debugging in an app... bus error core dumped c++ I need my debugger! :> How I compile/link this app. gcc -c -g ba1_main.c gcc -g -L/home/gschoep/pkgl/lib -o ba1 ba1_main.o -Bstatic -lpkgl This is what I get when I run the am in the debugger(it runs fine outside the debugger) gschoep@weasel>263% gdb ./ba1 GNU gdb 6.0 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.9"... (gdb) run Starting program: /silver/home/gschoep/test/ipc/gdbtest/ba1 Bus error (core dumped) I am using gcc 3.3.2, gdb 6.0 Any ideas? Thanks -grant Follow-Ups: Re: gdb bus error(core dump), from linking in a library From: Ramana Radhakrishnan Index Nav: [DateIndex] [SubjectIndex] [AuthorIndex] [ThreadIndex] Message Nav: [DatePrev][DateNext] [ThreadPrev][ThreadNext]
here for a quick
Bus Error Core Dumped In Unix
overview of the site Help Center Detailed answers to
How To Debug Bus Error
any questions you might have Meta Discuss the workings and policies of this how to solve bus error in linux site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us https://sourceware.org/ml/gdb/2004-03/msg00158.html Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why http://stackoverflow.com/questions/9985818/why-am-i-getting-core-dumped am I getting core dumped? [closed] up vote 0 down vote favorite Please help me. I can't figure out why I get a core dumped when I run this program. Before returning anything I can print all_albums_p just fine. Why am I getting core dumped? #include "music_server.h" struct album_ { int num_tracks; char **tracks; int **playlist_hits; }; typedef struct album_ album; album *parse_album(FILE *album_file,int *number_of_albums){ int number_of_album,number_of_tracks,number_of_charaters; int i,j; char dummy_space; int *p; fscanf(album_file,"%d", &number_of_album); *number_of_albums = number_of_album; album *all_albums_p = (album *)malloc(sizeof(album)*number_of_album); for(j=0;j program yourself, you can skip the rest of this section. For College-supported software, you can report the bug by contacting a consultant through olc or "mail staff". ------------------------------------------------------------------------------- If the program displays this message: Bus error http://www.glue.umd.edu/afs/glue.umd.edu/system/info/olh/Utilities/Unix_answers/unix_bus_or_seg.html or Segmentation fault or Core dump ... then the program was trying to access a memory http://www.openldap.org/lists/openldap-software/199912/msg00257.html location outside its address space. The computer detected this problem and sent a signal to your program, which caused it to abort. Things that cause bus errors and segmentation violations are typically out-of-bounds array references and/or references through uninitialized or mangled pointers. Look very closely in your program for bizarre things like that. A common example in C is: int c; bus error scanf("%d", c); instead of the correct version: int c; scanf("%d", &c); An example from C++ is: int* p=new int[100]; cout<< p[100]; instead of the correct version: int* p=new int[100]; cout << p[99] (remember array referances in C and C++ start with 0 ) There are a number of methods for finding out where the program went out of bounds. One method is to use printf() statements to determine how far the program is getting before it bus error core crashes, and to print out the contents of interesting variables. A more sophisticated method is using 'dbx', a source level symbolic debugger. C and C++ programmers can also use 'gdb'. To learn about 'dbx', you can read the manual pages by using the 'man' command, as in: man dbx To learn about 'gdb', you can read the manual node in the 'xinfo' program, or using 'M-x info' in Emacs. If you need to debug your program, you may want to enable a core dump. Usually, those two messages above would also have "(core dumped)" by them, indicating that the program wrote an image of its current memory into a file called "core" in that directory. You might want to type 'fs lq' and find out how many blocks (kilobytes) you have available in your quota. Then you can type, say: limit coredumpsize 100 .. to limit your core dump size to 100K for your current login. BE CAREFUL not to let yourself go over quota, as you would then not be able to create or edit files. You should delete the "core" file when you don't need it any more. To allow core dumps and still not have quota worries, you can make a symbolic link from the name core into the /tmp directory. Core dumps created this way will not take up quota, and they will autom Thu, 23 Dec 1999 13:06:17 +0530 References: <006b01bf4bdb$9b34e800$48daed89@asparks.cpd.harris.com> <000a01bf4c2c$927b7660$99beb8ca@gsb.gitn.com.my> <004f01bf4c2c$21372f80$84cda8c0@wipinfo.soft.net> <000901bf4d0f$35a4bc60$99beb8ca@gsb.gitn.com.my> hi rosdi well seems you are running out of memory coz the malloc is failing, you are not able to get continous chunk of memory, i had the same problem with some other implementation of ldap, my suggestion first check if you can increase the ulimit. do ulimit -a and check on vmemory, if its set to some value change it like this ulimit -v unlimited (if you have super user access its going to work) secondly if it still core dumps, then do the following increase the size of chunk from 120 to some huge variable like 1024 or 2048 types, check in the code where ch_calloc() is called in your ldap i.e file ch_malloc.c and try oops just now saw that in frame #9 , the base value is out of bounds in shell_back_search()??????? anyone worked with shell_back_search(), shouldnt this contain the base value. my 1-bit thoughts. bye bharat ----- Original Message ----- From: Rosdi Kasim