Skip to content

Commit 3105fe7

Browse files
committed
Merge remote-tracking branch 'origin/main' into next
2 parents 1f1830a + 7d72a62 commit 3105fe7

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

docs/DebuggingTheCompiler.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ benefit of all Swift developers.
4949
- [Manually symbolication using LLDB](#manually-symbolication-using-lldb)
5050
- [Viewing allocation history, references, and page-level info](#viewing-allocation-history-references-and-page-level-info)
5151
- [Printing memory contents](#printing-memory-contents)
52+
- [Windows Error Codes](#windows-error-codes)
5253
- [Debugging LLDB failures](#debugging-lldb-failures)
5354
- ["Types" Log](#types-log)
5455
- ["Expression" Log](#expression-log)
@@ -1058,6 +1059,36 @@ The following specifiers are available:
10581059
* w - word (32-bit value)
10591060
* g - giant word (64-bit value)
10601061

1062+
## Windows Error Codes
1063+
1064+
When debugging programs on Windows, sometimes one will run into an error message with a mysterious error code. E.x.:
1065+
1066+
```
1067+
note: command had no output on stdout or stderr
1068+
error: command failed with exit status: 0xc0000135
1069+
```
1070+
1071+
These on windows are called HRESULT values. In the case above, the HRESULT is telling me that a DLL was not found. I discovered this
1072+
by running the Microsoft provided [System Error Code Lookup Tool](https://learn.microsoft.com/en-us/windows/win32/debug/system-error-code-lookup-tool). After running
1073+
this tool with the relevant error code on a windows machine, I got back the following result:
1074+
1075+
```
1076+
# for hex 0xc0000135 / decimal -1073741515
1077+
STATUS_DLL_NOT_FOUND ntstatus.h
1078+
# The code execution cannot proceed because %hs was not
1079+
# found. Reinstalling the program may fix this problem.
1080+
# as an HRESULT: Severity: FAILURE (1), FACILITY_NULL (0x0), Code 0x135
1081+
# for hex 0x135 / decimal 309
1082+
ERROR_NOTIFICATION_GUID_ALREADY_DEFINED winerror.h
1083+
# The specified file already has a notification GUID
1084+
# associated with it.
1085+
```
1086+
1087+
Some relevant Microsoft documentation:
1088+
1089+
* https://learn.microsoft.com/en-us/windows/win32/seccrypto/common-hresult-values
1090+
* https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a
1091+
* https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
10611092

10621093
# Debugging LLDB failures
10631094

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
10691069
llvm::DIFile *File, unsigned Line, unsigned SizeInBits,
10701070
llvm::DINode::DIFlags Flags, StringRef UniqueID, StringRef Name) {
10711071
// Forward declare this first because types may be recursive.
1072-
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
1072+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
10731073
llvm::dwarf::DW_TAG_structure_type, Name, Scope, File, Line,
10741074
llvm::dwarf::DW_LANG_Swift, SizeInBits, 0, Flags, UniqueID));
10751075

@@ -1290,7 +1290,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
12901290
// Default, since Swift doesn't allow specifying a custom alignment.
12911291
unsigned AlignInBits = 0;
12921292

1293-
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
1293+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
12941294
llvm::dwarf::DW_TAG_enumeration_type, MangledName, Scope, File, Line,
12951295
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
12961296
MangledName));
@@ -1344,7 +1344,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
13441344

13451345
// A variant part should actually be a child to a DW_TAG_structure_type
13461346
// according to the DWARF spec.
1347-
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
1347+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
13481348
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
13491349
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
13501350
MangledName));
@@ -1419,7 +1419,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
14191419

14201420
// A variant part should actually be a child to a DW_TAG_structure_type
14211421
// according to the DWARF spec.
1422-
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
1422+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
14231423
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
14241424
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
14251425
MangledName));
@@ -1631,7 +1631,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
16311631
unsigned SizeInBits, unsigned AlignInBits,
16321632
llvm::DINode::DIFlags Flags,
16331633
StringRef MangledName) {
1634-
auto FwdDecl = llvm::TempDINode(DBuilder.createReplaceableCompositeType(
1634+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
16351635
llvm::dwarf::DW_TAG_subroutine_type, MangledName, Scope, MainFile, 0,
16361636
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
16371637
MangledName));
@@ -1696,7 +1696,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
16961696
}
16971697
// FIXME: assert that SizeInBits == OffsetInBits.
16981698

1699-
auto FwdDecl = llvm::TempDINode(DBuilder.createReplaceableCompositeType(
1699+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
17001700
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, MainFile, 0,
17011701
llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags,
17021702
MangledName));
@@ -2030,7 +2030,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
20302030
auto DerivedFrom = Superclass.isNull()
20312031
? nullptr
20322032
: getOrCreateDesugaredType(Superclass, DbgTy);
2033-
auto FwdDecl = llvm::TempDIType(DBuilder.createReplaceableCompositeType(
2033+
llvm::TempDICompositeType FwdDecl(DBuilder.createReplaceableCompositeType(
20342034
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, L.File,
20352035
FwdDeclLine, llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits,
20362036
Flags));
@@ -2384,7 +2384,7 @@ createSpecializedStructOrClassType(NominalOrBoundGenericNominalType *Type,
23842384
// winning over a full definition.
23852385
auto *FwdDecl = DBuilder.createReplaceableCompositeType(
23862386
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0, 0,
2387-
llvm::dwarf::DW_LANG_Swift, 0, 0, llvm::DINode::FlagFwdDecl);
2387+
llvm::dwarf::DW_LANG_Swift);
23882388
FwdDeclTypes.emplace_back(
23892389
std::piecewise_construct, std::make_tuple(MangledName),
23902390
std::make_tuple(static_cast<llvm::Metadata *>(FwdDecl)));
@@ -2540,7 +2540,7 @@ void IRGenDebugInfoImpl::finalize() {
25402540
// Finalize all replaceable forward declarations.
25412541
auto finalize = [&](llvm::MDNode *FwdDeclType, llvm::MDNode *FullType,
25422542
llvm::MDString *UID = nullptr) {
2543-
llvm::TempMDNode FwdDecl(cast<llvm::MDNode>(FwdDeclType));
2543+
llvm::TempDICompositeType FwdDecl(cast<llvm::DICompositeType>(FwdDeclType));
25442544
llvm::Metadata *Replacement = FullType ? FullType : FwdDeclType;
25452545
llvm::Metadata *Replaced = DBuilder.replaceTemporary(
25462546
std::move(FwdDecl), cast<llvm::MDNode>(Replacement));

0 commit comments

Comments
 (0)