Differences between version 9 and predecessor to the previous major change of CommonProgrammingBugs.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 9 | Last edited on Friday, November 5, 2004 3:02:04 pm | by JohnMcPherson | Revert |
Older page: | version 8 | Last edited on Thursday, February 5, 2004 3:00:13 pm | by JohnMcPherson | Revert |
@@ -3,18 +3,20 @@
To diagnose this problem, compile everything with __-g__ (and probably [-Wall] as well) and link it all with electric fence (__-lefence__).
eg:
- [gcc|gcc(1)] -g [-Wall] broken.cc -o broken.o
- gcc -lefence broken.o -o broken
+ <tt>
[gcc|gcc(1)] -g [-Wall] broken.cc -o broken.o</tt><br>
+ <tt>
gcc -lefence broken.o -o broken</tt>
Check your ulimit(1) is not set to 0 (as is the default on most recent distros).
ulimit -c unlimited
This allows your program to dump core.
then run your program
+<verbatim>
./broken
Segmentation Fault (core dumped)
+</verbatim>
If you don't get the "(core dumped)" bit, then your ulimit is wrong, or you don't have write access to the current working directory, or the disk is full etc.
Now that you have the program and the core file, use it to figure out where your program cored
gdb ./broken ./core
@@ -23,7 +25,16 @@
(gdb) bt full
bt full will take the __b__ack __t__race of the core file and if you specify "full" it'll show you all the variables along the way.
The first line should be the place where your bug occured. If you look at this line you'll probably find you're doing something silly (like addressing past the end of an array, or using a pointer that has been free()'d).
+
+!!!ld: ''name'': hidden symbol `__dso_handle' in /.../crtbegin.o is referenced by DSO
+You are linking against a shared library that was created incorrectly.
+
+Eg this happens with gcc/g++ version 3 if you create a shared library directly using
+ <tt>ld -shared -o libfoo.so ...</tt>
+You should instead use
+ <tt>g++ -shared -Wl,-soname,libfoo.so.1 -o libfoo.so ...</tt>
+
----
See our DeBugging page for more details.