You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
cmake
docs
examples
include
lit
lldb.xcodeproj
lldb.xcworkspace
packages
resources
scripts
source
API
Breakpoint
Commands
Core
DataFormatters
Expression
Host
Initialization
Interpreter
Plugins
ABI
Architecture
Disassembler
DynamicLoader
ExpressionParser
Instruction
InstrumentationRuntime
JITLoader
Language
CPlusPlus
BlockPointer.cpp
BlockPointer.h
CMakeLists.txt
CPlusPlusLanguage.cpp
CPlusPlusLanguage.h
CPlusPlusNameParser.cpp
CPlusPlusNameParser.h
CxxStringTypes.cpp
CxxStringTypes.h
LibCxx.cpp
LibCxx.h
LibCxxAtomic.cpp
LibCxxAtomic.h
LibCxxBitset.cpp
LibCxxInitializerList.cpp
LibCxxList.cpp
LibCxxMap.cpp
LibCxxQueue.cpp
LibCxxTuple.cpp
LibCxxUnorderedMap.cpp
LibCxxVector.cpp
LibStdcpp.cpp
LibStdcpp.h
LibStdcppTuple.cpp
LibStdcppUniquePointer.cpp
Go
Java
OCaml
ObjC
ObjCPlusPlus
CMakeLists.txt
LanguageRuntime
MemoryHistory
ObjectContainer
ObjectFile
OperatingSystem
Platform
Process
ScriptInterpreter
StructuredData
SymbolFile
SymbolVendor
SystemRuntime
UnwindAssembly
CMakeLists.txt
Symbol
Target
Utility
CMakeLists.txt
lldb.cpp
third_party
tools
unittests
utils
www
.arcconfig
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.txt
INSTALL.txt
LICENSE.TXT
use_lldb_suite_root.py
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
108 lines
3.3 KiB
C++
108 lines
3.3 KiB
C++
//===-- LibCxxBitset.cpp ----------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "LibCxx.h"
|
|
#include "lldb/DataFormatters/FormattersHelpers.h"
|
|
#include "lldb/Symbol/ClangASTContext.h"
|
|
#include "lldb/Target/Target.h"
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
namespace {
|
|
|
|
class BitsetFrontEnd : public SyntheticChildrenFrontEnd {
|
|
public:
|
|
BitsetFrontEnd(ValueObject &valobj);
|
|
|
|
size_t GetIndexOfChildWithName(const ConstString &name) override {
|
|
return formatters::ExtractIndexFromString(name.GetCString());
|
|
}
|
|
|
|
bool MightHaveChildren() override { return true; }
|
|
bool Update() override;
|
|
size_t CalculateNumChildren() override { return m_elements.size(); }
|
|
ValueObjectSP GetChildAtIndex(size_t idx) override;
|
|
|
|
private:
|
|
std::vector<ValueObjectSP> m_elements;
|
|
ValueObjectSP m_first;
|
|
CompilerType m_bool_type;
|
|
ByteOrder m_byte_order = eByteOrderInvalid;
|
|
uint8_t m_byte_size = 0;
|
|
};
|
|
} // namespace
|
|
|
|
BitsetFrontEnd::BitsetFrontEnd(ValueObject &valobj)
|
|
: SyntheticChildrenFrontEnd(valobj) {
|
|
m_bool_type = valobj.GetCompilerType().GetBasicTypeFromAST(eBasicTypeBool);
|
|
if (auto target_sp = m_backend.GetTargetSP()) {
|
|
m_byte_order = target_sp->GetArchitecture().GetByteOrder();
|
|
m_byte_size = target_sp->GetArchitecture().GetAddressByteSize();
|
|
Update();
|
|
}
|
|
}
|
|
|
|
bool BitsetFrontEnd::Update() {
|
|
m_elements.clear();
|
|
m_first.reset();
|
|
|
|
TargetSP target_sp = m_backend.GetTargetSP();
|
|
if (!target_sp)
|
|
return false;
|
|
size_t capping_size = target_sp->GetMaximumNumberOfChildrenToDisplay();
|
|
|
|
size_t size = 0;
|
|
if (auto arg = m_backend.GetCompilerType().GetIntegralTemplateArgument(0))
|
|
size = arg->value.getLimitedValue(capping_size);
|
|
|
|
m_elements.assign(size, ValueObjectSP());
|
|
|
|
m_first = m_backend.GetChildMemberWithName(ConstString("__first_"), true);
|
|
return false;
|
|
}
|
|
|
|
ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) {
|
|
if (idx >= m_elements.size() || !m_first)
|
|
return ValueObjectSP();
|
|
|
|
if (m_elements[idx])
|
|
return m_elements[idx];
|
|
|
|
ExecutionContext ctx = m_backend.GetExecutionContextRef().Lock(false);
|
|
CompilerType type;
|
|
ValueObjectSP chunk;
|
|
// For small bitsets __first_ is not an array, but a plain size_t.
|
|
if (m_first->GetCompilerType().IsArrayType(&type, nullptr, nullptr))
|
|
chunk = m_first->GetChildAtIndex(
|
|
idx / type.GetBitSize(ctx.GetBestExecutionContextScope()), true);
|
|
else {
|
|
type = m_first->GetCompilerType();
|
|
chunk = m_first;
|
|
}
|
|
if (!type || !chunk)
|
|
return ValueObjectSP();
|
|
|
|
size_t chunk_idx = idx % type.GetBitSize(ctx.GetBestExecutionContextScope());
|
|
uint8_t value = !!(chunk->GetValueAsUnsigned(0) & (uint64_t(1) << chunk_idx));
|
|
DataExtractor data(&value, sizeof(value), m_byte_order, m_byte_size);
|
|
|
|
m_elements[idx] = CreateValueObjectFromData(llvm::formatv("[{0}]", idx).str(),
|
|
data, ctx, m_bool_type);
|
|
|
|
return m_elements[idx];
|
|
}
|
|
|
|
SyntheticChildrenFrontEnd *formatters::LibcxxBitsetSyntheticFrontEndCreator(
|
|
CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
|
|
if (valobj_sp)
|
|
return new BitsetFrontEnd(*valobj_sp);
|
|
return nullptr;
|
|
}
|