Author: Luís Ferreira <email@example.com>
Date: Fri, 1 Oct 2021 00:05:57 +0100
posts: add SAOC LLDB D integration: 2nd Weekly Update
Signed-off-by: Luís Ferreira <firstname.lastname@example.org>
1 file changed, 87 insertions(+), 0 deletions(-)
diff --git a/content/posts/d-saoc-2021-02.md b/content/posts/d-saoc-2021-02.md
@@ -0,0 +1,87 @@
+# SAOC LLDB D integration: 2nd Weekly Update
+Hi D community!
+Sorry for being late this week.
+I'm here again, to describe what I've done during the second week of Symmetry
+Autumn of Code.
+## Finalizing the LLDB integration
+Last week some missing pieces on the test suite and on the LLDB side was
+concluded at the beginning of this week and put everything together.
+## Restructure the code to be more C++ish
+After successfully integrating `libiberty` D demangler into LLVM and before
+sending the patches to LLVM, code style needed to be properly handled to
+conform with `clang-format` style of LLVM, so, I decided to transform the code
+to be more C++ like:
+- Move functions with `struct dlang_info` context to a struct making them
+ member functions to implicitly pass the context
+- Make string handling on the demangler a bit more C++ish (class OutputString)
+- Fix structural codestyle to conform with clang formatting such as variables
+ names, spaces between identifiers, etc...
+I also ended up writing documentation for everything inside the string and
+demangler struct for future understanding.
+## Send patches to the LLVM review platform
+Right after having the codestyle finished, I submitted the patches into the
+LLVM review platform. In the meantime, I'm striving for acceptance and
+proactively changing the patches to accomplish with the LLVM maintainers
+The first patch introduces the demangler codebase with the ported code,
+available [here](https://reviews.llvm.org/D110578). The second patch enables
+support for `llvm-cxxfilt` tool, similar to `c++filt` from GNU binutils,
+available [here](https://reviews.llvm.org/D110576). Finally, the last patch
+enables the most important part for the users, the LLDB part. The patch is
+## Reflected GCC changes
+Meanwhile, I found some things to improve on the `libiberty` side that I
+changed on my patches to LLVM:
+- Use appendc for single chars append:
+- Remove parenthesis where it is not needed:
+- Rename function symbols to be more consistent:
+- Use switch instead of if-else:
+I also made this patch which fixes the testsuite that I previously broke on the
+- Add missing format on d-demangle-expected:
+## About the security issues
+I made a thread on the GCC mailing list to encourage more fuzzing. Currently
+the demangler is being fuzzed without any heuristics which makes it inefficient
+to search for real security vulnerabilities. Instead, AFL and libfuzzer should
+be taken to consideration. My idea is to also add support for GCC/libiberty to
+OSS Fuzz. You can check the thread
+participate if you have any questions or suggestions on that topic.
+About the exponential time complexity issue, I don't have any news, since I
+still don't have the full picture of it. I'm probably not going to dedicate
+much time to that since it's kinda out of the scope of this project. Although,
+if anyone wants to have a look and discuss hints and suggestions to improve the
+current demangler, I appreciate it.
+are the blobs generated by the fuzzer for timeout and slow-unit triggers.
+## What's next?
+For now, I'm going to proactively fix the requested changes in the LLVM
+patches. They seem to require smaller patches and probably the next week will
+be dedicated to that.