aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-05-06 14:28:52 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-05-06 14:28:52 +0200
commit11f155d5a60715508a3fe2069f723f354c65bc52 (patch)
treebf6d1ef7dfa9fdf8cb27f51041965457043933c1
parentd2d4e032fa732cfb134a646445cf8776d88c5de3 (diff)
downloadsebastiano.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.md22
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
114decently well. Another good reason is ubiquity - I don't want to force 114decently well. Another good reason is ubiquity - I don't want to force
115my few potential users to install a whole Rust environment just for nissy! 115my 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
118compiler option `-fsanitize=address`, which adds some runtime
119checks to detect this kind of memory errors. And it works!
120Compiling the pre-bugfix version of the code with this extra option
121and then launching nissy results in the following error:
122
123```
124src/coord.c:554:17: runtime error: index 70 out of bounds for type 'int [70]'
125src/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
130relatively recent compiler feature, available in `clang`
131by default and in `gcc` via the external `libsanitizer`
132library. The earliest reference I could find is a talk from
1332011 ([YouTube video](https://www.youtube.com/watch?v=CPnRS1nv3_s),
134([slides](https://llvm.org/devmtg/2011-11/Serebryany_FindingRacesMemoryErrors.pdf)).
135Coincidentally, I had just read about them in [a blog
136post](https://nullprogram.com/blog/2023/04/29) a week ago, but I did
137not think about using them. From now on, I definitely will!
138
117### Real world checks 139### Real world checks
118 140
119Running your software on more platforms and making sure everything 141Running your software on more platforms and making sure everything

Generated with cgit - Back to sebastiano.tronto.net