1%define STRING_EXTENSION_LEVEL(Class, Level) 2%extend { 3 %nothreadallow; 4 std::string lldb:: ## Class ## ::__str__(){ 5 lldb::SBStream stream; 6 $self->GetDescription (stream, Level); 7 const char *desc = stream.GetData(); 8 size_t desc_len = stream.GetSize(); 9 if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) { 10 --desc_len; 11 } 12 return std::string(desc, desc_len); 13 } 14 %clearnothreadallow; 15} 16%enddef 17 18%define STRING_EXTENSION(Class) 19%extend { 20 %nothreadallow; 21 std::string lldb:: ## Class ## ::__str__(){ 22 lldb::SBStream stream; 23 $self->GetDescription (stream); 24 const char *desc = stream.GetData(); 25 size_t desc_len = stream.GetSize(); 26 if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) { 27 --desc_len; 28 } 29 return std::string(desc, desc_len); 30 } 31 %clearnothreadallow; 32} 33%enddef 34