Skip to content

Commit bc6e52f

Browse files
committed
Adds initial draft for build error debugging topic
1 parent fd6fabb commit bc6e52f

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

sources/knowledge_areas.dat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ EH Error Handling
5555
? ? ? ? errno
5656
? ? ? ? Error Codes
5757
eh y y y Exception Handling
58+
DE Debugging Errors
59+
builderr y y n Build Errors
5860
SL Standard Library
5961
? ? ? ? Input/Output (I/O)
6062
? ? ? ? Containers, Iterators, and Algorithms
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
## Debugging errors: Build errors {#builderr}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Common build errors
15+
16+
Main Complex build errors
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
Code that is written should follow the rules set in the standard to be correct.
28+
Compilers and linkers will complain when you don’t follow the rules, sometimes in hard to understand language to precisely match the standard's definitions.
29+
Hence, we should enable students to understand these error messages and extract the necessary information to help them fix their problem.
30+
31+
### Topic introduction
32+
33+
_Very brief introduction to the topic._
34+
35+
In the C++ ecosystem there are a multitude of build systems (TODO: link) and tools to produce programs.
36+
Building these programs from source code involves multiple steps and in each of these steps problems can occur.
37+
38+
### Foundational: Common build errors {#builderr-found}
39+
40+
#### Background/Required Knowledge
41+
42+
A student:
43+
44+
* should be familiar with the build system (link)
45+
* definitions (link def:found)
46+
47+
#### Student outcomes
48+
49+
_A list of things "a student should be able to" after the curriculum._
50+
_The next word should be an action word and testable in an exam._
51+
_Max 5 items._
52+
53+
A student should be able to:
54+
55+
1. extract the necessary information from an error message (compiler/linker) to fix the problem
56+
2. differentiate build errors from other types of errors (e.g., run-time errors)
57+
58+
#### Caveats
59+
60+
_This section mentions subtle points to understand, like anything resulting in
61+
implementation-defined, unspecified, or undefined behavior._
62+
63+
* Introduce the concept of ODR violations [TODO: insert link to ODR in definitions]
64+
* There exist different approaches to describe how software projects should be compiled (e.g., cmake). Students should be introduced to at least one and given an introduction to work and debugging this approach.
65+
66+
67+
#### Points to cover
68+
69+
_This section lists important details for each point._
70+
71+
* Different types of build errors
72+
* Compiler errors
73+
* Reason: Illformed constructs that are not valid in the language.
74+
* code/error example (TODO)
75+
* Compiler warnings (-Werror)
76+
* Reason: Constructs that are officially “legal” in the language but can be dangerous, e.g., they could potentially lead to UB.
77+
* code/error example (TODO)
78+
* Linker errors
79+
* Reason: Symbols from other translation units that are required can not be found or are defined multiple times.
80+
* code/error example (TODO)
81+
* Tools
82+
* Give overview
83+
* Differences between them
84+
* code/error example where clang and gcc disagree (TODO)
85+
* Interpreting error messages: Explain how error messages can be read and interpreted.
86+
87+
88+
### Main: Complex build errors {#builderr-main}
89+
90+
#### Background/Required Knowledge
91+
92+
* name mangling (link)
93+
94+
#### Student outcomes
95+
96+
A student should be able to:
97+
98+
1. debug more complex system build problems
99+
2. pinpoint the exact issue in a large and complex error message
100+
3. identify run-time problems that rise from build-time errors where the compiler/linker does not warn about “no diagnostic required” (e.g., ODR violations)
101+
102+
#### Caveats
103+
104+
* Linking problems due to weak vs strong symbols (TODO: link linkage)
105+
106+
#### Points to cover
107+
108+
* Discuss the role that name mangling in error messages and problems
109+
* Mention that more specialized forms of debugging exist [[Debugging Errors: Compile-Time Debugging]][1]
110+
* Linking order problems, e.g., static initialization order (i.e., global initialization order depends on linking order)
111+
* Discuss how one could debug/detect ODR violations
112+
113+
114+
### Advanced
115+
116+
_These are important topics that are not expected to be covered but provide
117+
guidance where one can continue to investigate this topic in more depth._
118+
119+
* Problems with debugging the linking to different languages (e.g, C, Rust) [TODO: link extern “C”]
120+
* Problems due to incompatible ABIs
121+
122+
[1]: ../debugging_errors/compile-time-debugging.md

0 commit comments

Comments
 (0)