[PATCH] D152708: [RFC][Draft] Enable primitive support for Two-Level Line Tables in LLVM

Stephen Tozer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 06:21:34 PDT 2023


StephenTozer created this revision.
StephenTozer added a project: debug-info.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
StephenTozer requested review of this revision.
Herald added subscribers: llvm-commits, lldb-commits, cfe-commits, jplehr, sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added projects: clang, LLDB, LLVM.

NOTE: This is not intended to be merged into LLVM, as the implementation is incomplete and hacked-in and **is not being actively developed**; the intention is simply to provide a basic working implementation that can be analyzed and potentially expanded on by any interested parties. For more information see this discourse post.

This patch implements the Two-Level Line Tables (TLLT) proposal <https://dwarfstd.org/issues/140906.1.html> currently aiming for Dwarf 6. This proposal allows the line table, which is DWARF's data structure used to map instructions to source locations and vice versa, to be emitted as a pair of tables instead of one, one of which maps source locations to instructions (the Logicals table) and the other of which maps instructions to source locations (the Actuals table). The proposal then extends the Logicals table by adding a context column, allowing entries in that table that represent inlined instructions to refer to another Logicals entry as being the inlined call location for that instruction, creating records for an inlined call stack in the line table and allowing the inlined callsites to be mapped to an instruction in the debugger.

This solves one of the current weaknesses in DWARF debugging, which is the inability to set breakpoints or step onto inlined callsites. However, there are other proposals (such as Location View Numbering <https://dwarfstd.org/issues/170427.1.html>) that could achieve the same thing, and the costs of TLLT in storage size and design complexity may make it a non-ideal solution to this problem. We currently have no plans to develop this implementation further, but this small demo may be useful to other developers who have an interest in pursuing this, and it is still possible that a good case may be made for TLLT as the best solution to the problem of representing inlined callsites.

As mentioned in the header, this patch was the result of aiming to get a basic functioning implementation in a very short time; it is not intended to be merged and is not of suitable quality, particularly in LLDB (with which we have no familiarity).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152708

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  lldb/include/lldb/Symbol/LineTable.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/LineTable.cpp
  llvm/include/llvm/BinaryFormat/Dwarf.def
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCDwarf.h
  llvm/include/llvm/MC/MCStreamer.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCStreamer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152708.530478.patch
Type: text/x-patch
Size: 84845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230612/2052012c/attachment-0001.bin>


More information about the cfe-commits mailing list