Author: enrico Date: Thu Nov 5 21:04:56 2015 New Revision: 252272 URL: http://llvm.org/viewvc/llvm-project?rev=252272&view=rev Log: Change the way we read data from the ObjC runtime
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=252272&r1=252271&r2=252272&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Thu Nov 5 21:04:56 2015 @@ -253,16 +253,17 @@ ClassDescriptorV2::method_t::Read(Proces m_types_ptr = extractor.GetAddress_unchecked(&cursor); m_imp_ptr = extractor.GetAddress_unchecked(&cursor); - const size_t buffer_size = 1024; - size_t count; - - DataBufferHeap string_buf(buffer_size, 0); - - count = process->ReadCStringFromMemory(m_name_ptr, (char*)string_buf.GetBytes(), buffer_size, error); - m_name.assign((char*)string_buf.GetBytes(), count); + process->ReadCStringFromMemory(m_name_ptr, m_name, error); + if (error.Fail()) + { + return false; + } - count = process->ReadCStringFromMemory(m_types_ptr, (char*)string_buf.GetBytes(), buffer_size, error); - m_types.assign((char*)string_buf.GetBytes(), count); + process->ReadCStringFromMemory(m_types_ptr, m_types, error); + if (error.Fail()) + { + return false; + } return true; } @@ -317,16 +318,17 @@ ClassDescriptorV2::ivar_t::Read(Process m_alignment = extractor.GetU32_unchecked(&cursor); m_size = extractor.GetU32_unchecked(&cursor); - const size_t buffer_size = 1024; - size_t count; - - DataBufferHeap string_buf(buffer_size, 0); - - count = process->ReadCStringFromMemory(m_name_ptr, (char*)string_buf.GetBytes(), buffer_size, error); - m_name.assign((char*)string_buf.GetBytes(), count); + process->ReadCStringFromMemory(m_name_ptr, m_name, error); + if (error.Fail()) + { + return false; + } - count = process->ReadCStringFromMemory(m_type_ptr, (char*)string_buf.GetBytes(), buffer_size, error); - m_type.assign((char*)string_buf.GetBytes(), count); + process->ReadCStringFromMemory(m_type_ptr, m_type, error); + if (error.Fail()) + { + return false; + } return true; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits