2016-09-24 6 views
6

मैं एक समारोह है कि कुछ इस तरह दिखता है -valgrind: पते पर न पहचाना गया अनुदेश 0x5111715

std::string func() 
{ 
    std::string result; 

    ... 

    auto seed = std::random_device()(); 
    std::mt19937 gen(seed); 
    std::uniform_int_distribution<> dis(0, 61); 

    ... 
    return result; 
} 

जो compilers की विविधता और उनके संस्करणों भर में ठीक संकलित, लेकिन अभी भी Ubuntu पर valgrind टेस्ट पास करने में विफल रहता। मैंने स्पष्ट रूप से उबंटू का उल्लेख किया क्योंकि यह मेरी मशीन पर सफलतापूर्वक गुजरता है जिसमें आर्क लिनक्स स्थापना है।

दोनों valgrind प्रतिष्ठानों valgrind-3.11.0 के रूप में अपने संस्करण की रिपोर्ट और फर्क सिर्फ इतना है आर्क लिनक्स स्थापना जबकि उबंटू परीक्षण डीडी/सीआई सर्वर जो शायद वर्चुअलाइजेशन किसी तरह के तहत कर रहे पर किया गया है, कोई वर्चुअलाइजेशन के साथ अपने मशीन पर है। लेकिन क्या इससे कोई फर्क पड़ता है?

--- stderr --- 
==13849== Memcheck, a memory error detector 
==13849== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. 
==13849== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info 
==13849== Command: file/path/here 
==13849== 
vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1 
vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0 
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F 
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 
==13849== valgrind: Unrecognised instruction at address 0x5111715. 
==13849== at 0x5111715: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22) 
==13849== by 0x51118B1: std::random_device::_M_getval() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22) 
==13849== by 0x4809FB: std::random_device::operator()() (random.h:1612) 
==13849== by 0x47F0C2: isaac::deviceList::genId[abi:cxx11](unsigned int) (deviceList.cpp:21) 
==13849== by 0x47F2A7: isaac::deviceList::place(isaac::deviceType, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator>) (deviceList.cpp:38) 
==13849== by 0x40D06E: DeviceList_place_Test::TestBody() (test.cpp:194) 
==13849== by 0x45D5A7: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2078) 
==13849== by 0x4588D2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2114) 
==13849== by 0x43EBB3: testing::Test::Run() (gtest.cc:2151) 
==13849== by 0x43F3F5: testing::TestInfo::Run() (gtest.cc:2326) 
==13849== by 0x43FA52: testing::TestCase::Run() (gtest.cc:2444) 
==13849== by 0x446911: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:4315) 
==13849== Your program just tried to execute an instruction that Valgrind 
==13849== did not recognise. There are two possible reasons for this. 
==13849== 1. Your program has a bug and erroneously jumped to a non-code 
==13849== location. If you are running Memcheck and you just saw a 
==13849== warning about a bad jump, it's probably your program's fault. 
==13849== 2. The instruction is legitimate but Valgrind doesn't handle it, 
==13849== i.e. it's Valgrind's fault. If you think this is the case or 
==13849== you are not sure, please let us know and we'll try to fix it. 
==13849== Either way, Valgrind will now raise a SIGILL signal which will 
==13849== probably kill your program. 
==13849== 
==13849== Process terminating with default action of signal 4 (SIGILL): dumping core 
==13849== Illegal opcode at address 0x5111715 
==13849== at 0x5111715: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22) 
==13849== by 0x51118B1: std::random_device::_M_getval() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22) 
==13849== by 0x4809FB: std::random_device::operator()() (random.h:1612) 
==13849== by 0x47F0C2: isaac::deviceList::genId[abi:cxx11](unsigned int) (deviceList.cpp:21) 
==13849== by 0x47F2A7: isaac::deviceList::place(isaac::deviceType, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator>) (deviceList.cpp:38) 
==13849== by 0x40D06E: DeviceList_place_Test::TestBody() (test.cpp:194) 
==13849== by 0x45D5A7: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2078) 
==13849== by 0x4588D2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2114) 
==13849== by 0x43EBB3: testing::Test::Run() (gtest.cc:2151) 
==13849== by 0x43F3F5: testing::TestInfo::Run() (gtest.cc:2326) 
==13849== by 0x43FA52: testing::TestCase::Run() (gtest.cc:2444) 
==13849== by 0x446911: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:4315) 
==13849== 
==13849== HEAP SUMMARY: 
==13849==  in use at exit: 84,300 bytes in 108 blocks 
==13849== total heap usage: 622 allocs, 514 frees, 530,112 bytes allocated 
==13849== 
==13849== LEAK SUMMARY: 
==13849== definitely lost: 0 bytes in 0 blocks 
==13849== indirectly lost: 0 bytes in 0 blocks 
==13849==  possibly lost: 0 bytes in 0 blocks 
==13849== still reachable: 84,300 bytes in 108 blocks 
==13849==   suppressed: 0 bytes in 0 blocks 
==13849== Rerun with --leak-check=full to see details of leaked memory 
==13849== 
==13849== For counts of detected and suppressed errors, rerun with: -v 
==13849== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 
------- 

संपादित - -


यहाँ valgrind रन के लिए लॉग है मैं भी मैन्युअल आधिकारिक स्रोत से valgrind निर्माण और इसे स्थापित करने की कोशिश की है, हालांकि अब भी वही त्रुटि पैदा करता है।

+1

क्या संकलक झंडे आप उबंटू मशीन पर उपयोग किया था? जाहिर है, संकलक एक अवैध निर्देश पैदा कर रहा है। उबंटू मशीन पर '/ proc/cpuinfo' का आउटपुट क्या है? –

+0

@MartinNyolt दोनों बनाता है एक ही झंडे, ubuntu '/ proc/cpuinfo' है - https://gist.github.com/agauniyal/c8d57b106097a16296b259b86fc93368 –

+1

लेकिन * क्या * झंडे वास्तव में? मैं आपको यह जानने में मदद कर रहा हूं कि क्यों * आपका कंपाइलर अवैध निर्देश उत्पन्न करता है। क्या आपने कोड डीबग किया था और * कौन सा निर्देश निष्पादित करने की कोशिश करता है? क्या त्रुटि केवल वाल्ग्रिंड के दौरान होती है, या क्या आपको सामान्य निष्पादन के दौरान सिगिल भी मिलता है? –

उत्तर

3

ऐसा लगता है कि आपके उबंटू सिस्टम में एक यादृच्छिक संख्या लाइब्रेरी है जो RDRAND निर्देश (ओपोड 0x0f 0xc7) का उपयोग करती है, जो वालग्रिंड का आपका संस्करण पहचान नहीं पाता है। आपका आर्क सिस्टम स्पष्ट रूप से एक अलग कार्यान्वयन का उपयोग करता है जो इस निर्देश का लाभ नहीं उठाता है।

आप एक पूर्व आइवी ब्रिज सीपीयू के लिए फिर से संकलन के द्वारा इस के आसपास काम करने में सक्षम हो सकता है।

+0

मेरे सिस्टम पर संकलन के रूप में पुनः संकलन, फिर सीआई पर उस बाइनरी को डाउनलोड करना और उस पर वाल्ग्रिंड चलाना? –

+1

ऐसा लगता है कि निर्देश आपके libstdC++ लाइब्रेरी में है, इसलिए मुझे लगता है कि आपको इसे फिर से संकलित करने की आवश्यकता हो सकती है।आप यह देखने के लिए भी जांच सकते हैं कि यह एक ज्ञात समस्या है या नहीं, और देखें कि इसे ठीक करने के लिए कोई पैच है या नहीं। –

+0

हम्म, क्या मैं इसके बजाय स्थैतिक रूप से लिंक नहीं कर सकता? LibstdC++ लाइब्रेरी को पुन: संकलित करना मेरे लिए एक दिन का काम प्रतीत नहीं होता है: पी –

7

https://bugs.kde.org/show_bug.cgi?id=353370 देखें।

अंतिम svn संस्करण को प्राप्त/संकलित करना इस समस्या को हल करना चाहिए।

यदि नहीं, तो, बगजिला पर इसकी रिपोर्ट करें के रूप में 3.12 रिहाई जल्द ही उत्पादन किया जाएगा। धन्यवाद

+1

मैं टिप्पणी करना भूल गया लेकिन यह मेरी समस्या का समाधान किया :) –

संबंधित मुद्दे