bluespec.com Forum Index bluespec.com
Bluespec Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Segmentation Fault
Goto page Previous  1, 2
 
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: Bluesim
View previous topic :: View next topic  
Author Message
nharvey



Joined: 19 Aug 2010
Posts: 11

PostPosted: Tue Jul 21, 2015 1:27 am    Post subject: Reply with quote

quark wrote:
Well, that's very unusual. What operating system (and version) are you running on? If you run "uname -a", what output does it give?

The next step to try is to run 'gdb' and see if it can provide any information about where the segfault occurred. Run this command:
Code:
gdb ${BLUESPECDIR}/bin/linux32/bluetcl

and then at the prompt:
Code:
(gdb) run

That should start bluetcl and give you the '%' prompt, at which you can type the 'Bluesim::sim' commands.

Before you do that, though, you'll need to edit your .shrc file (or .cshrc or .tcshrc, in my case) to include the 'set' (or 'setenv') command for LD_LIBRARY_PATH. The way that 'gdb' works, it doesn't use your current environment, it uses a fresh shell environment. So setting LD_LIBRARY_PATH in your environment won't make it visible to the program that 'gdb' runs. You need to add the command the to your .shrc file that will get run when 'gdb' opens a new shell.

If you do all that, does 'gdb' catch the segfault? If you then run this command:
Code:
(gdb) bt

what output does it give?


Sorry, I missed that post. Here are my answers:

Linux version is CentOS, file system is ext3.

$ uname -a
Linux localhost.localdomain 2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009 i686 i686 i386 GNU/Linux

I don't think any additional security module is running.

Here is the gdb commands:

% package require Bluesim
1.0
% Bluesim::sim load out.so mkTb

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211476272 (LWP 32726)]
0x09974164 in ?? ()
(gdb) bt
#0 0x09974164 in ?? ()
#1 0xb7fbc211 in ?? ()
#2 0x096eef2e in ?? ()
#3 0x00000000 in ?? ()
(gdb)

strace doesn't provide any clues I think:
3704 read(0, "Bluesim::sim load out.so mkTb\n", 4096) = 30
3704 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
3704 +++ killed by SIGSEGV +++

the md5sum is the same, and trying to unpack it again results in the same error.
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Wed Jul 22, 2015 4:13 pm    Post subject: Reply with quote

Ah, 'strace' won't trace in child processes unless you give it the -f flag (or the -ff flag, if you want separate output files). Can you run 'strace -f' and see if that helps?

The Bluespec release doesn't have debug symbols in it, so the 'gdb' output isn't that helpful.

You might also running 'valgrind' on bluetcl, if you have that available. It also won't have debug symbols, but it may provide more information.

In the meantime, we'll see what we can do to replicate that environment here.
Back to top
View user's profile Send private message
nharvey



Joined: 19 Aug 2010
Posts: 11

PostPosted: Thu Jul 23, 2015 12:29 am    Post subject: Reply with quote

Hi Quark,

I have attached the output from strace as out2.txt, hopefully that can elucidate something.

As for valgrind here is the output once I try Bluesim::sim load...

% package require Bluesim
1.0
% Bluesim::sim load out.so mkTb
==22248== Warning: client syscall munmap tried to modify addresses 0x9a4db1c-0xc85b13a3
==22248== at 0xD43166: munmap (in /lib/libc-2.5.so)
==22248== by 0x965DD3F: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96B5095: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96B2E91: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x965FA7E: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x965F6C8: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x974A683: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96EC710: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x9573350: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0xC8AE8B: (below main) (in /lib/libc-2.5.so)
bluetcl: internal error: gen_map_mblocks: munmap failed
(GHC version 7.6.3 for i386_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
==22248==
==22248== Process terminating with default action of signal 6 (SIGABRT)
==22248== at 0xC9DD80: raise (in /lib/libc-2.5.so)
==22248== by 0xC9F690: abort (in /lib/libc-2.5.so)
==22248== by 0x9963E24: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x965DD3F: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96B5095: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96B2E91: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x965FA7E: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x965F6C8: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x974A683: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x96EC710: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0x9573350: ??? (in /tools/Bluespec-2014.07.A/lib/bin/linux32/bluetcl)
==22248== by 0xC8AE8B: (below main) (in /lib/libc-2.5.so)
--22248-- Discarding syms at 0x49448c0-0x494b264 in /lib/libnss_files-2.5.so due to munmap()
==22248==
==22248== HEAP SUMMARY:
==22248== in use at exit: 421,958 bytes in 5,850 blocks
==22248== total heap usage: 34,247 allocs, 28,397 frees, 2,085,185 bytes allocated
==22248==
==22248== Searching for pointers to 5,850 not-freed blocks
==22248== Checked 4,014,252 bytes
==22248==
==22248== LEAK SUMMARY:
==22248== definitely lost: 0 bytes in 0 blocks
==22248== indirectly lost: 0 bytes in 0 blocks
==22248== possibly lost: 237,283 bytes in 3,456 blocks
==22248== still reachable: 184,675 bytes in 2,394 blocks
==22248== suppressed: 0 bytes in 0 blocks
==22248== Rerun with --leak-check=full to see details of leaked memory
==22248==
==22248== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 35 from 10)
--22248--
--22248-- used_suppression: 35 dl-hack3
==22248==
==22248== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 35 from 10)
Aborted

This is using --trace-children=yes -v flags. I am not familiar with the tool so if there are other flags I should be trying let me know.



out2.txt
 Description:

Download
 Filename:  out2.txt
 Filesize:  556 KB
 Downloaded:  1010 Time(s)

Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Mon Aug 03, 2015 1:10 pm    Post subject: Reply with quote

Hm. The "internal error" message visible with valgrind is interesting. That suggests that maybe this is a bug in GHC, which is a compiler that we use to build the release. We can try building the release with an older or newer version of GHC, to see if that fixes the problem for you.

If it's a memory issue, then you might try giving some flags to bluetcl to limit the memory that it uses. (How much memory is available on the computer?) You can control the maximum amount of heap and stack memory by giving flags to bluetcl's run-time system. This is done with +RTS and -RTS, where any flags in between are given to the run-time system (and all other flags are for bluetcl itself). So you could try:
Code:
bluetcl +RTS -M<size> -K<size> -RTS ...

Where "size" can be a number followed by G or M or K.
Back to top
View user's profile Send private message
quark
Site Admin


Joined: 02 Nov 2007
Posts: 500

PostPosted: Tue Aug 18, 2015 5:19 pm    Post subject: Reply with quote

Can you try using this release:
Code:
http://www.bluespec.com/downloads/Bluespec-2014.07.A_ghc6_12_3.tar.gz

That is the 2014.07.A release built with an older GHC version. If that works, you can use that, however it may run slightly slower than the regular 2014.07.A version, because it's less optimized. If it works, though, that might suggest that we could build a release with a newer GHC version, which might both fix the bug and preserve the performance. But this older version is more likely to succeed, so I want to try it first.
Back to top
View user's profile Send private message
geconom



Joined: 14 Dec 2007
Posts: 2

PostPosted: Wed Sep 23, 2015 6:02 am    Post subject: Reply with quote

Dear quark,

I had the same problem with redhat enterprise 6.3. The ghc6_12_3 solved it. Thank you for your support and hope to consider this information in your future releases.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bluespec.com Forum Index -> Tools: Bluesim All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
bluespec.com topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP