{"action":"created","issue":{"url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/46","repository_url":"https://api.github.com/repos/SpinalHDL/VexRiscv","labels_url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/46/comments","events_url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/46/events","html_url":"https://github.com/SpinalHDL/VexRiscv/issues/46","id":388548973,"node_id":"MDU6SXNzdWUzODg1NDg5NzM=","number":46,"title":"SEGV in regression test: Too many open files","user":{"login":"darkstar007","id":1486685,"node_id":"MDQ6VXNlcjE0ODY2ODU=","avatar_url":"https://avatars1.githubusercontent.com/u/1486685?v=4","gravatar_id":"","url":"https://api.github.com/users/darkstar007","html_url":"https://github.com/darkstar007","followers_url":"https://api.github.com/users/darkstar007/followers","following_url":"https://api.github.com/users/darkstar007/following{/other_user}","gists_url":"https://api.github.com/users/darkstar007/gists{/gist_id}","starred_url":"https://api.github.com/users/darkstar007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darkstar007/subscriptions","organizations_url":"https://api.github.com/users/darkstar007/orgs","repos_url":"https://api.github.com/users/darkstar007/repos","events_url":"https://api.github.com/users/darkstar007/events{/privacy}","received_events_url":"https://api.github.com/users/darkstar007/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-12-07T08:17:45Z","updated_at":"2018-12-08T20:00:11Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nIf I try and run the regression tests by 'cd src/test/cpp/regression' and then 'make clean run', I get the following output:\r\n```\r\n[snip]\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\nmake: *** [makefile:175: run] Segmentation fault\r\n```\r\n\r\nIf I turn on debug in the makefile, recompile and then do 'gdb ./obj_dir/VVexRiscv', I get the following output:\r\n\r\n```\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\n\r\nProgram received signal SIGSEGV, Segmentation fault.\r\n0x00007ffff7ad4db1 in fseek () from /lib/x86_64-linux-gnu/libc.so.6\r\n(gdb) where\r\n#0  0x00007ffff7ad4db1 in fseek () from /lib/x86_64-linux-gnu/libc.so.6\r\n#1  0x0000555555565c8c in Compliance::pass (this=0x7fffffef4470) at ../main.cpp:2155\r\n#2  0x0000555555562c8c in Workspace::dBusAccess (this=0x7fffffef4470, addr=4027580192, wr=true, size=2, mask=15, data=0x55555577c73c, error=0x555555a4c25c) at ../main.cpp:842\r\n#3  0x0000555555565ac2 in Compliance::dBusAccess (this=0x7fffffef4470, addr=4027580192, wr=true, size=2, mask=15, data=0x55555577c73c, error=0x555555a4c25c)\r\n    at ../main.cpp:2139\r\n#4  0x00005555555645af in DBusCached::preCycle (this=0x555555a4c250) at ../main.cpp:1568\r\n#5  0x0000555555563c52 in Workspace::run (this=0x7fffffef4470, timeout=5000) at ../main.cpp:1077\r\n#6  0x000055555555a232 in main (argc=1, argv=0x7fffffffe0a8, env=0x7fffffffe0b8) at ../main.cpp:2648\r\n(gdb) up\r\n#1  0x0000555555565c8c in Compliance::pass (this=0x7fffffef4470) at ../main.cpp:2155\r\n2155            fseek(refFile, 0, SEEK_END);\r\n(gdb) p ref\r\nref        refFile    refIndex   refSize    refwrap.h  \r\n(gdb) p refFile \r\n$1 = (FILE *) 0x0\r\n(gdb) l\r\n2150\r\n2151\r\n2152\r\n2153            virtual void pass(){\r\n2154                    FILE *refFile = fopen((string(\"../../resources/ref/\") + name + \".reference_output\").c_str(), \"r\");\r\n2155            fseek(refFile, 0, SEEK_END);\r\n2156            uint32_t refSize = ftell(refFile);\r\n2157            fseek(refFile, 0, SEEK_SET);\r\n2158            char* ref = new char[refSize];\r\n2159            fread(ref, 1, refSize, refFile);\r\n(gdb) p name\r\n$2 = {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \r\n    _M_p = 0x7ffffff04cf0 \"I-BGEU-01\"}, _M_string_length = 9, {_M_local_buf = \"I-BGEU-01\\000\\000\\000\\000\\000\\000\", _M_allocated_capacity = 3471524643809144137}}\r\n(gdb) \r\n```\r\n\r\nSo its failing to open the file '../../resources/ref/I-BGEU-01.reference_output' which is odd as it exists. If I now tweak main.cpp to be:\r\n\r\n```\r\n[snip]\r\n       virtual void pass(){\r\n                FILE *refFile = fopen((string(\"../../resources/ref/\") + name + \".reference_output\").c_str(), \"r\");\r\n                if (refFile == NULL) { perror(\"oh dear\"); }\r\n        fseek(refFile, 0, SEEK_END);\r\n        uint32_t refSize = ftell(refFile);\r\n        fseek(refFile, 0, SEEK_SET);\r\n[snip]\r\n```\r\n\r\nI now get the output:\r\n\r\n```\r\n[snip]\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGE-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\nSUCCESS I-BGEU-01\r\noh dear: Too many open files\r\nmake: *** [makefile:175: run] Segmentation fault\r\n```\r\n\r\nThis is with Verilator 4.006 2018-10-27  and gcc version 8.2.0 \r\n\r\nThanks,\r\n\r\nMatt\r\n\r\nps. I just noticed at the top of the output from make, I get '/bin/sh: 1: dplus: not found', what is 'dplus'? Its not on the list of requirements, I can't find anything obvious in debian packages nor can I find an obvious package on the internet. What have I missed?"},"comment":{"url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/comments/445485762","html_url":"https://github.com/SpinalHDL/VexRiscv/issues/46#issuecomment-445485762","issue_url":"https://api.github.com/repos/SpinalHDL/VexRiscv/issues/46","id":445485762,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTQ4NTc2Mg==","user":{"login":"Dolu1990","id":4832082,"node_id":"MDQ6VXNlcjQ4MzIwODI=","avatar_url":"https://avatars0.githubusercontent.com/u/4832082?v=4","gravatar_id":"","url":"https://api.github.com/users/Dolu1990","html_url":"https://github.com/Dolu1990","followers_url":"https://api.github.com/users/Dolu1990/followers","following_url":"https://api.github.com/users/Dolu1990/following{/other_user}","gists_url":"https://api.github.com/users/Dolu1990/gists{/gist_id}","starred_url":"https://api.github.com/users/Dolu1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dolu1990/subscriptions","organizations_url":"https://api.github.com/users/Dolu1990/orgs","repos_url":"https://api.github.com/users/Dolu1990/repos","events_url":"https://api.github.com/users/Dolu1990/events{/privacy}","received_events_url":"https://api.github.com/users/Dolu1990/received_events","type":"User","site_admin":false},"created_at":"2018-12-08T20:00:11Z","updated_at":"2018-12-08T20:00:11Z","author_association":"MEMBER","body":"Ok, thanks !\r\nI will give a try with valgrind :)"}}
{"actor":{"display_login":"Dolu1990"}}