1 //===- llvm/unittest/DebugInfo/PDB/PDBApiTest.cpp -------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include <unordered_map> 11 12 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" 13 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h" 14 #include "llvm/DebugInfo/PDB/IPDBSession.h" 15 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" 16 17 #include "llvm/DebugInfo/PDB/PDBSymbol.h" 18 #include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h" 19 #include "llvm/DebugInfo/PDB/PDBSymbolBlock.h" 20 #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h" 21 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h" 22 #include "llvm/DebugInfo/PDB/PDBSymbolCompilandEnv.h" 23 #include "llvm/DebugInfo/PDB/PDBSymbolCustom.h" 24 #include "llvm/DebugInfo/PDB/PDBSymbolData.h" 25 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" 26 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h" 27 #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h" 28 #include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h" 29 #include "llvm/DebugInfo/PDB/PDBSymbolLabel.h" 30 #include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h" 31 #include "llvm/DebugInfo/PDB/PDBSymbolThunk.h" 32 #include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h" 33 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h" 34 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h" 35 #include "llvm/DebugInfo/PDB/PDBSymbolTypeCustom.h" 36 #include "llvm/DebugInfo/PDB/PDBSymbolTypeDimension.h" 37 #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h" 38 #include "llvm/DebugInfo/PDB/PDBSymbolTypeFriend.h" 39 #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h" 40 #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h" 41 #include "llvm/DebugInfo/PDB/PDBSymbolTypeManaged.h" 42 #include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h" 43 #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h" 44 #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" 45 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h" 46 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h" 47 #include "llvm/DebugInfo/PDB/PDBSymbolUnknown.h" 48 #include "llvm/DebugInfo/PDB/PDBSymbolUsingNamespace.h" 49 #include "llvm/DebugInfo/PDB/PDBTypes.h" 50 #include "gtest/gtest.h" 51 using namespace llvm; 52 53 namespace { 54 55 #define MOCK_SYMBOL_ACCESSOR(Func) \ 56 decltype(std::declval<IPDBRawSymbol>().Func()) Func() const override { \ 57 typedef decltype(IPDBRawSymbol::Func()) ReturnType; \ 58 return ReturnType(); \ 59 } 60 61 class MockSession : public IPDBSession { 62 uint64_t getLoadAddress() const override { return 0; } 63 void setLoadAddress(uint64_t Address) override {} 64 std::unique_ptr<PDBSymbolExe> getGlobalScope() const override { 65 return nullptr; 66 } 67 std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override { 68 return nullptr; 69 } 70 std::unique_ptr<IPDBSourceFile> 71 getSourceFileById(uint32_t SymbolId) const override { 72 return nullptr; 73 } 74 std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override { 75 return nullptr; 76 } 77 std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland( 78 const PDBSymbolCompiland &Compiland) const override { 79 return nullptr; 80 } 81 }; 82 83 class MockRawSymbol : public IPDBRawSymbol { 84 public: 85 MockRawSymbol(const IPDBSession &PDBSession, PDB_SymType SymType) 86 : Session(PDBSession), Type(SymType) {} 87 88 void dump(raw_ostream &OS, int Indent, PDB_DumpLevel Level) const override {} 89 90 std::unique_ptr<IPDBEnumSymbols> 91 findChildren(PDB_SymType Type) const override { 92 return nullptr; 93 } 94 std::unique_ptr<IPDBEnumSymbols> 95 findChildren(PDB_SymType Type, StringRef Name, 96 PDB_NameSearchFlags Flags) const override { 97 return nullptr; 98 } 99 std::unique_ptr<IPDBEnumSymbols> 100 findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, 101 uint32_t RVA) const override { 102 return nullptr; 103 } 104 std::unique_ptr<IPDBEnumSymbols> 105 findInlineFramesByRVA(uint32_t RVA) const override { 106 return nullptr; 107 } 108 109 void getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const override {} 110 void getFrontEndVersion(VersionInfo &Version) const override {} 111 void getBackEndVersion(VersionInfo &Version) const override {} 112 113 PDB_SymType getSymTag() const override { return Type; } 114 115 MOCK_SYMBOL_ACCESSOR(getAccess) 116 MOCK_SYMBOL_ACCESSOR(getAddressOffset) 117 MOCK_SYMBOL_ACCESSOR(getAddressSection) 118 MOCK_SYMBOL_ACCESSOR(getAge) 119 MOCK_SYMBOL_ACCESSOR(getArrayIndexTypeId) 120 MOCK_SYMBOL_ACCESSOR(getBaseDataOffset) 121 MOCK_SYMBOL_ACCESSOR(getBaseDataSlot) 122 MOCK_SYMBOL_ACCESSOR(getBaseSymbolId) 123 MOCK_SYMBOL_ACCESSOR(getBuiltinType) 124 MOCK_SYMBOL_ACCESSOR(getBitPosition) 125 MOCK_SYMBOL_ACCESSOR(getCallingConvention) 126 MOCK_SYMBOL_ACCESSOR(getClassParentId) 127 MOCK_SYMBOL_ACCESSOR(getCompilerName) 128 MOCK_SYMBOL_ACCESSOR(getCount) 129 MOCK_SYMBOL_ACCESSOR(getCountLiveRanges) 130 MOCK_SYMBOL_ACCESSOR(getLanguage) 131 MOCK_SYMBOL_ACCESSOR(getLexicalParentId) 132 MOCK_SYMBOL_ACCESSOR(getLibraryName) 133 MOCK_SYMBOL_ACCESSOR(getLiveRangeStartAddressOffset) 134 MOCK_SYMBOL_ACCESSOR(getLiveRangeStartAddressSection) 135 MOCK_SYMBOL_ACCESSOR(getLiveRangeStartRelativeVirtualAddress) 136 MOCK_SYMBOL_ACCESSOR(getLocalBasePointerRegisterId) 137 MOCK_SYMBOL_ACCESSOR(getLowerBoundId) 138 MOCK_SYMBOL_ACCESSOR(getMemorySpaceKind) 139 MOCK_SYMBOL_ACCESSOR(getName) 140 MOCK_SYMBOL_ACCESSOR(getNumberOfAcceleratorPointerTags) 141 MOCK_SYMBOL_ACCESSOR(getNumberOfColumns) 142 MOCK_SYMBOL_ACCESSOR(getNumberOfModifiers) 143 MOCK_SYMBOL_ACCESSOR(getNumberOfRegisterIndices) 144 MOCK_SYMBOL_ACCESSOR(getNumberOfRows) 145 MOCK_SYMBOL_ACCESSOR(getObjectFileName) 146 MOCK_SYMBOL_ACCESSOR(getOemId) 147 MOCK_SYMBOL_ACCESSOR(getOemSymbolId) 148 MOCK_SYMBOL_ACCESSOR(getOffsetInUdt) 149 MOCK_SYMBOL_ACCESSOR(getPlatform) 150 MOCK_SYMBOL_ACCESSOR(getRank) 151 MOCK_SYMBOL_ACCESSOR(getRegisterId) 152 MOCK_SYMBOL_ACCESSOR(getRegisterType) 153 MOCK_SYMBOL_ACCESSOR(getRelativeVirtualAddress) 154 MOCK_SYMBOL_ACCESSOR(getSamplerSlot) 155 MOCK_SYMBOL_ACCESSOR(getSignature) 156 MOCK_SYMBOL_ACCESSOR(getSizeInUdt) 157 MOCK_SYMBOL_ACCESSOR(getSlot) 158 MOCK_SYMBOL_ACCESSOR(getSourceFileName) 159 MOCK_SYMBOL_ACCESSOR(getStride) 160 MOCK_SYMBOL_ACCESSOR(getSubTypeId) 161 MOCK_SYMBOL_ACCESSOR(getSymbolsFileName) 162 MOCK_SYMBOL_ACCESSOR(getSymIndexId) 163 MOCK_SYMBOL_ACCESSOR(getTargetOffset) 164 MOCK_SYMBOL_ACCESSOR(getTargetRelativeVirtualAddress) 165 MOCK_SYMBOL_ACCESSOR(getTargetVirtualAddress) 166 MOCK_SYMBOL_ACCESSOR(getTargetSection) 167 MOCK_SYMBOL_ACCESSOR(getTextureSlot) 168 MOCK_SYMBOL_ACCESSOR(getTimeStamp) 169 MOCK_SYMBOL_ACCESSOR(getToken) 170 MOCK_SYMBOL_ACCESSOR(getTypeId) 171 MOCK_SYMBOL_ACCESSOR(getUavSlot) 172 MOCK_SYMBOL_ACCESSOR(getUndecoratedName) 173 MOCK_SYMBOL_ACCESSOR(getUnmodifiedTypeId) 174 MOCK_SYMBOL_ACCESSOR(getUpperBoundId) 175 MOCK_SYMBOL_ACCESSOR(getVirtualBaseDispIndex) 176 MOCK_SYMBOL_ACCESSOR(getVirtualBaseOffset) 177 MOCK_SYMBOL_ACCESSOR(getVirtualTableShapeId) 178 MOCK_SYMBOL_ACCESSOR(getDataKind) 179 MOCK_SYMBOL_ACCESSOR(getGuid) 180 MOCK_SYMBOL_ACCESSOR(getOffset) 181 MOCK_SYMBOL_ACCESSOR(getThisAdjust) 182 MOCK_SYMBOL_ACCESSOR(getVirtualBasePointerOffset) 183 MOCK_SYMBOL_ACCESSOR(getLocationType) 184 MOCK_SYMBOL_ACCESSOR(getMachineType) 185 MOCK_SYMBOL_ACCESSOR(getThunkOrdinal) 186 MOCK_SYMBOL_ACCESSOR(getLength) 187 MOCK_SYMBOL_ACCESSOR(getLiveRangeLength) 188 MOCK_SYMBOL_ACCESSOR(getVirtualAddress) 189 MOCK_SYMBOL_ACCESSOR(getUdtKind) 190 MOCK_SYMBOL_ACCESSOR(hasConstructor) 191 MOCK_SYMBOL_ACCESSOR(hasCustomCallingConvention) 192 MOCK_SYMBOL_ACCESSOR(hasFarReturn) 193 MOCK_SYMBOL_ACCESSOR(isCode) 194 MOCK_SYMBOL_ACCESSOR(isCompilerGenerated) 195 MOCK_SYMBOL_ACCESSOR(isConstType) 196 MOCK_SYMBOL_ACCESSOR(isEditAndContinueEnabled) 197 MOCK_SYMBOL_ACCESSOR(isFunction) 198 MOCK_SYMBOL_ACCESSOR(getAddressTaken) 199 MOCK_SYMBOL_ACCESSOR(getNoStackOrdering) 200 MOCK_SYMBOL_ACCESSOR(hasAlloca) 201 MOCK_SYMBOL_ACCESSOR(hasAssignmentOperator) 202 MOCK_SYMBOL_ACCESSOR(hasCTypes) 203 MOCK_SYMBOL_ACCESSOR(hasCastOperator) 204 MOCK_SYMBOL_ACCESSOR(hasDebugInfo) 205 MOCK_SYMBOL_ACCESSOR(hasEH) 206 MOCK_SYMBOL_ACCESSOR(hasEHa) 207 MOCK_SYMBOL_ACCESSOR(hasFramePointer) 208 MOCK_SYMBOL_ACCESSOR(hasInlAsm) 209 MOCK_SYMBOL_ACCESSOR(hasInlineAttribute) 210 MOCK_SYMBOL_ACCESSOR(hasInterruptReturn) 211 MOCK_SYMBOL_ACCESSOR(hasLongJump) 212 MOCK_SYMBOL_ACCESSOR(hasManagedCode) 213 MOCK_SYMBOL_ACCESSOR(hasNestedTypes) 214 MOCK_SYMBOL_ACCESSOR(hasNoInlineAttribute) 215 MOCK_SYMBOL_ACCESSOR(hasNoReturnAttribute) 216 MOCK_SYMBOL_ACCESSOR(hasOptimizedCodeDebugInfo) 217 MOCK_SYMBOL_ACCESSOR(hasOverloadedOperator) 218 MOCK_SYMBOL_ACCESSOR(hasSEH) 219 MOCK_SYMBOL_ACCESSOR(hasSecurityChecks) 220 MOCK_SYMBOL_ACCESSOR(hasSetJump) 221 MOCK_SYMBOL_ACCESSOR(hasStrictGSCheck) 222 MOCK_SYMBOL_ACCESSOR(isAcceleratorGroupSharedLocal) 223 MOCK_SYMBOL_ACCESSOR(isAcceleratorPointerTagLiveRange) 224 MOCK_SYMBOL_ACCESSOR(isAcceleratorStubFunction) 225 MOCK_SYMBOL_ACCESSOR(isAggregated) 226 MOCK_SYMBOL_ACCESSOR(isIntroVirtualFunction) 227 MOCK_SYMBOL_ACCESSOR(isCVTCIL) 228 MOCK_SYMBOL_ACCESSOR(isConstructorVirtualBase) 229 MOCK_SYMBOL_ACCESSOR(isCxxReturnUdt) 230 MOCK_SYMBOL_ACCESSOR(isDataAligned) 231 MOCK_SYMBOL_ACCESSOR(isHLSLData) 232 MOCK_SYMBOL_ACCESSOR(isHotpatchable) 233 MOCK_SYMBOL_ACCESSOR(isIndirectVirtualBaseClass) 234 MOCK_SYMBOL_ACCESSOR(isInterfaceUdt) 235 MOCK_SYMBOL_ACCESSOR(isIntrinsic) 236 MOCK_SYMBOL_ACCESSOR(isLTCG) 237 MOCK_SYMBOL_ACCESSOR(isLocationControlFlowDependent) 238 MOCK_SYMBOL_ACCESSOR(isMSILNetmodule) 239 MOCK_SYMBOL_ACCESSOR(isMatrixRowMajor) 240 MOCK_SYMBOL_ACCESSOR(isManagedCode) 241 MOCK_SYMBOL_ACCESSOR(isMSILCode) 242 MOCK_SYMBOL_ACCESSOR(isMultipleInheritance) 243 MOCK_SYMBOL_ACCESSOR(isNaked) 244 MOCK_SYMBOL_ACCESSOR(isNested) 245 MOCK_SYMBOL_ACCESSOR(isOptimizedAway) 246 MOCK_SYMBOL_ACCESSOR(isPacked) 247 MOCK_SYMBOL_ACCESSOR(isPointerBasedOnSymbolValue) 248 MOCK_SYMBOL_ACCESSOR(isPointerToDataMember) 249 MOCK_SYMBOL_ACCESSOR(isPointerToMemberFunction) 250 MOCK_SYMBOL_ACCESSOR(isPureVirtual) 251 MOCK_SYMBOL_ACCESSOR(isRValueReference) 252 MOCK_SYMBOL_ACCESSOR(isRefUdt) 253 MOCK_SYMBOL_ACCESSOR(isReference) 254 MOCK_SYMBOL_ACCESSOR(isRestrictedType) 255 MOCK_SYMBOL_ACCESSOR(isReturnValue) 256 MOCK_SYMBOL_ACCESSOR(isSafeBuffers) 257 MOCK_SYMBOL_ACCESSOR(isScoped) 258 MOCK_SYMBOL_ACCESSOR(isSdl) 259 MOCK_SYMBOL_ACCESSOR(isSingleInheritance) 260 MOCK_SYMBOL_ACCESSOR(isSplitted) 261 MOCK_SYMBOL_ACCESSOR(isStatic) 262 MOCK_SYMBOL_ACCESSOR(hasPrivateSymbols) 263 MOCK_SYMBOL_ACCESSOR(isUnalignedType) 264 MOCK_SYMBOL_ACCESSOR(isUnreached) 265 MOCK_SYMBOL_ACCESSOR(isValueUdt) 266 MOCK_SYMBOL_ACCESSOR(isVirtual) 267 MOCK_SYMBOL_ACCESSOR(isVirtualBaseClass) 268 MOCK_SYMBOL_ACCESSOR(isVirtualInheritance) 269 MOCK_SYMBOL_ACCESSOR(isVolatileType) 270 271 private: 272 const IPDBSession &Session; 273 PDB_SymType Type; 274 }; 275 276 class PDBApiTest : public testing::Test { 277 public: 278 std::unordered_map<PDB_SymType, std::unique_ptr<PDBSymbol>> SymbolMap; 279 280 void SetUp() override { 281 Session.reset(new MockSession()); 282 283 InsertItemWithTag(PDB_SymType::None); 284 InsertItemWithTag(PDB_SymType::Exe); 285 InsertItemWithTag(PDB_SymType::Compiland); 286 InsertItemWithTag(PDB_SymType::CompilandDetails); 287 InsertItemWithTag(PDB_SymType::CompilandEnv); 288 InsertItemWithTag(PDB_SymType::Function); 289 InsertItemWithTag(PDB_SymType::Block); 290 InsertItemWithTag(PDB_SymType::Data); 291 InsertItemWithTag(PDB_SymType::Annotation); 292 InsertItemWithTag(PDB_SymType::Label); 293 InsertItemWithTag(PDB_SymType::PublicSymbol); 294 InsertItemWithTag(PDB_SymType::UDT); 295 InsertItemWithTag(PDB_SymType::Enum); 296 InsertItemWithTag(PDB_SymType::FunctionSig); 297 InsertItemWithTag(PDB_SymType::PointerType); 298 InsertItemWithTag(PDB_SymType::ArrayType); 299 InsertItemWithTag(PDB_SymType::BuiltinType); 300 InsertItemWithTag(PDB_SymType::Typedef); 301 InsertItemWithTag(PDB_SymType::BaseClass); 302 InsertItemWithTag(PDB_SymType::Friend); 303 InsertItemWithTag(PDB_SymType::FunctionArg); 304 InsertItemWithTag(PDB_SymType::FuncDebugStart); 305 InsertItemWithTag(PDB_SymType::FuncDebugEnd); 306 InsertItemWithTag(PDB_SymType::UsingNamespace); 307 InsertItemWithTag(PDB_SymType::VTableShape); 308 InsertItemWithTag(PDB_SymType::VTable); 309 InsertItemWithTag(PDB_SymType::Custom); 310 InsertItemWithTag(PDB_SymType::Thunk); 311 InsertItemWithTag(PDB_SymType::CustomType); 312 InsertItemWithTag(PDB_SymType::ManagedType); 313 InsertItemWithTag(PDB_SymType::Dimension); 314 InsertItemWithTag(PDB_SymType::Max); 315 } 316 317 template <class ExpectedType> void VerifyDyncast(PDB_SymType Tag) { 318 for (auto item = SymbolMap.begin(); item != SymbolMap.end(); ++item) { 319 EXPECT_EQ(item->first == Tag, llvm::isa<ExpectedType>(*item->second)); 320 } 321 } 322 323 void VerifyUnknownDyncasts() { 324 for (auto item = SymbolMap.begin(); item != SymbolMap.end(); ++item) { 325 bool should_match = false; 326 if (item->first == PDB_SymType::None || item->first >= PDB_SymType::Max) 327 should_match = true; 328 329 EXPECT_EQ(should_match, llvm::isa<PDBSymbolUnknown>(*item->second)); 330 } 331 } 332 333 private: 334 std::unique_ptr<IPDBSession> Session; 335 336 void InsertItemWithTag(PDB_SymType Tag) { 337 auto RawSymbol = std::make_unique<MockRawSymbol>(*Session, Tag); 338 auto Symbol = PDBSymbol::create(*Session, std::move(RawSymbol)); 339 SymbolMap.insert(std::make_pair(Tag, std::move(Symbol))); 340 } 341 }; 342 343 TEST_F(PDBApiTest, Dyncast) { 344 345 // Most of the types have a one-to-one mapping between Tag and concrete type. 346 VerifyDyncast<PDBSymbolExe>(PDB_SymType::Exe); 347 VerifyDyncast<PDBSymbolCompiland>(PDB_SymType::Compiland); 348 VerifyDyncast<PDBSymbolCompilandDetails>(PDB_SymType::CompilandDetails); 349 VerifyDyncast<PDBSymbolCompilandEnv>(PDB_SymType::CompilandEnv); 350 VerifyDyncast<PDBSymbolFunc>(PDB_SymType::Function); 351 VerifyDyncast<PDBSymbolBlock>(PDB_SymType::Block); 352 VerifyDyncast<PDBSymbolData>(PDB_SymType::Data); 353 VerifyDyncast<PDBSymbolAnnotation>(PDB_SymType::Annotation); 354 VerifyDyncast<PDBSymbolLabel>(PDB_SymType::Label); 355 VerifyDyncast<PDBSymbolPublicSymbol>(PDB_SymType::PublicSymbol); 356 VerifyDyncast<PDBSymbolTypeUDT>(PDB_SymType::UDT); 357 VerifyDyncast<PDBSymbolTypeEnum>(PDB_SymType::Enum); 358 VerifyDyncast<PDBSymbolTypeFunctionSig>(PDB_SymType::FunctionSig); 359 VerifyDyncast<PDBSymbolTypePointer>(PDB_SymType::PointerType); 360 VerifyDyncast<PDBSymbolTypeArray>(PDB_SymType::ArrayType); 361 VerifyDyncast<PDBSymbolTypeBuiltin>(PDB_SymType::BuiltinType); 362 VerifyDyncast<PDBSymbolTypeTypedef>(PDB_SymType::Typedef); 363 VerifyDyncast<PDBSymbolTypeBaseClass>(PDB_SymType::BaseClass); 364 VerifyDyncast<PDBSymbolTypeFriend>(PDB_SymType::Friend); 365 VerifyDyncast<PDBSymbolTypeFunctionArg>(PDB_SymType::FunctionArg); 366 VerifyDyncast<PDBSymbolFuncDebugStart>(PDB_SymType::FuncDebugStart); 367 VerifyDyncast<PDBSymbolFuncDebugEnd>(PDB_SymType::FuncDebugEnd); 368 VerifyDyncast<PDBSymbolUsingNamespace>(PDB_SymType::UsingNamespace); 369 VerifyDyncast<PDBSymbolTypeVTableShape>(PDB_SymType::VTableShape); 370 VerifyDyncast<PDBSymbolTypeVTable>(PDB_SymType::VTable); 371 VerifyDyncast<PDBSymbolCustom>(PDB_SymType::Custom); 372 VerifyDyncast<PDBSymbolThunk>(PDB_SymType::Thunk); 373 VerifyDyncast<PDBSymbolTypeCustom>(PDB_SymType::CustomType); 374 VerifyDyncast<PDBSymbolTypeManaged>(PDB_SymType::ManagedType); 375 VerifyDyncast<PDBSymbolTypeDimension>(PDB_SymType::Dimension); 376 377 VerifyUnknownDyncasts(); 378 } 379 380 } // end anonymous namespace 381