LLDB  mainline
Classes | Namespaces | Typedefs | Functions
StringPrinter.cpp File Reference
#include "lldb/DataFormatters/StringPrinter.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Status.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ConvertUTF.h"
#include <ctype.h>
#include <locale>
#include <memory>
Include dependency graph for StringPrinter.cpp:

Go to the source code of this file.

Classes

class  DecodedCharBuffer
 DecodedCharBuffer stores the decoded contents of a single character. More...
 

Namespaces

 lldb_private
 A class that represents a running process on the host machine.
 
 lldb_private::formatters
 

Typedefs

using GetPrintableElementType = StringPrinter::GetPrintableElementType
 
using StringElementType = StringPrinter::StringElementType
 
using EscapingHelper = std::function< DecodedCharBuffer(uint8_t *, uint8_t *, uint8_t *&)>
 

Functions

template<StringElementType type>
static DecodedCharBuffer GetPrintableImpl (uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next, StringPrinter::EscapeStyle escape_style)
 
static bool isprint32 (char32_t codepoint)
 
DecodedCharBuffer attemptASCIIEscape (llvm::UTF32 c, StringPrinter::EscapeStyle escape_style)
 
template<>
DecodedCharBuffer GetPrintableImpl< StringElementType::ASCII > (uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next, StringPrinter::EscapeStyle escape_style)
 
template<>
DecodedCharBuffer GetPrintableImpl< StringElementType::UTF8 > (uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next, StringPrinter::EscapeStyle escape_style)
 
static DecodedCharBuffer GetPrintable (StringElementType type, uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next, StringPrinter::EscapeStyle escape_style)
 
static EscapingHelper GetDefaultEscapingHelper (GetPrintableElementType elem_type, StringPrinter::EscapeStyle escape_style)
 
template<typename SourceDataType >
static bool DumpEncodedBufferToStream (GetPrintableElementType style, llvm::ConversionResult(*ConvertFunction)(const SourceDataType **, const SourceDataType *, llvm::UTF8 **, llvm::UTF8 *, llvm::ConversionFlags), const StringPrinter::ReadBufferAndDumpToStreamOptions &dump_options)
 Read a string encoded in accordance with. More...
 
template<typename SourceDataType >
static bool lldb_private::formatters::ReadEncodedBufferAndDumpToStream (StringElementType elem_type, const StringPrinter::ReadStringAndDumpToStreamOptions &options, llvm::ConversionResult(*ConvertFunction)(const SourceDataType **, const SourceDataType *, llvm::UTF8 **, llvm::UTF8 *, llvm::ConversionFlags))
 
template<>
bool lldb_private::formatters::StringPrinter::ReadStringAndDumpToStream< StringElementType::UTF8 > (const ReadStringAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadStringAndDumpToStream< StringElementType::UTF16 > (const ReadStringAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadStringAndDumpToStream< StringElementType::UTF32 > (const ReadStringAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadStringAndDumpToStream< StringElementType::ASCII > (const ReadStringAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStream< StringElementType::UTF8 > (const ReadBufferAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStream< StringElementType::UTF16 > (const ReadBufferAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStream< StringElementType::UTF32 > (const ReadBufferAndDumpToStreamOptions &options)
 
template<>
bool lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStream< StringElementType::ASCII > (const ReadBufferAndDumpToStreamOptions &options)
 

Typedef Documentation

◆ EscapingHelper

using EscapingHelper = std::function<DecodedCharBuffer(uint8_t *, uint8_t *, uint8_t *&)>

Definition at line 59 of file StringPrinter.cpp.

◆ GetPrintableElementType

Definition at line 28 of file StringPrinter.cpp.

◆ StringElementType

Definition at line 29 of file StringPrinter.cpp.

Function Documentation

◆ attemptASCIIEscape()

DecodedCharBuffer attemptASCIIEscape ( llvm::UTF32  c,
StringPrinter::EscapeStyle  escape_style 
)

◆ DumpEncodedBufferToStream()

template<typename SourceDataType >
static bool DumpEncodedBufferToStream ( GetPrintableElementType  style,
llvm::ConversionResult(*)(const SourceDataType **, const SourceDataType *, llvm::UTF8 **, llvm::UTF8 *, llvm::ConversionFlags)  ConvertFunction,
const StringPrinter::ReadBufferAndDumpToStreamOptions dump_options 
)
static

◆ GetDefaultEscapingHelper()

static EscapingHelper GetDefaultEscapingHelper ( GetPrintableElementType  elem_type,
StringPrinter::EscapeStyle  escape_style 
)
static

Definition at line 237 of file StringPrinter.cpp.

References GetPrintable().

Referenced by DumpEncodedBufferToStream().

◆ GetPrintable()

static DecodedCharBuffer GetPrintable ( StringElementType  type,
uint8_t *  buffer,
uint8_t *  buffer_end,
uint8_t *&  next,
StringPrinter::EscapeStyle  escape_style 
)
static

Definition at line 218 of file StringPrinter.cpp.

Referenced by GetDefaultEscapingHelper().

◆ GetPrintableImpl()

template<StringElementType type>
static DecodedCharBuffer GetPrintableImpl ( uint8_t *  buffer,
uint8_t *  buffer_end,
uint8_t *&  next,
StringPrinter::EscapeStyle  escape_style 
)
static

◆ GetPrintableImpl< StringElementType::ASCII >()

template<>
DecodedCharBuffer GetPrintableImpl< StringElementType::ASCII > ( uint8_t *  buffer,
uint8_t *  buffer_end,
uint8_t *&  next,
StringPrinter::EscapeStyle  escape_style 
)

Definition at line 136 of file StringPrinter.cpp.

References attemptASCIIEscape(), DecodedCharBuffer::GetSize(), and lldbassert.

◆ GetPrintableImpl< StringElementType::UTF8 >()

template<>
DecodedCharBuffer GetPrintableImpl< StringElementType::UTF8 > ( uint8_t *  buffer,
uint8_t *  buffer_end,
uint8_t *&  next,
StringPrinter::EscapeStyle  escape_style 
)

◆ isprint32()

static bool isprint32 ( char32_t  codepoint)
static

Definition at line 69 of file StringPrinter.cpp.

Referenced by GetPrintableImpl< StringElementType::UTF8 >().