[llvm-dev] LLD PDB Lines zero number issue

Shi, Steven via llvm-dev llvm-dev at lists.llvm.org
Sat Jan 11 19:11:08 PST 2020

I checked the LLVM master code and find that the “-use-unknown-locations” option and its related logic is only supported for Dwarf debug info as below. These codes are missing in the Codeview side. It looks the “-use-unknown-locations” option logic is not complex, could we port the code logic into llvm\lib\CodeGen\AsmPrinter\CodeViewDebug.cpp as well? I’ve submitted a BZ for this requirment: https://bugs.llvm.org/show_bug.cgi?id=44522

llvm-project\llvm\lib\CodeGen\AsmPrinter\DwarfDebug.cpp :
static cl::opt<DefaultOnOff> UnknownLocations(
    "use-unknown-locations", cl::Hidden,
    cl::desc("Make an absence of debug location information explicit."),
    cl::values(clEnumVal(Default, "At top of block or after label"),
               clEnumVal(Enable, "In all cases"), clEnumVal(Disable, "Never")),
... ...
    // If user said Don't Do That, don't do that.
    if (UnknownLocations == Disable)

This issue blocks the LLVM toolchain debugging capability for UEFI firmware. Please help to add the support. Thank you in advance!


Steven Shi

From: Shi, Steven
Sent: Friday, January 10, 2020 9:43 AM
To: Martin Storsjö <martin at martin.st>; David Blaikie <dblaikie at gmail.com>
Cc: Reid Kleckner <rnk at google.com>; llvm-dev <llvm-dev at lists.llvm.org>; Rui Ueyama <ruiu at google.com>
Subject: RE: [llvm-dev] LLD PDB Lines zero number issue

Hi Martin,

I tried your suggestion of adding "-mllvm -use-unknown-locations=Disable" in the clang CC flag to build test case in my previous email, but it looks still not work in my side with llvm 9.0.0.  Could you give me some more advices? Do I need to use the master LLVM instead of the 9.0.0?

$ make -f makefile_clanglto_Oz

"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang" -g  -m64 -mcmodel=small -target x86_64-unknown-windows -gcodeview -mllvm -use-unknown-locations=Disable -flto -Oz -c -o main.obj  main.c

"nasm" -f win64 -o assembly.obj assembly.nasm

"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-lib" /OUT:main.lib main.obj

"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-lib" /OUT:assembly.lib assembly.obj

"/home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/lld-link" /OUT:main.dll /Machine:X64 /DLL /ENTRY:main /DEBUG:GHASH /lldmap main.lib assembly.lib

$ /home/jshi19/llvm/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/llvm-pdbutil dump -l main.pdb



Mod 0000 | `assembly.obj`:

Mod 0001 | `/home/jshi19/llvm/wrongcode/lld-link5/lto.tmp`:

/home/jshi19/llvm/wrongcode/lld-link5/main.c (MD5: 5F82BB79FE2DA0B0549B784CFDC37D05)

  0001:00000004-0000001E, line/addr entries = 5

     3 00000004 !    0 00000008 !    5 0000000D !    0 00000012 !    9 00000017 !


Steven Shi

> -----Original Message-----

> From: Martin Storsjö <martin at martin.st<mailto:martin at martin.st>>

> Sent: Friday, January 10, 2020 5:00 AM

> To: David Blaikie <dblaikie at gmail.com<mailto:dblaikie at gmail.com>>

> Cc: Shi, Steven <steven.shi at intel.com<mailto:steven.shi at intel.com>>; Reid Kleckner <rnk at google.com<mailto:rnk at google.com>>;

> llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>

> Subject: Re: [llvm-dev] LLD PDB Lines zero number issue


> On Thu, 9 Jan 2020, David Blaikie via llvm-dev wrote:


> > +rnk who works on COFF debugging things.

> >

> >  My understanding is that this has nothing to do with the linker - but is a

> > function of LLVM optimizations creating line zero debug locations. I believe

> > rnk & folks have disabled line zero emission for CodeView debug info in

> some

> > manner - perhaps that needs a flag? or Steven hasn't got a release with

> that

> > change in it?


> I think I've run into that with dwarf as well, and there AFAIK it can be

> gotten rid of by adding "-mllvm -use-unknown-locations=Disable".


> // Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200112/197f9ec7/attachment-0001.html>

More information about the llvm-dev mailing list