Summary provider for char.
This patch enables type summary for 'char' type. Given:
char c = 'h';
Before this patch, c evaluates as:
(char) $0 = 'h'
After this patch, we get:
(char) $0 = 104 'h'
This change allows the formatting of character types in MI to be removed
and replaced with that in lldb, and can be useful when evaluating
non-printable characters.
Patch from evgeny.leviant@gmail.com
Reviewed by: granata.enrico
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13657
llvm-svn: 251080
This commit is contained in:
parent
1e9aadba17
commit
8826519e2a
|
|
@ -69,6 +69,9 @@ namespace lldb {
|
|||
public:
|
||||
|
||||
SBTypeSummary();
|
||||
|
||||
// Native function summary formatter callback
|
||||
typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithSummaryString (const char* data,
|
||||
|
|
@ -81,6 +84,10 @@ namespace lldb {
|
|||
static SBTypeSummary
|
||||
CreateWithScriptCode (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithCallback (FormatCallback cb,
|
||||
uint32_t options = 0);
|
||||
|
||||
SBTypeSummary (const lldb::SBTypeSummary &rhs);
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,25 @@ SBTypeSummary::CreateWithScriptCode (const char* data, uint32_t options)
|
|||
return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data)));
|
||||
}
|
||||
|
||||
SBTypeSummary
|
||||
SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
|
||||
{
|
||||
return SBTypeSummary(
|
||||
TypeSummaryImplSP(
|
||||
cb ? new CXXFunctionSummaryFormat(options,
|
||||
[cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
|
||||
BStream stream;
|
||||
if (!cb(SBValue(valobj.GetSP()), SBTypeSummaryOptions(&opt), stream))
|
||||
return false;
|
||||
stm.Write(stream.GetData(), stream.GetSize());
|
||||
return true;
|
||||
},
|
||||
"SBTypeSummary formatter callback"
|
||||
) : nullptr
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
|
||||
m_opaque_sp(rhs.m_opaque_sp)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue