Format a Python string or gdb.Value for display as a literal.
(s)
| 171 | |
| 172 | |
| 173 | def string_literal(s): |
| 174 | """ |
| 175 | Format a Python string or gdb.Value for display as a literal. |
| 176 | """ |
| 177 | max_len = 50 |
| 178 | if isinstance(s, gdb.Value): |
| 179 | s = s.string() |
| 180 | if len(s) > max_len: |
| 181 | s = s[:max_len] |
| 182 | return '"' + s.translate(_string_literal_mapping) + '" [continued]' |
| 183 | else: |
| 184 | return '"' + s.translate(_string_literal_mapping) + '"' |
| 185 | |
| 186 | |
| 187 | def bytes_literal(val, size=None): |
no test coverage detected