diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-06 14:28:52 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-05-06 14:28:52 +0200 |
| commit | 11f155d5a60715508a3fe2069f723f354c65bc52 (patch) | |
| tree | bf6d1ef7dfa9fdf8cb27f51041965457043933c1 | |
| parent | d2d4e032fa732cfb134a646445cf8776d88c5de3 (diff) | |
| download | sebastiano.tronto.net-11f155d5a60715508a3fe2069f723f354c65bc52.tar.gz sebastiano.tronto.net-11f155d5a60715508a3fe2069f723f354c65bc52.zip | |
Update blog post
| -rw-r--r-- | src/blog/2023-05-05-debug-smartphone/debugging-smartphone.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/blog/2023-05-05-debug-smartphone/debugging-smartphone.md b/src/blog/2023-05-05-debug-smartphone/debugging-smartphone.md index e346860..8c9e41b 100644 --- a/src/blog/2023-05-05-debug-smartphone/debugging-smartphone.md +++ b/src/blog/2023-05-05-debug-smartphone/debugging-smartphone.md | |||
| @@ -114,6 +114,28 @@ huge advantage over any of these better-on-paper alternatives: I know it | |||
| 114 | decently well. Another good reason is ubiquity - I don't want to force | 114 | decently well. Another good reason is ubiquity - I don't want to force |
| 115 | my few potential users to install a whole Rust environment just for nissy! | 115 | my few potential users to install a whole Rust environment just for nissy! |
| 116 | 116 | ||
| 117 | **Update:** After sharing this post, I have been advised to use the | ||
| 118 | compiler option `-fsanitize=address`, which adds some runtime | ||
| 119 | checks to detect this kind of memory errors. And it works! | ||
| 120 | Compiling the pre-bugfix version of the code with this extra option | ||
| 121 | and then launching nissy results in the following error: | ||
| 122 | |||
| 123 | ``` | ||
| 124 | src/coord.c:554:17: runtime error: index 70 out of bounds for type 'int [70]' | ||
| 125 | src/coord.c:554:36: runtime error: store to address 0x56383f5236b8 with insufficient space for an object of type 'int' | ||
| 126 | ... | ||
| 127 | ``` | ||
| 128 | |||
| 129 | [Sanitizers](https://github.com/google/sanitizers) are a | ||
| 130 | relatively recent compiler feature, available in `clang` | ||
| 131 | by default and in `gcc` via the external `libsanitizer` | ||
| 132 | library. The earliest reference I could find is a talk from | ||
| 133 | 2011 ([YouTube video](https://www.youtube.com/watch?v=CPnRS1nv3_s), | ||
| 134 | ([slides](https://llvm.org/devmtg/2011-11/Serebryany_FindingRacesMemoryErrors.pdf)). | ||
| 135 | Coincidentally, I had just read about them in [a blog | ||
| 136 | post](https://nullprogram.com/blog/2023/04/29) a week ago, but I did | ||
| 137 | not think about using them. From now on, I definitely will! | ||
| 138 | |||
| 117 | ### Real world checks | 139 | ### Real world checks |
| 118 | 140 | ||
| 119 | Running your software on more platforms and making sure everything | 141 | Running your software on more platforms and making sure everything |
