Skip to content
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

debug-info: Add checks for instructions without source locations #4251

Conversation

dwblaikie
Copy link
Contributor

I think this is what you were looking for, @jonmeow? (I was trying to figure out how to tersely phrase the check to be "this isn't supported here yet, and not clear if it needs to be supported here - but if this assert is hit, then we should add support here?" - open to wording suggestions)

(this will fail testing due to #4249 - so shouldn't be submitted before that, though they aren't textually/patch-ually dependent on each other)

I think this is what you were looking for, @jonmeow? (I was trying to
figure out how to tersely phrase the check to be "this isn't supported
here yet, and not clear if it needs to be supported here - but if this
assert is hit, then we should add support here?" - open to wording
suggestions)

(this will fail testing due to carbon-language#4249 - so shouldn't be submitted before
that, though they aren't textually/patch-ually dependent on each other)
@jonmeow
Copy link
Contributor

jonmeow commented Aug 26, 2024

@dwblaikie Can you please fix your commit message to not @ me? I will already get notifications from PRs, I don't need notifications from individual commits too. i.e., please fix: dwblaikie@8134dfb

I would generally encourage using PR comments to @ people rather than commits, since the PR is where discussion will occur.

@jonmeow
Copy link
Contributor

jonmeow commented Aug 26, 2024

BTW, per josh11b at #4247 (comment), I think we can't just add these CHECKs and the line number issue I was noting is already a problem. There's more going on here so I'm poking around.

Comment on lines +101 to +105
CARBON_CHECK(loc.filename == di_subprogram_->getFile()->getFilename())
<< "Instructions located in a different file from their enclosing "
"function aren't handled yet";
CARBON_CHECK(loc.line_number >= 1 && loc.column_number >= 1)
<< "Instructions without line locations aren't handled yet";
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, I think this isn't catching the existing issues because it's not used everywhere GetDiagnosticLoc is.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be sure, what I was noting here was that file_context.cpp also queries ConvertLoc. Since it won't use this code, the function missing a line number could be missed. That is, this would miss:

// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "__global_init", scope: null, file: !3, line: 4294967295, type: !5, spFlags: DISPFlagDefinition, unit: !2)

#4252 fixes this.

@jonmeow
Copy link
Contributor

jonmeow commented Aug 26, 2024

FYI, #4252 with a different approach on the line numbers, which looks like it fixes the current issues.

@dwblaikie
Copy link
Contributor Author

FYI, #4252 with a different approach on the line numbers, which looks like it fixes the current issues.

Works for me - I'll abandon/delete this change. Thanks!

@dwblaikie
Copy link
Contributor Author

@dwblaikie Can you please fix your commit message to not @ me? I will already get notifications from PRs, I don't need notifications from individual commits too. i.e., please fix: dwblaikie@8134dfb

I would generally encourage using PR comments to @ people rather than commits, since the PR is where discussion will occur.

Ah, yeah - sorry, old habit from LLVM where commit message -> description in Phabricator I guess, without the extra layer of commits nested within a review. Will try to avoid writing review descriptions in commits in the future.

@dwblaikie dwblaikie closed this Aug 26, 2024
@dwblaikie dwblaikie deleted the debug_info_source_locations_checks branch August 26, 2024 22:00
@jonmeow
Copy link
Contributor

jonmeow commented Aug 26, 2024

Ah, yeah - sorry, old habit from LLVM where commit message -> description in Phabricator I guess, without the extra layer of commits nested within a review. Will try to avoid writing review descriptions in commits in the future.

Thanks! Other aspect of this with GitHub, I would've also gotten a notification when the commit was merged. I really wish GH gave me a way of narrowly disabling that.

github-merge-queue bot pushed a commit that referenced this pull request Sep 4, 2024
Mainly, changes the default from -1 to 0 in DiagnosticLoc, still trying
to keep reusing that. Nothing except for the lowered output is affected,
so I think this is fine.

Also, have lowering consistently call GetDiagnosticLoc.

Pulls in one of the CHECKs suggested from #4251 

Co-authored-by: David Blaikie <[email protected]>
dwblaikie added a commit to dwblaikie/carbon-lang that referenced this pull request Sep 6, 2024
Mainly, changes the default from -1 to 0 in DiagnosticLoc, still trying
to keep reusing that. Nothing except for the lowered output is affected,
so I think this is fine.

Also, have lowering consistently call GetDiagnosticLoc.

Pulls in one of the CHECKs suggested from carbon-language#4251

Co-authored-by: David Blaikie <[email protected]>
dwblaikie added a commit to dwblaikie/carbon-lang that referenced this pull request Sep 9, 2024
Mainly, changes the default from -1 to 0 in DiagnosticLoc, still trying
to keep reusing that. Nothing except for the lowered output is affected,
so I think this is fine.

Also, have lowering consistently call GetDiagnosticLoc.

Pulls in one of the CHECKs suggested from carbon-language#4251 

Co-authored-by: David Blaikie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants