Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-CAN 2.2, GCC 3.42, pthreads_win32, C++ on Windows segmentation faults

Hello,
I think I've got a tricky one here...  I've got a working multithreaded app which sends and receives CAN messages.  I'm using this particular combination of tools becaise parts of the app will eventually be ported to Linux (and then no longer be based on NI-CAN).  What's happening is that before main() begins to execute under gdb, I see two segfaults:  the stack for the first looks like this:

2 _libwsock32_a_iname()  0x7c9105f8
1 <symbol is not available> 0x00000000

and the second:

7 <symbol is not available> 0x00000000
6 <symbol is not available> 0x003d8250
5 <symbol is not available> 0x003d74e6
4 _libwsock32_a_iname()  0x7c9011a7
3 _libwsock32_a_iname()  0x7c91cbab
2 _libwsock32_a_iname()  0x7c92173e
1 _libwsock32_a_iname()  0x7c921639

Then the program runs and seems to work fine.   Yet an earlier version of the same program, with I think the same combination of tools did not do this.   While trying to track it down, I stripped the test program down to an empty main() and not linking with any other code which uses CAN or anything else.  That fixes the problem.   Then I added back in linking some code which uses CAN but never gets called by main() and the problem recurs, leading me to believe that something about the CAN, or pthreads library initialization is causing this.

Does this ring a bell to anyone?  Anything I could try to track it down?

thanks
-MM

0 Kudos
Message 1 of 3
(4,087 Views)
I'm really just guessing here, but maybe this will help:

AE KB 3OLENG00: Why Does my Application Segmentation Fault When Using the pthread Library?

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
0 Kudos
Message 2 of 3
(4,092 Views)
I get the same symptom with the simple program attached.  (since the forum says "message cannot exceed 5000 characters" even though I doubt it is that large.

Perhaps the two segfaults are "normal" for NI-CAN and it catches them after I unpause the debugger?  Troubling still because I'm pretty sure many versions ago I had it without them (and with segfaults in my own code, as expected)

Edit:  This rules out PThreads and the STL, both of which were in play before.
-MM

Message Edited by mmcleod on 06-28-2006 10:10 AM

0 Kudos
Message 3 of 3
(4,081 Views)