On 1/4/2016 7:55 AM, allswellthatendswell wrote:
{ edited by mod to shorten text lines to ~70 characters. the source
and command lines have not been edited. -mod }
The following C++ program , DataServer.cpp, throws a segmentation
fault at the exit of the extern "C" function, void func(void) shown
in the bottom of this question. I compiled this program on Ubuntu
Linux 14.04 LTS with the g++ entry point feature.
g++ -shared -g -fPIC -DLINUX -Wl,-soname,libdataserver.so -efunc -I /home/venkat/Downloads/waitForMultipleObjects -I /home/venkat/developmentMono/SmartCamXi_Hybrid/Include DataServer.cpp DataServerLib.cpp DataTransferClient.cpp CWinEventHandle.cpp WinEvent.cpp -lpthread -lrt
When I run gdb ./a.out core, I get the following output: :~/Downloads/DataServerLib$ gdb ./a.out
Reading symbols from ./a.out...done.
[New LWP 8538]
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000001 in ?? ()
(gdb) bt
#0 0x0000000000000001 in ?? ()
#1 0x00007ffdab79f29e in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) where
#0 0x0000000000000001 in ?? ()
#1 0x00007ffdab79f29e in ?? ()
#2 0x0000000000000000 in ?? ()
(gdb) list
<snip code>
Normally a segfault on a function return means the stack has been
overwritten and the return address is bad. It could be anything from a
buffer overrun to insufficient stack size (shouldn't be a problem
nowadays, but I don't know what you've allocated from the stack before
arriving here). Looking through your code I don't see anything that
jumps out at me, but you've left out a lot of information.
Which compiler are you using? What compiler options? Do you have any
errors or warnings?
You didn't provide a compilable example (or even the header files), so
it's impossible for others to test. All I can recommend is to comment
out all of the code in func() and try uncommenting a couple of lines at
a time until you get the error.
--
==================
Remove the "x" from my email address
Jerry Stuckle
[email protected]
==================
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)