Skip to content

Fixed #line issues with debug info and error messages - #2991

Merged
Adam Yang (adam-yang) merged 3 commits into
microsoft:masterfrom
adam-yang:debug_info_pound_line
Jun 22, 2020
Merged

Adam Yang (adam-yang) merged 3 commits into
microsoft:masterfrom
adam-yang:debug_info_pound_line

Conversation

@adam-yang

Copy link
Copy Markdown
Contributor

This change made the debug metadata store the original unprocessed source locations instead of the #line locations.

The debug metadata used to contain the #line locations, but since we use the source stored in the PDB instead of actual source files on disk, the debug info ended up mapping to non-existent files. Maybe when we could restore this old behaviour when debuggers support loading source files on disk.

This change also fixes error messages whenever there are #line directives. Since the error messages use the same mechanism to create location info as generating the debug info, they need the original unprocessed locations (rather than the #line locations).

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk Gregory Roth (pow2clk) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there going to be any downsides to this? Will output for preprocessed shaders fail to correctly identify the original location?

Comment thread tools/clang/lib/CodeGen/CGDebugInfo.cpp Resolved
@adam-yang

Copy link
Copy Markdown
Contributor Author

Are there going to be any downsides to this? Will output for preprocessed shaders fail to correctly identify the original location?

Errors in preprocessed shaders will show the correct location as specified in the #line directive.

@pow2clk Gregory Roth (pow2clk) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good!

@adam-yang

Copy link
Copy Markdown
Contributor Author

The error messages were actually not working before for preprocessed shaders, because the routines the error emitter uses to generate the source location actually expects a non-preprocessed location.

@adam-yang

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing!

@AppVeyorBot

Copy link
Copy Markdown

@adam-yang
Adam Yang (adam-yang) merged commit bce85df into microsoft:master Jun 22, 2020
Lssikkes added a commit to Lssikkes/DirectXShaderCompiler_NsightHLSLFix that referenced this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants