Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

gpib lib generates segv on ibdev call

A call to ibdev generates a SEGV.

I have a simple C program:

#include "ni488.h"
int main() {
        int handle = ibdev(0, 7, 0, 10, 1, 0);
}

When I run it under gdb I get:

(gdb) start
Breakpoint 1 at 0x8048398: file nitest.c, line 4.
Starting program: /home/martell/src/nitest2/nitest
[Thread debugging using libthread_db enabled]
[New Thread 1076484320 (LWP 9844)]
[Switching to Thread 1076484320 (LWP 9844)]
main () at nitest.c:4
4               int handle = ibdev(0, 7, 0, 10, 1, 0);
(gdb) c
Continuing.
[New Thread 1085078448 (LWP 9847)]
[New Thread 1093471152 (LWP 9848)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1085078448 (LWP 9847)]
0x4005d609 in ?? () from /usr/local/lib/libgpibapi.so.2

If I run it under valgrind I get:

==9606== Thread 3:
==9606== Jump to the invalid address stated on the next line
==9606==    at 0x0: ???
==9606==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==9606==                                                                      
==9606== Process terminating with default action of signal 11 (SIGSEGV)
==9606==  Access not within mapped region at address 0x0                        ]
==9606==    at 0x0: ???

I am running on Mandrake Linux version 10.1.

What am I missing and/or doing wrong?

-larry
0 Kudos
Message 1 of 4
(3,069 Views)
Larry,
 
Oddly enough, the answer to your question of "what am I doing wrong" is "using a debugger".  We have found incompatibilities with GDB and the NI-488.2 driver, and so it seems reasonable to assume that valgrind would have issues too.  This will be fixed in the next version of our driver.
 
We apologize for any inconvenience.
 
Scott B.
GPIB Software
National Instruments
Message 2 of 4
(3,063 Views)
When will the next version of the driver be released? (I had forgotten how much fun it is to debug with printf's 😉

-larry
0 Kudos
Message 3 of 4
(3,059 Views)
Unfortunately, we don't have a timeline for the next Linux driver release at this time.  There is a possibility that loading the next version of VISA onto the system when it releases will fix the problem because it will update a lower-layer NI driver.  I can't tell you exactly when that is going to release either, but until then, you're stuck with the printf()'s.
 
Scott B.
GPIB Software
National Instruments
Message 4 of 4
(3,041 Views)