2011-06-24 01:59:56 +08:00
|
|
|
//===-- FormatManager.cpp -------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Core/FormatManager.h"
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
|
|
|
|
2011-07-15 10:26:42 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
|
|
|
|
2011-06-24 01:59:56 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2011-06-24 05:22:24 +08:00
|
|
|
|
|
|
|
struct FormatInfo
|
|
|
|
{
|
|
|
|
Format format;
|
|
|
|
const char format_char; // One or more format characters that can be used for this format.
|
|
|
|
const char *format_name; // Long format name that can be used to specify the current format
|
|
|
|
};
|
|
|
|
|
|
|
|
static FormatInfo
|
|
|
|
g_format_infos[] =
|
|
|
|
{
|
|
|
|
{ eFormatDefault , '\0' , "default" },
|
|
|
|
{ eFormatBoolean , 'B' , "boolean" },
|
|
|
|
{ eFormatBinary , 'b' , "binary" },
|
|
|
|
{ eFormatBytes , 'y' , "bytes" },
|
|
|
|
{ eFormatBytesWithASCII , 'Y' , "bytes with ASCII" },
|
|
|
|
{ eFormatChar , 'c' , "character" },
|
|
|
|
{ eFormatCharPrintable , 'C' , "printable character" },
|
|
|
|
{ eFormatComplexFloat , 'F' , "complex float" },
|
|
|
|
{ eFormatCString , 's' , "c-string" },
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
{ eFormatDecimal , 'd' , "decimal" },
|
2011-06-24 05:22:24 +08:00
|
|
|
{ eFormatEnum , 'E' , "enumeration" },
|
|
|
|
{ eFormatHex , 'x' , "hex" },
|
|
|
|
{ eFormatFloat , 'f' , "float" },
|
|
|
|
{ eFormatOctal , 'o' , "octal" },
|
|
|
|
{ eFormatOSType , 'O' , "OSType" },
|
|
|
|
{ eFormatUnicode16 , 'U' , "unicode16" },
|
|
|
|
{ eFormatUnicode32 , '\0' , "unicode32" },
|
|
|
|
{ eFormatUnsigned , 'u' , "unsigned decimal" },
|
|
|
|
{ eFormatPointer , 'p' , "pointer" },
|
|
|
|
{ eFormatVectorOfChar , '\0' , "char[]" },
|
|
|
|
{ eFormatVectorOfSInt8 , '\0' , "int8_t[]" },
|
|
|
|
{ eFormatVectorOfUInt8 , '\0' , "uint8_t[]" },
|
|
|
|
{ eFormatVectorOfSInt16 , '\0' , "int16_t[]" },
|
|
|
|
{ eFormatVectorOfUInt16 , '\0' , "uint16_t[]" },
|
2011-07-06 23:56:06 +08:00
|
|
|
{ eFormatVectorOfSInt32 , '\0' , "int32_t[]" },
|
|
|
|
{ eFormatVectorOfUInt32 , '\0' , "uint32_t[]" },
|
|
|
|
{ eFormatVectorOfSInt64 , '\0' , "int64_t[]" },
|
|
|
|
{ eFormatVectorOfUInt64 , '\0' , "uint64_t[]" },
|
2011-06-24 05:22:24 +08:00
|
|
|
{ eFormatVectorOfFloat32, '\0' , "float32[]" },
|
|
|
|
{ eFormatVectorOfFloat64, '\0' , "float64[]" },
|
|
|
|
{ eFormatVectorOfUInt128, '\0' , "uint128_t[]" },
|
|
|
|
{ eFormatComplexInteger , 'I' , "complex integer" },
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
{ eFormatCharArray , 'a' , "character array" },
|
|
|
|
{ eFormatAddressInfo , 'A' , "address" },
|
|
|
|
{ eFormatHexFloat , 'X' , "hex float" },
|
|
|
|
{ eFormatInstruction , 'i' , "instruction" }
|
2011-06-24 05:22:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
g_num_format_infos = sizeof(g_format_infos)/sizeof(FormatInfo);
|
|
|
|
|
|
|
|
static bool
|
|
|
|
GetFormatFromFormatChar (char format_char, Format &format)
|
|
|
|
{
|
|
|
|
for (uint32_t i=0; i<g_num_format_infos; ++i)
|
|
|
|
{
|
|
|
|
if (g_format_infos[i].format_char == format_char)
|
|
|
|
{
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
GetFormatFromFormatName (const char *format_name, bool partial_match_ok, Format &format)
|
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
for (i=0; i<g_num_format_infos; ++i)
|
|
|
|
{
|
|
|
|
if (strcasecmp (g_format_infos[i].format_name, format_name) == 0)
|
|
|
|
{
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (partial_match_ok)
|
|
|
|
{
|
|
|
|
for (i=0; i<g_num_format_infos; ++i)
|
|
|
|
{
|
|
|
|
if (strcasestr (g_format_infos[i].format_name, format_name) == g_format_infos[i].format_name)
|
|
|
|
{
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FormatManager::GetFormatFromCString (const char *format_cstr,
|
|
|
|
bool partial_match_ok,
|
|
|
|
lldb::Format &format)
|
|
|
|
{
|
|
|
|
bool success = false;
|
|
|
|
if (format_cstr && format_cstr[0])
|
|
|
|
{
|
|
|
|
if (format_cstr[1] == '\0')
|
|
|
|
{
|
|
|
|
success = GetFormatFromFormatChar (format_cstr[0], format);
|
|
|
|
if (success)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
success = GetFormatFromFormatName (format_cstr, partial_match_ok, format);
|
|
|
|
}
|
|
|
|
if (!success)
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
char
|
|
|
|
FormatManager::GetFormatAsFormatChar (lldb::Format format)
|
|
|
|
{
|
|
|
|
for (uint32_t i=0; i<g_num_format_infos; ++i)
|
|
|
|
{
|
|
|
|
if (g_format_infos[i].format == format)
|
|
|
|
return g_format_infos[i].format_char;
|
|
|
|
}
|
|
|
|
return '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *
|
|
|
|
FormatManager::GetFormatAsCString (Format format)
|
|
|
|
{
|
|
|
|
if (format >= eFormatDefault && format < kNumFormats)
|
|
|
|
return g_format_infos[format].format_name;
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-07-02 08:25:22 +08:00
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
FormatCategory::FormatCategory(IFormatChangeListener* clist,
|
|
|
|
std::string name) :
|
|
|
|
m_summary_nav(new SummaryNavigator("summary",clist)),
|
|
|
|
m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
|
|
|
|
m_filter_nav(new FilterNavigator("filter",clist)),
|
|
|
|
m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-19 00:38:26 +08:00
|
|
|
m_synth_nav(new SynthNavigator("synth",clist)),
|
|
|
|
m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-19 00:38:26 +08:00
|
|
|
m_enabled(false),
|
|
|
|
m_change_listener(clist),
|
|
|
|
m_mutex(Mutex::eMutexTypeRecursive),
|
|
|
|
m_name(name)
|
|
|
|
{}
|
|
|
|
|
2011-08-23 08:32:52 +08:00
|
|
|
bool
|
|
|
|
FormatCategory::Get (ValueObject& valobj,
|
|
|
|
lldb::SummaryFormatSP& entry,
|
|
|
|
lldb::DynamicValueType use_dynamic,
|
|
|
|
uint32_t* reason)
|
|
|
|
{
|
|
|
|
if (!IsEnabled())
|
|
|
|
return false;
|
|
|
|
if (GetSummaryNavigator()->Get(valobj, entry, use_dynamic, reason))
|
|
|
|
return true;
|
|
|
|
bool regex = GetRegexSummaryNavigator()->Get(valobj, entry, use_dynamic, reason);
|
|
|
|
if (regex && reason)
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
*reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
|
2011-08-23 08:32:52 +08:00
|
|
|
return regex;
|
|
|
|
}
|
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
bool
|
|
|
|
FormatCategory::Get(ValueObject& valobj,
|
2011-11-04 11:34:56 +08:00
|
|
|
lldb::SyntheticChildrenSP& entry_sp,
|
2011-08-19 00:38:26 +08:00
|
|
|
lldb::DynamicValueType use_dynamic,
|
|
|
|
uint32_t* reason)
|
|
|
|
{
|
|
|
|
if (!IsEnabled())
|
|
|
|
return false;
|
2011-11-04 11:34:56 +08:00
|
|
|
SyntheticFilter::SharedPointer filter_sp;
|
|
|
|
uint32_t reason_filter = 0;
|
|
|
|
bool regex_filter = false;
|
2011-08-19 00:38:26 +08:00
|
|
|
// first find both Filter and Synth, and then check which is most recent
|
|
|
|
|
2011-11-04 11:34:56 +08:00
|
|
|
if (!GetFilterNavigator()->Get(valobj, filter_sp, use_dynamic, &reason_filter))
|
|
|
|
regex_filter = GetRegexFilterNavigator()->Get (valobj, filter_sp, use_dynamic, &reason_filter);
|
|
|
|
|
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
|
|
|
bool regex_synth = false;
|
|
|
|
uint32_t reason_synth = 0;
|
|
|
|
bool pick_synth = false;
|
|
|
|
SyntheticScriptProvider::SharedPointer synth;
|
2011-08-19 00:38:26 +08:00
|
|
|
if (!GetSyntheticNavigator()->Get(valobj, synth, use_dynamic, &reason_synth))
|
2011-11-04 11:34:56 +08:00
|
|
|
regex_synth = GetRegexSyntheticNavigator()->Get (valobj, synth, use_dynamic, &reason_synth);
|
|
|
|
if (!filter_sp.get() && !synth.get())
|
2011-08-19 00:38:26 +08:00
|
|
|
return false;
|
2011-11-04 11:34:56 +08:00
|
|
|
else if (!filter_sp.get() && synth.get())
|
2011-08-19 00:38:26 +08:00
|
|
|
pick_synth = true;
|
|
|
|
|
2011-11-04 11:34:56 +08:00
|
|
|
else if (filter_sp.get() && !synth.get())
|
2011-08-19 00:38:26 +08:00
|
|
|
pick_synth = false;
|
|
|
|
|
2011-11-04 11:34:56 +08:00
|
|
|
else /*if (filter_sp.get() && synth.get())*/
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
2011-11-04 11:34:56 +08:00
|
|
|
if (filter_sp->m_my_revision > synth->m_my_revision)
|
2011-08-19 00:38:26 +08:00
|
|
|
pick_synth = false;
|
|
|
|
else
|
|
|
|
pick_synth = true;
|
|
|
|
}
|
|
|
|
if (pick_synth)
|
|
|
|
{
|
|
|
|
if (regex_synth && reason)
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
*reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
|
2011-11-04 11:34:56 +08:00
|
|
|
entry_sp = synth;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (regex_filter && reason)
|
Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself.
Added 3 new formats which can be used to display data:
eFormatAddressInfo
eFormatHexFloat
eFormatInstruction
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".
eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".
eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is
"instruction".
Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public
API.
llvm-svn: 143114
2011-10-28 01:55:14 +08:00
|
|
|
*reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
|
2011-11-04 11:34:56 +08:00
|
|
|
entry_sp = filter_sp;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
2011-11-04 11:34:56 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
if (filter_sp)
|
|
|
|
{
|
|
|
|
entry_sp = filter_sp;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
}
|
|
|
|
|
2011-08-23 06:03:47 +08:00
|
|
|
void
|
|
|
|
FormatCategory::Clear (FormatCategoryItems items)
|
|
|
|
{
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_summary_nav->Clear();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_regex_summary_nav->Clear();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_filter_nav->Clear();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_regex_filter_nav->Clear();
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_synth_nav->Clear();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
m_regex_synth_nav->Clear();
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-23 06:03:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
FormatCategory::Delete (ConstString name,
|
|
|
|
FormatCategoryItems items)
|
|
|
|
{
|
|
|
|
bool success = false;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_summary_nav->Delete(name) || success;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_regex_summary_nav->Delete(name) || success;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_filter_nav->Delete(name) || success;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_regex_filter_nav->Delete(name) || success;
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_synth_nav->Delete(name) || success;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
success = m_regex_synth_nav->Delete(name) || success;
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-23 06:03:47 +08:00
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
FormatCategory::GetCount (FormatCategoryItems items)
|
|
|
|
{
|
|
|
|
uint32_t count = 0;
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_summary_nav->GetCount();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_regex_summary_nav->GetCount();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_filter_nav->GetCount();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_regex_filter_nav->GetCount();
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_synth_nav->GetCount();
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
|
2011-08-23 06:03:47 +08:00
|
|
|
count += m_regex_synth_nav->GetCount();
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-23 06:03:47 +08:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
bool
|
|
|
|
FormatCategory::AnyMatches(ConstString type_name,
|
|
|
|
FormatCategoryItems items,
|
|
|
|
bool only_enabled,
|
|
|
|
const char** matching_category,
|
|
|
|
FormatCategoryItems* matching_type)
|
|
|
|
{
|
|
|
|
if (!IsEnabled() && only_enabled)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
lldb::SummaryFormatSP summary;
|
|
|
|
SyntheticFilter::SharedPointer filter;
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-19 00:38:26 +08:00
|
|
|
SyntheticScriptProvider::SharedPointer synth;
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-19 00:38:26 +08:00
|
|
|
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_summary_nav->Get(type_name, summary))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemSummary;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_regex_summary_nav->Get(type_name, summary))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemRegexSummary;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_filter_nav->Get(type_name, filter))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemFilter;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_regex_filter_nav->Get(type_name, filter))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemRegexFilter;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_synth_nav->Get(type_name, synth))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemSynth;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-08-23 07:45:15 +08:00
|
|
|
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
|
2011-08-19 00:38:26 +08:00
|
|
|
{
|
|
|
|
if (m_regex_synth_nav->Get(type_name, synth))
|
|
|
|
{
|
|
|
|
if (matching_category)
|
|
|
|
*matching_category = m_name.c_str();
|
|
|
|
if (matching_type)
|
2011-08-23 07:45:15 +08:00
|
|
|
*matching_type = eFormatCategoryItemRegexSynth;
|
2011-08-19 00:38:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-19 00:38:26 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-23 08:32:52 +08:00
|
|
|
bool
|
|
|
|
CategoryMap::AnyMatches (ConstString type_name,
|
|
|
|
FormatCategory::FormatCategoryItems items,
|
|
|
|
bool only_enabled,
|
|
|
|
const char** matching_category,
|
|
|
|
FormatCategory::FormatCategoryItems* matching_type)
|
|
|
|
{
|
|
|
|
Mutex::Locker(m_map_mutex);
|
|
|
|
|
|
|
|
MapIterator pos, end = m_map.end();
|
|
|
|
for (pos = m_map.begin(); pos != end; pos++)
|
|
|
|
{
|
|
|
|
if (pos->second->AnyMatches(type_name,
|
|
|
|
items,
|
|
|
|
only_enabled,
|
|
|
|
matching_category,
|
|
|
|
matching_type))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-09-07 06:59:55 +08:00
|
|
|
lldb::SummaryFormatSP
|
|
|
|
CategoryMap::GetSummaryFormat (ValueObject& valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic)
|
2011-08-23 08:32:52 +08:00
|
|
|
{
|
|
|
|
Mutex::Locker(m_map_mutex);
|
|
|
|
|
|
|
|
uint32_t reason_why;
|
|
|
|
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
|
|
|
|
|
|
|
for (begin = m_active_categories.begin(); begin != end; begin++)
|
|
|
|
{
|
|
|
|
lldb::FormatCategorySP category = *begin;
|
|
|
|
lldb::SummaryFormatSP current_format;
|
|
|
|
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
|
|
|
|
continue;
|
2011-09-07 06:59:55 +08:00
|
|
|
return current_format;
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
2011-09-07 06:59:55 +08:00
|
|
|
return lldb::SummaryFormatSP();
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
|
|
|
|
2011-09-07 06:59:55 +08:00
|
|
|
lldb::SyntheticChildrenSP
|
|
|
|
CategoryMap::GetSyntheticChildren (ValueObject& valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic)
|
2011-08-23 08:32:52 +08:00
|
|
|
{
|
|
|
|
Mutex::Locker(m_map_mutex);
|
|
|
|
|
|
|
|
uint32_t reason_why;
|
|
|
|
|
|
|
|
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
|
|
|
|
|
|
|
for (begin = m_active_categories.begin(); begin != end; begin++)
|
|
|
|
{
|
|
|
|
lldb::FormatCategorySP category = *begin;
|
|
|
|
lldb::SyntheticChildrenSP current_format;
|
|
|
|
if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
|
|
|
|
continue;
|
2011-09-07 06:59:55 +08:00
|
|
|
return current_format;
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
2011-09-07 06:59:55 +08:00
|
|
|
return lldb::SyntheticChildrenSP();
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
void
|
|
|
|
CategoryMap::LoopThrough(CallbackType callback, void* param)
|
|
|
|
{
|
|
|
|
if (callback)
|
|
|
|
{
|
|
|
|
Mutex::Locker(m_map_mutex);
|
|
|
|
|
|
|
|
// loop through enabled categories in respective order
|
|
|
|
{
|
|
|
|
ActiveCategoriesIterator begin, end = m_active_categories.end();
|
|
|
|
for (begin = m_active_categories.begin(); begin != end; begin++)
|
|
|
|
{
|
|
|
|
lldb::FormatCategorySP category = *begin;
|
2011-08-23 02:36:52 +08:00
|
|
|
ConstString type = ConstString(category->GetName().c_str());
|
|
|
|
if (!callback(param, category))
|
2011-08-19 00:38:26 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// loop through disabled categories in just any order
|
|
|
|
{
|
|
|
|
MapIterator pos, end = m_map.end();
|
|
|
|
for (pos = m_map.begin(); pos != end; pos++)
|
|
|
|
{
|
|
|
|
if (pos->second->IsEnabled())
|
|
|
|
continue;
|
|
|
|
KeyType type = pos->first;
|
2011-08-23 02:36:52 +08:00
|
|
|
if (!callback(param, pos->second))
|
2011-08-19 00:38:26 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-23 08:32:52 +08:00
|
|
|
lldb::FormatCategorySP
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
FormatManager::GetCategory (const ConstString& category_name,
|
2011-08-23 08:32:52 +08:00
|
|
|
bool can_create)
|
|
|
|
{
|
|
|
|
if (!category_name)
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
return GetCategory(m_default_category_name);
|
2011-08-23 08:32:52 +08:00
|
|
|
lldb::FormatCategorySP category;
|
|
|
|
if (m_categories_map.Get(category_name, category))
|
|
|
|
return category;
|
|
|
|
|
|
|
|
if (!can_create)
|
|
|
|
return lldb::FormatCategorySP();
|
|
|
|
|
|
|
|
m_categories_map.Add(category_name,lldb::FormatCategorySP(new FormatCategory(this, category_name.AsCString())));
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
return GetCategory(category_name);
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
|
|
|
|
2011-07-13 06:56:10 +08:00
|
|
|
lldb::Format
|
|
|
|
FormatManager::GetSingleItemFormat(lldb::Format vector_format)
|
|
|
|
{
|
|
|
|
switch(vector_format)
|
|
|
|
{
|
|
|
|
case eFormatVectorOfChar:
|
|
|
|
return eFormatCharArray;
|
|
|
|
|
|
|
|
case eFormatVectorOfSInt8:
|
|
|
|
case eFormatVectorOfSInt16:
|
|
|
|
case eFormatVectorOfSInt32:
|
|
|
|
case eFormatVectorOfSInt64:
|
|
|
|
return eFormatDecimal;
|
|
|
|
|
|
|
|
case eFormatVectorOfUInt8:
|
|
|
|
case eFormatVectorOfUInt16:
|
|
|
|
case eFormatVectorOfUInt32:
|
|
|
|
case eFormatVectorOfUInt64:
|
|
|
|
case eFormatVectorOfUInt128:
|
|
|
|
return eFormatHex;
|
|
|
|
|
|
|
|
case eFormatVectorOfFloat32:
|
|
|
|
case eFormatVectorOfFloat64:
|
|
|
|
return eFormatFloat;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return lldb::eFormatInvalid;
|
|
|
|
}
|
2011-08-10 10:10:13 +08:00
|
|
|
}
|
2011-08-18 06:13:59 +08:00
|
|
|
|
2011-08-19 09:14:49 +08:00
|
|
|
ConstString
|
|
|
|
FormatManager::GetValidTypeName (const ConstString& type)
|
|
|
|
{
|
|
|
|
return ::GetValidTypeName_Impl(type);
|
|
|
|
}
|
|
|
|
|
2011-08-18 06:13:59 +08:00
|
|
|
FormatManager::FormatManager() :
|
|
|
|
m_value_nav("format",this),
|
|
|
|
m_named_summaries_map(this),
|
|
|
|
m_last_revision(0),
|
|
|
|
m_categories_map(this),
|
2011-08-23 02:36:52 +08:00
|
|
|
m_default_category_name(ConstString("default")),
|
|
|
|
m_system_category_name(ConstString("system")),
|
|
|
|
m_gnu_cpp_category_name(ConstString("gnu-libstdc++"))
|
2011-08-18 06:13:59 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
// add some default stuff
|
|
|
|
// most formats, summaries, ... actually belong to the users' lldbinit file rather than here
|
2011-08-19 00:38:26 +08:00
|
|
|
lldb::SummaryFormatSP string_format(new StringSummaryFormat(false,
|
2011-08-18 06:13:59 +08:00
|
|
|
true,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
"${var%s}"));
|
|
|
|
|
|
|
|
|
2011-08-19 00:38:26 +08:00
|
|
|
lldb::SummaryFormatSP string_array_format(new StringSummaryFormat(false,
|
2011-08-18 06:13:59 +08:00
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
"${var%s}"));
|
|
|
|
|
|
|
|
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
|
|
|
|
|
|
|
|
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
FormatCategory::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
|
2011-08-18 06:13:59 +08:00
|
|
|
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
|
|
|
|
sys_category_sp->GetSummaryNavigator()->Add(ConstString("const char *"), string_format);
|
|
|
|
sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
|
|
|
|
|
|
|
|
GetCategory(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
|
2011-08-18 06:13:59 +08:00
|
|
|
|
|
|
|
// WARNING: temporary code!!
|
|
|
|
// The platform should be responsible for initializing its own formatters
|
|
|
|
// (e.g. to handle versioning, different runtime libraries, ...)
|
|
|
|
// Currently, basic formatters for std:: objects as implemented by
|
|
|
|
// the GNU libstdc++ are defined regardless, and enabled by default
|
|
|
|
// This is going to be moved to some platform-dependent location
|
|
|
|
// (in the meanwhile, these formatters should work for Mac OS X & Linux)
|
|
|
|
lldb::SummaryFormatSP std_string_summary_sp(new StringSummaryFormat(true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
"${var._M_dataplus._M_p}"));
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
|
|
|
|
FormatCategory::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
|
|
|
|
|
|
|
|
gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"),
|
|
|
|
std_string_summary_sp);
|
|
|
|
gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char>"),
|
|
|
|
std_string_summary_sp);
|
|
|
|
gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
|
|
|
|
std_string_summary_sp);
|
|
|
|
|
2011-11-04 11:34:56 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?vector<.+>$")),
|
2011-08-18 06:13:59 +08:00
|
|
|
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
|
|
|
false,
|
|
|
|
false,
|
2011-08-23 01:34:47 +08:00
|
|
|
"gnu_libstdcpp.StdVectorSynthProvider")));
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?map<.+> >$")),
|
2011-08-18 06:13:59 +08:00
|
|
|
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
|
|
|
false,
|
|
|
|
false,
|
2011-08-23 01:34:47 +08:00
|
|
|
"gnu_libstdcpp.StdMapSynthProvider")));
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::)?list<.+>$")),
|
2011-08-18 06:13:59 +08:00
|
|
|
SyntheticChildrenSP(new SyntheticScriptProvider(true,
|
|
|
|
false,
|
|
|
|
false,
|
2011-08-23 01:34:47 +08:00
|
|
|
"gnu_libstdcpp.StdListSynthProvider")));
|
2011-11-04 11:34:56 +08:00
|
|
|
#endif
|
2011-08-18 06:13:59 +08:00
|
|
|
// DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
|
|
|
|
EnableCategory(m_system_category_name);
|
|
|
|
EnableCategory(m_gnu_cpp_category_name);
|
|
|
|
EnableCategory(m_default_category_name);
|
|
|
|
|
2011-10-12 08:53:29 +08:00
|
|
|
}
|