[PATCH] D42926: [CodeView] Initial support for emitting S_BLOCK32 symbols for lexical scopes

Brock Wyma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 11:49:44 PST 2018


bwyma created this revision.
bwyma added reviewers: smerritt, rnk, zturner, aaboud.
Herald added a subscriber: hiraditya.

Right now, when two variables from different lexical scopes have the same name they are lumped together in the routine scope. 
 This can cause Visual Studio to display both variables simultaneously in the locals window and report "Variable is optimized away and not available" when referencing one of these variables in the watch window.  For example:

  if (...) {
    int local = ...;
  } else {
    int local = ...;
  }

This patch adds initial CodeView support for emitting S_BLOCK32 symbols to describe the lexical scopes containing these variables.  Because the CodeView encoding of this symbol only permits a single begin and end location it is not possible to describe lexical scopes with multiple address ranges.  Furthermore, this patch makes no attempt to sort variables into lexical blocks originating from inline functions as this functionality is better implemented incrementally.

This patch includes a new test, lexicalblock.ll, which demonstrates what the CodeView output will look like.
The test register-variables.ll required a minor update to change the order in which variables 'a' and 'c' are emitted due to the emission of the lexical blocks.


https://reviews.llvm.org/D42926

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/test/DebugInfo/COFF/lexicalblock.ll
  llvm/test/DebugInfo/COFF/register-variables.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42926.132858.patch
Type: text/x-patch
Size: 22376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180205/9634541e/attachment.bin>


More information about the llvm-commits mailing list