aboutsummaryrefslogtreecommitdiff
path: root/lldb/bindings/macros.swig
blob: cb013daa158d90f7166ac1f273b84a0997d17e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%define STRING_EXTENSION_LEVEL_OUTSIDE(Class, Level)
%extend lldb:: ## Class ## {
  std::string __repr__(){
    lldb::SBStream stream;
    $self->GetDescription (stream, Level);
    const char *desc = stream.GetData();
    size_t desc_len = stream.GetSize();
    if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
      --desc_len;
    }
    return std::string(desc, desc_len);
  }
}
%enddef

%define STRING_EXTENSION_OUTSIDE(Class)
%extend lldb:: ## Class ## {
  std::string __repr__(){
    lldb::SBStream stream;
    $self->GetDescription (stream);
    const char *desc = stream.GetData();
    size_t desc_len = stream.GetSize();
    if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
      --desc_len;
    }
    return std::string(desc, desc_len);
  }
}
%enddef