Hello Again,
I have commented the code:
if(!setCwdToExeDir()){
return false;
}
I have also explicitly search the file in absolute path:
fp = fopen("/opt/epics/support/hello_world.aocx", "r");
With gdb I can confirm that fp opens the file properly. Then everything still the same, this is the error in gdb if I ignore SIGABRT:
*** Error in `/opt/epics/support/areaDetector/ADHPS_FPGA_1D/iocs/HPSFPGA1DIOC/bin/linux-arm/hpsfpga1dtest': munmap_chunk(): invalid pointer: 0x00247ed0 ***
Program received signal SIGABRT, Aborted.
If I wait for the signal the info with backtrace:
*** Error in `/opt/epics/support/areaDetector/ADHPS_FPGA_1D/iocs/HPSFPGA1DIOC/bin/linux-arm/hpsfpga1dtest': munmap_chunk(): invalid pointer: 0x00247ed0 ***
Program received signal SIGABRT, Aborted.
0x75edda34 in raise () from /lib/libc.so.6
(gdb) bt
# 0 0x75edda34 in raise () from /lib/libc.so.6
# 1 0x75ededb0 in abort () from /lib/libc.so.6
# 2 0x75f165f0 in ?? () from /lib/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) exit
Then I have executed again valgrind and it again gives me another result (I have attached the file):
This is the most significant part:
==529== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==529== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==529== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==529== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
==529== Warning: whilst reading EXIDX: Implausible EXIDX last entry size 4294964079; using 1 instead.
--529-- Reading EXIDX entries: 564 attempted, 452 successful
--529-- REDIR: 0x58528c0 (libc.so.6:memset) redirected to 0x484b6bc (memset)
--529-- REDIR: 0x5859c40 (libc.so.6:memcpy) redirected to 0x484a0b4 (memcpy)
--529-- REDIR: 0x5851170 (libc.so.6:rindex) redirected to 0x48486e8 (rindex)
--529-- REDIR: 0x5850dc1 (libc.so.6:strlen) redirected to 0x4848cc8 (strlen)
--529-- REDIR: 0x585216c (libc.so.6:bcmp) redirected to 0x484b08c (bcmp)
--529-- REDIR: 0x58503f1 (libc.so.6:strcmp) redirected to 0x48499f8 (strcmp)
--529-- REDIR: 0x5850fe4 (libc.so.6:strncmp) redirected to 0x48492fc (strncmp)
--529-- REDIR: 0x584bb88 (libc.so.6:malloc) redirected to 0x4845320 (malloc)
--529-- REDIR: 0x58506f0 (libc.so.6:stpcpy) redirected to 0x484b164 (stpcpy)
--529-- REDIR: 0x5850700 (libc.so.6:strcpy) redirected to 0x4848dc4 (strcpy)
--529-- REDIR: 0x580aaa0 (libc.so.6:putenv) redirected to 0x484c930 (putenv)
--529-- REDIR: 0x5850310 (libc.so.6:index) redirected to 0x48488d8 (index)
--529-- REDIR: 0x5850e9c (libc.so.6:strnlen) redirected to 0x4848c68 (strnlen)
--529-- REDIR: 0x584c3fc (libc.so.6:realloc) redirected to 0x4847ab0 (realloc)
--529-- REDIR: 0x584c6e8 (libc.so.6:calloc) redirected to 0x48478a8 (calloc)
--529-- REDIR: 0x584c328 (libc.so.6:free) redirected to 0x4846894 (free)
--529-- REDIR: 0x58520d1 (libc.so.6:memchr) redirected to 0x4849bc0 (memchr)
--529-- REDIR: 0x5852580 (libc.so.6:memmove) redirected to 0x484b72c (memmove)
--529-- REDIR: 0x566299c (libstdc++.so.6:operator new(unsigned int)) redirected to 0x4845968 (operator new(unsigned int))
--529-- REDIR: 0x5851b48 (libc.so.6:strstr) redirected to 0x484c45c (strstr)
--529-- REDIR: 0x585484c (libc.so.6:strchrnul) redirected to 0x484bdc4 (strchrnul)
--529-- REDIR: 0x5851124 (libc.so.6:strncpy) redirected to 0x4848f3c (strncpy)
--529-- REDIR: 0x58547c0 (libc.so.6:rawmemchr) redirected to 0x484bdec (rawmemchr)
--529-- REDIR: 0x5660640 (libstdc++.so.6:operator delete(void*)) redirected to 0x4846df0 (operator delete(void*))
--529-- REDIR: 0x5851604 (libc.so.6:strspn) redirected to 0x484c69c (strspn)
--529-- REDIR: 0x585123c (libc.so.6:strpbrk) redirected to 0x484c5d0 (strpbrk)
==529== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==529== at 0x56F1A4C: __libc_sigaction (in /lib/libpthread-2.23.so)
==529== Address 0x7dd8df8c is on thread 1's stack
==529== Uninitialised value was created by a stack allocation
==529== at 0x4E03AE6: aocl_mmd_open (in /root/opencl_arm32_rte/host/arm32/lib/libalterammdpcie.so)
==529==
==529== Syscall param write(buf) points to uninitialised byte(s)
==529== at 0x56F0228: write (in /lib/libpthread-2.23.so)
==529== by 0x4E024DB: ACL_PCIE_MM_IO_DEVICE::write_block(unsigned int, unsigned int, void*) (in /root/opencl_arm32_rte/host/arm32/lib/libalterammdpcie.so)
==529== Address 0x7dd8d02c is on thread 1's stack
==529== Uninitialised value was created by a stack allocation
==529== at 0x4E0245E: ACL_PCIE_MM_IO_DEVICE::write_block(unsigned int, unsigned int, void*) (in /root/opencl_arm32_rte/host/arm32/lib/libalterammdpcie.so)
==529==
--529-- REDIR: 0x5662a88 (libstdc++.so.6:operator new(unsigned int)) redirected to 0x48461b8 (operator new(unsigned int))
--529-- REDIR: 0x5660648 (libstdc++.so.6:operator delete(void*)) redirected to 0x4847410 (operator delete(void*))
==529== Invalid read of size 4
==529== at 0x56A405C: std::string::_Rep::_M_grab(std::allocator<char> const&, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa7654 is 4 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Invalid read of size 4
==529== at 0x56A3B68: std::string::_Rep::_M_refcopy() (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa7654 is 4 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Invalid write of size 4
==529== at 0x56A3B70: std::string::_Rep::_M_refcopy() (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa7654 is 4 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Invalid read of size 4
==529== at 0x56A3258: std::string::_Rep::_M_dispose(std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa7654 is 4 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Invalid write of size 4
==529== at 0x56A3260: std::string::_Rep::_M_dispose(std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa7654 is 4 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Invalid read of size 4
==529== at 0x56A2F94: std::string::compare(char const*) const (in /usr/lib/libstdc++.so.6.0.20)
==529== Address 0x5aa764c is 12 bytes before a block of size 20 alloc'd
==529== at 0x484625C: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529== Conditional jump or move depends on uninitialised value(s)
==529== at 0x48468E4: free (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529== Uninitialised value was created by a heap allocation
==529== at 0x48453C4: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==529==
==529==
The result of the execution with valgrind:
ERROR: CL_INVALID_PROGRAM
Location: ../HPS_FPGA_1D.cpp:212
Failed to build program
However I have tested my aocx with another program that can load it (in a very similar way) and it works properly. Do you know what else can be? Thanks again for your help