The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
// C Includes
|
2011-11-04 03:34:56 +00:00
|
|
|
|
|
|
|
|
#ifdef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
|
|
|
|
struct PyObject;
|
|
|
|
|
|
|
|
|
|
#else // #ifdef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
2011-10-23 16:49:03 +00:00
|
|
|
#if defined (__APPLE__)
|
|
|
|
|
#include <Python/Python.h>
|
|
|
|
|
#else
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
#endif
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
|
2011-11-04 03:34:56 +00:00
|
|
|
#endif // #ifdef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
// C++ Includes
|
|
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
|
|
// Other libraries and framework includes
|
|
|
|
|
|
|
|
|
|
// Project includes
|
|
|
|
|
#include "lldb/lldb-public.h"
|
|
|
|
|
#include "lldb/lldb-enumerations.h"
|
|
|
|
|
|
|
|
|
|
#include "lldb/Core/Debugger.h"
|
|
|
|
|
#include "lldb/Core/FormatClasses.h"
|
|
|
|
|
#include "lldb/Core/StreamString.h"
|
2011-08-02 17:27:39 +00:00
|
|
|
#include "lldb/Core/ValueObjectConstResult.h"
|
2011-07-24 00:14:56 +00:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
#include "lldb/Symbol/ClangASTType.h"
|
|
|
|
|
#include "lldb/Target/StackFrame.h"
|
2011-07-24 00:14:56 +00:00
|
|
|
#include "lldb/Target/Target.h"
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
2011-08-23 00:32:52 +00:00
|
|
|
ValueFormat::ValueFormat (lldb::Format f,
|
|
|
|
|
bool casc,
|
|
|
|
|
bool skipptr,
|
|
|
|
|
bool skipref) :
|
|
|
|
|
m_cascades(casc),
|
|
|
|
|
m_skip_pointers(skipptr),
|
|
|
|
|
m_skip_references(skipref),
|
|
|
|
|
m_format (f)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
SummaryFormat::SummaryFormat(const SummaryFormat::Flags& flags) :
|
|
|
|
|
m_flags(flags)
|
2011-08-23 00:32:52 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
StringSummaryFormat::StringSummaryFormat(const SummaryFormat::Flags& flags,
|
2011-08-23 00:32:52 +00:00
|
|
|
std::string f) :
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
SummaryFormat(flags),
|
2011-08-23 00:32:52 +00:00
|
|
|
m_format(f)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
std::string
|
|
|
|
|
StringSummaryFormat::FormatObject(lldb::ValueObjectSP object)
|
|
|
|
|
{
|
|
|
|
|
if (!object.get())
|
|
|
|
|
return "NULL";
|
|
|
|
|
|
|
|
|
|
StreamString s;
|
|
|
|
|
ExecutionContext exe_ctx;
|
|
|
|
|
object->GetExecutionContextScope()->CalculateExecutionContext(exe_ctx);
|
|
|
|
|
SymbolContext sc;
|
2011-09-22 04:58:26 +00:00
|
|
|
StackFrame *frame = exe_ctx.GetFramePtr();
|
|
|
|
|
if (frame)
|
|
|
|
|
sc = frame->GetSymbolContext(lldb::eSymbolContextEverything);
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
if (IsOneliner())
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
{
|
2011-08-17 22:13:59 +00:00
|
|
|
ValueObjectSP synth_valobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
|
|
|
|
|
const uint32_t num_children = synth_valobj->GetNumChildren();
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
if (num_children)
|
|
|
|
|
{
|
|
|
|
|
s.PutChar('(');
|
|
|
|
|
|
|
|
|
|
for (uint32_t idx=0; idx<num_children; ++idx)
|
|
|
|
|
{
|
2011-08-17 22:13:59 +00:00
|
|
|
lldb::ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
if (child_sp.get())
|
|
|
|
|
{
|
|
|
|
|
if (idx)
|
|
|
|
|
s.PutCString(", ");
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
if (!HideNames())
|
|
|
|
|
{
|
|
|
|
|
s.PutCString(child_sp.get()->GetName().AsCString());
|
|
|
|
|
s.PutChar('=');
|
|
|
|
|
}
|
2011-08-04 02:34:29 +00:00
|
|
|
child_sp.get()->GetPrintableRepresentation(s);
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s.PutChar(')');
|
|
|
|
|
|
|
|
|
|
return s.GetString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (Debugger::FormatPrompt(m_format.c_str(), &sc, &exe_ctx, &sc.line_entry.range.GetBaseAddress(), s, NULL, object.get()))
|
|
|
|
|
return s.GetString();
|
|
|
|
|
else
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
StringSummaryFormat::GetDescription()
|
|
|
|
|
{
|
|
|
|
|
StreamString sstr;
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
|
|
|
|
|
sstr.Printf ("`%s`%s%s%s%s%s%s%s", m_format.c_str(),
|
|
|
|
|
Cascades() ? "" : " (not cascading)",
|
|
|
|
|
!DoesPrintChildren() ? "" : " (show children)",
|
|
|
|
|
!DoesPrintValue() ? " (hide value)" : "",
|
|
|
|
|
IsOneliner() ? " (one-line printout)" : "",
|
|
|
|
|
SkipsPointers() ? " (skip pointers)" : "",
|
|
|
|
|
SkipsReferences() ? " (skip references)" : "",
|
|
|
|
|
HideNames() ? " (hide member names)" : "");
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
return sstr.GetString();
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-04 03:34:56 +00:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
ScriptSummaryFormat::ScriptSummaryFormat(const SummaryFormat::Flags& flags,
|
2011-08-23 00:32:52 +00:00
|
|
|
std::string fname,
|
|
|
|
|
std::string pscri) :
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
SummaryFormat(flags),
|
2011-08-23 00:32:52 +00:00
|
|
|
m_function_name(fname),
|
|
|
|
|
m_python_script(pscri)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
std::string
|
|
|
|
|
ScriptSummaryFormat::FormatObject(lldb::ValueObjectSP object)
|
|
|
|
|
{
|
|
|
|
|
return std::string(ScriptInterpreterPython::CallPythonScriptFunction(m_function_name.c_str(),
|
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-06 19:20:51 +00:00
|
|
|
object).c_str());
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
ScriptSummaryFormat::GetDescription()
|
|
|
|
|
{
|
|
|
|
|
StreamString sstr;
|
Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.
llvm-svn: 149644
2012-02-02 23:34:52 +00:00
|
|
|
sstr.Printf ("%s%s%s%s%s%s%s\n%s", Cascades() ? "" : " (not cascading)",
|
|
|
|
|
!DoesPrintChildren() ? "" : " (show children)",
|
|
|
|
|
!DoesPrintValue() ? " (hide value)" : "",
|
|
|
|
|
IsOneliner() ? " (one-line printout)" : "",
|
|
|
|
|
SkipsPointers() ? " (skip pointers)" : "",
|
|
|
|
|
SkipsReferences() ? " (skip references)" : "",
|
|
|
|
|
HideNames() ? " (hide member names)" : "",
|
The implementation of categories is now synchronization safe
Code cleanup:
- The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
are contained. The wrapper code always remains in Debugger.{h|cpp}
- Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
- for type category enable, saying "enable A B C" is the same as saying
enable C
enable B
enable A
(the ordering is relevant in enabling categories, and it is expected that a user typing
enable A B C wants to look into category A, then into B, then into C and not the other
way round)
- for the other two commands, the order is not really relevant (however, the same inverted ordering
is used for consistency)
llvm-svn: 135494
2011-07-19 18:03:25 +00:00
|
|
|
m_python_script.c_str());
|
|
|
|
|
return sstr.GetString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-04 03:34:56 +00:00
|
|
|
#endif // #ifndef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
2011-07-22 00:16:08 +00:00
|
|
|
std::string
|
|
|
|
|
SyntheticFilter::GetDescription()
|
|
|
|
|
{
|
|
|
|
|
StreamString sstr;
|
|
|
|
|
sstr.Printf("%s%s%s {\n",
|
|
|
|
|
m_cascades ? "" : " (not cascading)",
|
|
|
|
|
m_skip_pointers ? " (skip pointers)" : "",
|
|
|
|
|
m_skip_references ? " (skip references)" : "");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < GetCount(); i++)
|
|
|
|
|
{
|
|
|
|
|
sstr.Printf(" %s\n",
|
|
|
|
|
GetExpressionPathAtIndex(i).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sstr.Printf("}");
|
|
|
|
|
return sstr.GetString();
|
|
|
|
|
}
|
2011-07-24 00:14:56 +00:00
|
|
|
|
2011-08-19 21:13:46 +00:00
|
|
|
std::string
|
|
|
|
|
SyntheticArrayView::GetDescription()
|
|
|
|
|
{
|
|
|
|
|
StreamString sstr;
|
|
|
|
|
sstr.Printf("%s%s%s {\n",
|
|
|
|
|
m_cascades ? "" : " (not cascading)",
|
|
|
|
|
m_skip_pointers ? " (skip pointers)" : "",
|
|
|
|
|
m_skip_references ? " (skip references)" : "");
|
|
|
|
|
SyntheticArrayRange* ptr = &m_head;
|
|
|
|
|
while (ptr && ptr != m_tail)
|
|
|
|
|
{
|
|
|
|
|
if (ptr->GetLow() == ptr->GetHigh())
|
|
|
|
|
sstr.Printf(" [%d]\n",
|
|
|
|
|
ptr->GetLow());
|
|
|
|
|
else
|
|
|
|
|
sstr.Printf(" [%d-%d]\n",
|
|
|
|
|
ptr->GetLow(),
|
|
|
|
|
ptr->GetHigh());
|
|
|
|
|
ptr = ptr->GetNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sstr.Printf("}");
|
|
|
|
|
return sstr.GetString();
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-04 03:34:56 +00:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
2011-07-24 00:14:56 +00:00
|
|
|
SyntheticScriptProvider::FrontEnd::FrontEnd(std::string pclass,
|
|
|
|
|
lldb::ValueObjectSP be) :
|
2011-08-22 02:49:39 +00:00
|
|
|
SyntheticChildrenFrontEnd(be),
|
|
|
|
|
m_python_class(pclass)
|
2011-07-24 00:14:56 +00:00
|
|
|
{
|
2011-07-25 16:59:05 +00:00
|
|
|
if (be.get() == NULL)
|
|
|
|
|
{
|
|
|
|
|
m_interpreter = NULL;
|
|
|
|
|
m_wrapper = NULL;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-02 17:27:39 +00:00
|
|
|
m_interpreter = m_backend->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
|
2011-07-25 16:59:05 +00:00
|
|
|
|
|
|
|
|
if (m_interpreter == NULL)
|
|
|
|
|
m_wrapper = NULL;
|
|
|
|
|
else
|
2011-10-23 16:49:03 +00:00
|
|
|
m_wrapper = m_interpreter->CreateSyntheticScriptedProvider(m_python_class, m_backend);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SyntheticScriptProvider::FrontEnd::~FrontEnd()
|
|
|
|
|
{
|
2011-11-04 03:34:56 +00:00
|
|
|
Py_XDECREF((PyObject*)m_wrapper);
|
2011-07-24 00:14:56 +00:00
|
|
|
}
|
|
|
|
|
|
2011-08-23 00:32:52 +00:00
|
|
|
lldb::ValueObjectSP
|
|
|
|
|
SyntheticScriptProvider::FrontEnd::GetChildAtIndex (uint32_t idx, bool can_create)
|
|
|
|
|
{
|
|
|
|
|
if (m_wrapper == NULL || m_interpreter == NULL)
|
|
|
|
|
return lldb::ValueObjectSP();
|
|
|
|
|
|
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-06 19:20:51 +00:00
|
|
|
return m_interpreter->GetChildAtIndex(m_wrapper, idx);
|
2011-08-23 00:32:52 +00:00
|
|
|
}
|
|
|
|
|
|
2011-07-24 00:14:56 +00:00
|
|
|
std::string
|
|
|
|
|
SyntheticScriptProvider::GetDescription()
|
|
|
|
|
{
|
|
|
|
|
StreamString sstr;
|
2011-07-25 16:59:05 +00:00
|
|
|
sstr.Printf("%s%s%s Python class %s",
|
2011-07-24 00:14:56 +00:00
|
|
|
m_cascades ? "" : " (not cascading)",
|
|
|
|
|
m_skip_pointers ? " (skip pointers)" : "",
|
|
|
|
|
m_skip_references ? " (skip references)" : "",
|
|
|
|
|
m_python_class.c_str());
|
|
|
|
|
|
|
|
|
|
return sstr.GetString();
|
2011-08-10 02:10:13 +00:00
|
|
|
}
|
2011-08-23 00:32:52 +00:00
|
|
|
|
2011-11-04 03:34:56 +00:00
|
|
|
#endif // #ifndef LLDB_DISABLE_PYTHON
|
|
|
|
|
|
2011-10-31 22:50:37 +00:00
|
|
|
int
|
2011-08-23 00:32:52 +00:00
|
|
|
SyntheticArrayView::GetRealIndexForIndex(int i)
|
|
|
|
|
{
|
|
|
|
|
if (i >= GetCount())
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
SyntheticArrayRange* ptr = &m_head;
|
|
|
|
|
|
|
|
|
|
int residual = i;
|
|
|
|
|
|
|
|
|
|
while(ptr && ptr != m_tail)
|
|
|
|
|
{
|
|
|
|
|
if (residual >= ptr->GetSelfCount())
|
|
|
|
|
{
|
|
|
|
|
residual -= ptr->GetSelfCount();
|
|
|
|
|
ptr = ptr->GetNext();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ptr->GetLow() + residual;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
|
SyntheticArrayView::FrontEnd::GetIndexOfChildWithName (const ConstString &name_cs)
|
|
|
|
|
{
|
|
|
|
|
const char* name_cstr = name_cs.GetCString();
|
|
|
|
|
if (*name_cstr != '[')
|
|
|
|
|
return UINT32_MAX;
|
|
|
|
|
std::string name(name_cstr+1);
|
|
|
|
|
if (name[name.size()-1] != ']')
|
|
|
|
|
return UINT32_MAX;
|
|
|
|
|
name = name.erase(name.size()-1,1);
|
|
|
|
|
int index = Args::StringToSInt32 (name.c_str(), -1);
|
|
|
|
|
if (index < 0)
|
|
|
|
|
return UINT32_MAX;
|
|
|
|
|
return index;
|
2011-10-12 00:53:29 +00:00
|
|
|
}
|