- Notifications
You must be signed in to change notification settings - Fork 15.3k
[sanitizer_symbolizer] Symbolizer Markup for linux #66126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change adds support for sanitizer symbolizer markup for linux. For more informationa about symbolzier markup please visit https://llvm.org/docs/SymbolizerMarkupFormat.html
| @llvm/pr-subscribers-compiler-rt-sanitizer ChangesThis change adds support for sanitizer symbolizer markup for linux. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test like this for hwasan as well, seeing how you changed hwasan_report.cpp
| modules_fresh_ = true; | ||
| } | ||
| | ||
| const ListOfModules *Symbolizer::GetRefreshedListOfModules() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this is a const ListOfModules&? This seems to always be non-NULL.
| | ||
| bool ModulesEq(const LoadedModule *module, | ||
| const RenderedModule *renderedModule) { | ||
| return module->base_address() == renderedModule->base_address && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert(module->uuid_size) < sizeof(renderedModule->uuid)
| bool ModuleHasBeenRendered( | ||
| const LoadedModule *module, | ||
| const InternalMmapVectorNoCtor<RenderedModule> *renderedModules) { | ||
| for (auto *it = renderedModules->begin(); it != renderedModules->end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use range-based loop?
| buffer->append("{{{reset}}}\n"); | ||
| } | ||
| | ||
| for (auto *moduleIt = modules->begin(); moduleIt != modules->end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no range-based loop?
| uptr record = *record_addr; | ||
| if (!record) | ||
| break; | ||
| uptr pc_mask = (1ULL << 48) - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe pull this and the other use out into a constexpr?
| InternalScopedString frame_desc; | ||
| Printf("Previously allocated frames:\n"); | ||
| for (uptr i = 0; i < frames; i++) { | ||
| const uptr *record_addr = &(*sa)[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we made sa a reference this would be nicer, and there is only one caller for this
| } | ||
| | ||
| if (common_flags()->enable_symbolizer_markup) { | ||
| if (const ListOfModules *modules = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you changed the code to never return nullptr here, so this if doesn't do anything?
| | ||
| uptr frames = Min((uptr)flags()->stack_history_size, sa->size()); | ||
| | ||
| if (const ListOfModules *modules = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you changed the code to never return nullptr here, so this if doesn't do anything?
| | ||
| for (SymbolizedStack *cur = frames; cur; cur = cur->next) { | ||
| uptr prev_len = output_->length(); | ||
| RenderFrame(output_, "", frame_num_++, cur->info.address, nullptr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add /* foo = */ to the ""
| Could we move functions in compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.h into a class, e.g. Instead we would end up with something like: This could be done as two changes. First to introduce the new class and refactor all existing use cases. Second to introduce the markup implementation. Each of these changes should be easier to review than the current patch. |
This change adds support for sanitizer symbolizer markup for linux.
For more informationa about symbolzier markup please visit https://llvm.org/docs/SymbolizerMarkupFormat.html