Debug function symbols for non windows#1073
Conversation
|
PTAL @nattress @AndyAyersMS |
FYI, a number of places in the codebase (and in LLVM) dodge this by prefixing with "The" (TargetMachine TheTargetMachine;). I'm not concerned whether you do it that way or camlCase as you suggest, just wanted to mention it for consideration. |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Would be helpful if for something like this you could describe a bit more about what was wrong before you made these changes, eg "elf/dwarf requires xxx ..."
Also would appreciate seeing reformatting/renaming changes done as separate PRs instead of mixing them in with functional changes. I see you kept them as separate commits but separate PRs is even better.
lib/ObjWriter/objwriter.h
Outdated
| MCAsmBackend *AsmBackend; // Owned by MCStreamer | ||
| std::unique_ptr<MCInstrInfo> InstrInfo; | ||
| std::unique_ptr<MCSubtargetInfo> SubtargetInfo; | ||
| MCCodeEmitter *CodeEmmiter; // Owned by MCStreamer |
There was a problem hiding this comment.
Typo: name should be CodeEmitter
| if (!Section->getBeginSymbol()) { // Is it set for default sections? | ||
| MCSymbol *SectionStartSym = OutContext->createTempSymbol(); | ||
| Streamer->EmitLabel(SectionStartSym); | ||
| Section->setBeginSymbol(SectionStartSym); |
There was a problem hiding this comment.
I don't really understand what this does.
Do we ever refer to this temp symbol anywhere else? If so, you should leave a comment indicating where.
If not, why do we need it create it at all?
There was a problem hiding this comment.
Update: I checked it again. We need this symbols for DWARF only. They are used as base symbols when we emit debug locations.
There was a problem hiding this comment.
So are you adding it back? Fixing it some other way?
There was a problem hiding this comment.
We need this symbols and they are used in dwarf for EmitLabelPlusOffset, where label is our beginSymbol.
There was a problem hiding this comment.
Sounds like that would make a good code comment.
Yes, it is possible variant, but it kills all advantages of intellisense because all variables start with the same prefix. But I will be happy with any decision. |
4beffb3 to
e7eda35
Compare
Use fields instead of getting context and streamer from AsmPrinter each time. It allows to write small functions.
e7eda35 to
1253cac
Compare
|
Latest version LGTM. |
1253cac to
5054ea5
Compare
Fix problem with lldb debugging.
So after this fix we emit correct attributes for function symbols and sections.
The corresponding CoreRT PR .
Some examples:
There is problem with image --lookup output, it doesn't show source line for address, but it will be fixed in the other PR.
Also I want to rename all variables in camel case. gcc doesn't allow to name variables as types (TargetMachine TargetMachine; ) and it creates many problems. So I want to use the same naming rules as CoreCLR and CoreRT.