debugging - How to see printf lines in gdb? -


मेरे मूल कोड को डीबग करना मैं इन पंक्तियों को लिखा था:

  m_sock = socket (m_iAf, M_iType, m_iProtocol); Printf ("errno =% d,% s \ n", त्रुटि, strerror (errno)); printf ( "Hellowrold \ n");   

मैंने एक गर्तिका बनाई है, लेकिन जब मैं इस रेखा को निष्पादित करता हूँ, यह नकारात्मक वापस आ रहा है इसलिए मुझे त्रुटि ढूंढनी होगी

मैं मुद्रित लाइनों को कैसे देख सकता हूं?

मैं एनडीके-जीडीबी के साथ नया हूँ, इसलिए कृपया मदद की ज़रूरत है। Printf के बजाय आप एंड्रॉइड लॉगिंग सुविधा का उपयोग कर सकते हैं:

धन्यवाद, रिआसैट

  #include & lt; एंड्रॉइड / लॉग। एच & gt; __android_log_print (ANDROID_LOG_INFO, "MYPROG", "त्रुटि =% d,% s", त्रुटि, strerror (errno)); __android_log_print (ANDROID_LOG_INFO, "MYPROG", "हेलोरोल्ड");   

अनुगामी "\ n" यहां के लिए कोई ज़रूरत नहीं है और ये लॉगकैट में दिखाई देंगे आपको लॉगिंग लायबरी से भी लिंक करना होगा। आपकी एंड्रॉइड.एमके फ़ाइल में, निम्नलिखित को जोड़ें:

  LOCAL_LDLIBS: = -log    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -