Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Consider hiding __beginN / __endN / __rangeN range-based for variables from debug info #43258

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR44288
Status NEW
Importance P enhancement
Reported by Reid Kleckner (rnk@google.com)
Reported on 2019-12-12 14:05:10 -0800
Last modified on 2019-12-13 03:35:52 -0800
Version 8.0
Hardware PC Windows NT
CC lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, paul_robinson@playstation.sony.com, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
I was debugging something in windbg and I saw this:

0:000> dx
Debugger.Sessions[0].Processes[7704].Threads[13648].Stack.Frames[8].SwitchTo();dv
/t /v
Debugger.Sessions[0].Processes[7704].Threads[13648].Stack.Frames[8].SwitchTo()
<unavailable>     class lld::coff::`anonymous namespace'::PDBLinker * this =
<value unavailable>
<unavailable>     class lld::coff::ObjFile * file = <value unavailable>
<unavailable>     struct lld::coff::CVIndexMap * externIndexMap = <value
unavailable>
0000007b`3e58bee0 struct lld::coff::CVIndexMap objectIndexMap = struct
lld::coff::CVIndexMap
0000007b`3e58c2a0 class llvm::Expected<const lld::coff::CVIndexMap &>
indexMapResult = class llvm::Expected<const lld::coff::CVIndexMap &>
0000007b`3e58bed0 struct lld::ScopedTimer t = struct lld::ScopedTimer
0000007b`3e58c190 class lld::coff::`anonymous namespace'::DebugSHandler dsh =
class lld::coff::`anonymous namespace'::DebugSHandler
<unavailable>     class llvm::pdb::DbiStreamBuilder * dbiBuilder = <value
unavailable>
<unavailable>     class lld::coff::SectionChunk ** __end2 = <value unavailable>
<unavailable>     class lld::coff::SectionChunk ** __begin2 = <value
unavailable>
<unavailable>     class llvm::ArrayRef<lld::coff::SectionChunk *> * __range2 =
<value unavailable>
<unavailable>     class lld::coff::SectionChunk * debugChunk = <value
unavailable>
<unavailable>     class llvm::FixedStreamArray<llvm::object::FpoData>
fpoRecords = <value unavailable>
<unavailable>     class llvm::BinaryStreamReader reader = <value unavailable>
<unavailable>     class llvm::ArrayRef<unsigned char> relocatedDebugContents =
<value unavailable>
<unavailable>     unsigned int count = <value unavailable>
<unavailable>     class llvm::FixedStreamArrayIterator<llvm::object::FpoData>
__begin4 = <value unavailable>
<unavailable>     class llvm::FixedStreamArrayIterator<llvm::object::FpoData>
__end4 = <value unavailable>
<unavailable>     class llvm::FixedStreamArray<llvm::object::FpoData> *
__range4 = <value unavailable>

Some of these variables are compiler synthesized and therefore uninteresting.
We should consider mot emitting debug info for them in the first place.

Alternatively, we could try mixing in scopes in our optimized debug info output
to hide some of these variables, which are not actually in scope at this point
in the program.

I am stopped at the mergeDebugT call here in LLD:
https://github.com/llvm/llvm-project/blob/7081c922416b7b2348a1b10cd1d9528f3089f5fb/lld/COFF/PDB.cpp#L1172
Quuxplusone commented 4 years ago
I seem to recall the commit that added the version suffix,
i believe they are present intentionally for that very reason - to help
with debugging.
Quuxplusone commented 4 years ago
We had specific requests to make implicit loop variables available for
debugging.  They are flagged as artificial, and in DWARF at least, they are
scoped inside appropriate lexical_block entries.  Maybe that just doesn't
propagate into CodeView properly?