[Lldb-commits] [PATCH] D123743: [lldb] Show the DBGError if dsymForUUID can't find a dSYM

2022-04-28 Thread Stephen Tozer via Phabricator via lldb-commits
StephenTozer added inline comments.



Comment at: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej:1
+***
+*** 337,343 

This file was presumably included by accident?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123743/new/

https://reviews.llvm.org/D123743

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2023-06-12 Thread Stephen Tozer via Phabricator via lldb-commits
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 
 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 
) 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

Index: llvm/lib/MC/MCStreamer.cpp
===
--- llvm/lib/MC/MCStreamer.cpp
+++ llvm/lib/MC/MCStreamer.cpp
@@ -268,6 +268,18 @@
   Discriminator);
 }
 
+void MCStreamer::emitDwarfLogicalLocDirective(
+unsigned FileNo, unsigned Line, unsigned Column, unsigned Flags,
+unsigned Isa, unsigned Discriminator, StringRef FileName, unsigned Context,
+StringRef FunctionName) {
+  getContext().addCurrentDwarfLogicalLoc(FileNo, Line, Column, Flags, Isa,
+ Discriminator, Context, FunctionName);
+}
+
+void MCStreamer::emitDwarfActualLocDirective(unsigned Line, unsigned Flags) {
+  getContext().setCurrentDwarfActualLoc(Line, Flags);
+}
+
 MCSymbol *MCStreamer::getDwarfLineTableSymbol(unsigned CUID) {
   MCDwarfLineTable &Table = getContext().getMCDwarfLineTable(CUID);
   if (!Table.getLabel()) {
Index: llvm/lib/MC/MCDwarf.cpp
===
--- llvm/lib/MC/MCDwarf.cpp
+++ llvm/lib/MC/MCDwarf.cpp
@@ -92,28 +92,69 @@
 // a line entry made for it is made.
 //
 void MCDwarfLineEntry::make(MCStreamer *MCOS, MCSection *Section) {
-  if (!MCOS->getContext().getDwarfLocSeen())
-return;
+  uint16_t VersionNumber = MCOS->getContext().getDwarfVersion();
+  // If we're emi

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

2023-06-13 Thread Stephen Tozer via Phabricator via lldb-commits
StephenTozer added a comment.

In D152708#4414402 , @dblaikie wrote:

> It is unfortunate to hear that TLLT are a significant size increase, though 
> not entirely surprising - it's a bunch of extra info to encode. I'll be glad 
> to have this example to experiment with.

For what it's worth, we haven't tested this with any larger programs, so this 
is more of a rough estimate of size, but the .debug_line section increased in 
size on the order of 50% for our small test cases. On the other hand, I think 
that in larger programs the .debug_line section is likely be significantly 
smaller than the .debug_info section anyway, so if you are interested in 
producing inline frames without using .debug_info it is probably an improvement 
in most respects - as an example with a single-source input, `flops.c` (taken 
from the LLVM test suite repo), the .debug_line section increased from 3338 to 
4758 bytes, and the overall size of the DWARF output from 9467 to 10893.

> Are there any known (or vague/unknown) limitations on the implementation with 
> respect to the actual output/on-disk representation?

Possibly, but not outside of the proposal itself - this patch was written over 
the span of 4 days so doubtless there are inefficiencies in the code itself and 
there may be bugs in the output (especially if you try it on a larger 
codebase), but in theory the output follows the spec faithfully and shouldn't 
be wasting up space. With that said, the main cause of the size increase isn't 
really the additional information, but the fact that the TLLT does repeat 
itself a lot by design; generally speaking most instructions are not inlined 
callsites, and so the additional information for those lines (the context and 
subprogram fields) has a much smaller impact on size than the fact that we are 
emitting the `(InstructionAddress, SourceLocation)` pair twice for every 
instruction.

We didn't dig deeper into why the representation needs to be split into two 
separate line number programs rather than either a single line table with some 
additional column to convey the Instruction->SourceLocation attribution, or 
keeping two line tables but using a single line number program that can either 
emit Logical and Actual rows simultaneously. Either of these methods would 
reduce the repetition.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152708/new/

https://reviews.llvm.org/D152708

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70644: [DebugInfo] Support for DW_OP_implicit_pointer (llvm.dbg_derefval)

2019-12-04 Thread Stephen Tozer via Phabricator via lldb-commits
StephenTozer added inline comments.



Comment at: llvm/docs/SourceLevelDebugging.rst:270
+
+An `llvm.dbg.derefval` intrinsic is usefull when location which the variable
+points to is optimized out, but the dereferenced value is known.

Correct usefull -> useful


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70644/new/

https://reviews.llvm.org/D70644



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits