[cfe-dev] assembler-with-cpp and debug info

Robinson, Paul Paul.Robinson at am.sony.com
Wed Oct 17 18:03:23 PDT 2012


Okay, I'll pass my workaround along to my client and see if I can
get the work scheduled.  Appreciate the pointers, thanks!
--paulr
________________________________________
From: Eli Friedman [eli.friedman at gmail.com]
Sent: Tuesday, October 16, 2012 5:36 PM
To: Robinson, Paul
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] assembler-with-cpp and debug info

On Tue, Oct 16, 2012 at 5:20 PM, Robinson, Paul
<Paul.Robinson at am.sony.com> wrote:
> If we have a hand-coded assembler source file, and use Clang to process
> it through the preprocessor, the preprocessor leaves behind directives
> of the form
>   # line-number "filename"
> indicating the original source information of the preprocessed file.
> That's all good.
>
> If we use Clang to both preprocess and assemble the file with the integrated
> assembler (i.e., -x assembler-with-cpp), and use -g to get debug info, then
> it turns out the final object file's debug info will refer to the temp file
> that the Clang preprocessor created, not the original source file.  It's
> ignoring the #line-number directives.  That's not so good.
>
> If I use "-no-integrated-as -Wa,-g" instead of just "-g", then the debug info
> comes out the way I want it to, i.e. inferring .debug_line information from
> the #line-number directives.  So, this would be a "gas" compatibility issue.
>
> Is there a way to get the integrated assembler to use the #line-number
> directives for debug info?  Or is this just not implemented yet?

Not yet implemented.  If you're interested, the relevant code for the
locations is getStreamer().EmitDwarfLocDirective in
AsmParser::ParseStatement in llvm/lib/MC/MCParser/AsmParser.cpp , and
the relevant code for '#' parsing is
AsmParser::ParseCppHashLineFilenameComment in the same file.

-Eli




More information about the cfe-dev mailing list