Skip to content

Conversation

@avillega
Copy link

@avillega avillega commented Sep 6, 2023

This change adds support for sanitizer symbolizer markup for linux. For more informationa about symbolzier markup please visit https://llvm.org/docs/SymbolizerMarkupFormat.html

@avillega avillega requested a review from a team as a code owner September 6, 2023 22:34
@fmayer
Copy link
Contributor

fmayer commented Sep 7, 2023

It don't see any positive tests added, you only changed the existing ones to false.

InternalScopedString modules_res;
RenderModules(&modules_res, modules,
/*symbolizer_markup=*/ true);
Printf("%s", modules_res.data());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be helpful to add an example of how this looks as a comment? Makes it easier to grep for as well.

? current_stack_allocations
: t->stack_allocations();
PrintStackAllocations(sa, addr_tag, untagged_addr);
if (common_flags()->enable_symbolizer_markup) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. Why is the PrintStackAllocationsMarkup in the else branch?

if (const ListOfModules *modules =
Symbolizer::GetOrInit()->GetRefreshedListOfModules()) {
InternalScopedString modules_res;
RenderModules(&modules_res, modules,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if this and the other caller looked like

if (common_flags()->enable_symbolizer_markup) RenderModulesMarkup(...); 

The indirection doesn't add much and only obscures what is happening.

}
buffer->append("}}}\n");

const auto ranges = module.ranges();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this copy? We don't seem to be touching module in the loop.

renderedModules.push_back({});
RenderedModule &curModule = renderedModules.back();
curModule.full_name = internal_strdup(module.full_name());
internal_memcpy(curModule.uuid, module.uuid(), module.uuid_size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert that curModule.uuid buffer can hold module.uuid_size?

break;
uptr pc_mask = (1ULL << 48) - 1;
uptr pc = record & pc_mask;
frame_desc.append(" record_addr:0x%zx record:0x%zx",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add a new format to the symbolizer markup to support this data?

Copy link
Collaborator

@vitalybuka vitalybuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests in test/sanitizer_common with the feature enabled

static const char kDefaultFormat[] = " #%n %p %F %L";

void RenderFrame(InternalScopedString *buffer, const char *format, int frame_no,
uptr address, const AddressInfo *info, bool vs_style,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs_style is ignored?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RenderFrame does use vs_style. Its is not used in symbolizer markup code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it then forwarded into RenderFrameMarkup?
if they are mutually exclusive, would it be better replace two bool flags with enum?

if (const ListOfModules *modules =
Symbolizer::GetOrInit()->GetRefreshedListOfModules()) {
InternalScopedString modules_res;
RenderModules(&modules_res, modules,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like RenderModules is unrelated change.
Can you please extract into a separate patch with justification and tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RenderModules is a related change, I added it as part of stacktrace_printer.h to keep a similar pattern to other Render* calls. As other reviewers have noted, it is a unnecessary indirection and I will replace in favor of calling RenderModulesMarkup directly.

const void *unwind_context) {}

#if SANITIZER_CAN_SLOW_UNWIND
# if SANITIZER_CAN_SLOW_UNWIND
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please precommit format fixes in a separate patch

Symbolizer *Symbolizer::PlatformInit() {
return new (symbolizer_allocator_) Symbolizer({});
IntrusiveList<SymbolizerTool> tools;
SymbolizerTool *tool = MarkupSymbolizer::get(&symbolizer_allocator_);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this use new() as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I think it's rather should be created inside of Symbolizer();

boomanaiden154 and others added 21 commits September 11, 2023 17:10
Some error logging in llvm-exegesis under the subprocess executor just prints a generic failure information rather than any details about the error as we omit printing the string version of errno. This patch adds in printing errno at all relevant points in the subprocess executor that were previously missed. Reviewed By: courbet Differential Revision: https://reviews.llvm.org/D157682
…rence CurLexer is dereferenced and should not be null in clang::Preprocessor::SkipExcludedConditionalBlock(clang::SourceLocation, clang::SourceLocation, bool, bool, clang::SourceLocation) This patch adds an assert for NULL value check of pointer CurLexer and splits up all predicates so that, when/if a failure occurs, we'll be able to tell which predicate failed. Reviewed By: tahonermann Differential Revision: https://reviews.llvm.org/D158293
This is likely a rebase artifact. libcpp-has-no-concepts is not a Lit feature we ever define anymore.
Use forward decls instead of #including the header files. Differential Revision: https://reviews.llvm.org/D159421
This time from clang/Parse. Differential Revision: https://reviews.llvm.org/D159435
This removes a comment added in D159312, which warned people to not re-add a whitespace in the `((void*)0))` expression. After discussions happened in D159312, it doesn't seem like a permanent solution. While I'd like to keep the whitespace removed for now, given that at least it can be a band-aid to some users who use musl and clang's `stddef.h` at the same time, it seems the usage of them together is not something that's officially supported, and I should not be implying this should be the permanent solution by saying so in the comments. Reviewed By: aaron.ballman, ributzka Differential Revision: https://reviews.llvm.org/D159383
These functions have been deprecated since: commit 8b1d86a Author: Guillaume Chatelet <gchatelet@google.com> Date: Mon Jan 23 10:08:01 2023 +0000 commit 355cc3f Author: Guillaume Chatelet <gchatelet@google.com> Date: Tue Jan 24 10:39:58 2023 +0000 Differential Revision: https://reviews.llvm.org/D159448
Probably missed some cases. We also probably should rename the ML stuff to use a consistent capitalization scheme
Buildbots failed after this landed, as reported at: <llvm#65267 (comment)> This reverts commit 9191ba7.
Cygwin shares the same limitations as traditional Windows executables for dynamic library loading, so disable building the dynamic library on Cygwin targets. Differential Revision: https://reviews.llvm.org/D155796
It was common to see `value.getValue().empty()` or `value.size()` instead of the idiomatic `value.empty()`. Depends on D159455 Differential Revision: https://reviews.llvm.org/D159456
Operations that can divide by zero and can have immediate undefined behaviour should be marked as `NoMemoryEffect` rather than `Pure`. Depends on D159456 Reviewed By: weiweichen Differential Revision: https://reviews.llvm.org/D159457
@HighCommander4 HighCommander4 removed request for a team September 11, 2023 17:45
@avillega
Copy link
Author

Will have to close this PR, seems I messed up by doing a rebase (old workflow habit) will create a new one with comments from this one fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment