[PATCH] D34126: [PDB] Add a module descriptor for every object file

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 08:14:33 PDT 2017


rnk added inline comments.


================
Comment at: lld/test/COFF/pdb-lib.s:3-4
+# RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o foo.obj
+# RUN: grep BAR[:] %s | sed -e 's/.*BAR[:] //' | \
+# RUN:    llvm-mc -filetype=obj -triple=i686-windows-msvc - -o bar.obj
+# RUN: llvm-lib bar.obj -out:bar.lib
----------------
zturner wrote:
> I know this keeps it all in one file, but sed on the input file is kind of a huge hack, what about putting the code in an input file under Inputs/?
> 
> Maybe in the future we could remove dependency on sed by making a tool which essentially strips a file of everything but a single label.  Like:
> 
> ```
> llvm-strip --keep-label=BAR --remove-label-headers < %s > bar.asm
> ```
I'd like something like llvm-strip, or maybe llvm-split, which splits something like this up into multiple inputs:
```
// ==> file_a.h <==
struct Foo { ... };
extern Foo my_global;

// ==> file_b.c <==
#include "file_a.h"
Foo my_global;

// ==> file_c.c <==
#include "file_a.h"
int use_global() { return my_global.x; }
```

That's basically the format people use to file bugs. And then you get editor syntax highlighting that works.

Let's just use Inputs for now.


================
Comment at: lld/test/COFF/pdb-lib.s:12
+# CHECK-NEXT:     Name: {{.*pdb-lib.s.tmp[/\\]foo.obj}}
+# CHECK-NEXT:     Debug Stream Index: 9
+# CHECK-NEXT:     Object File Name: {{.*pdb-lib.s.tmp[/\\]foo.obj}}
----------------
zturner wrote:
> I'd remove anything fragile like debug stream indices.
OK, I'll remove that. I want to keep the line info, source file name, etc, since these are .s files without any .debug$S data and those *should* remain zero.


================
Comment at: llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp:296
+  memset(&SC, 0, sizeof(SC));
+  SC.ISect = (uint16_t)~0U; // This represents nil.
+  SC.Off = SecHdr->PointerToRawData;
----------------
zturner wrote:
> Is this correct?  Shouldn't it be the index of the section?
I haven't figured out what it's supposed to be yet, but zero isn't correct, because it's not the null representation used in microsoft-pdb.

I did some experiments but I wasn't able to nail it down by the end of the day, so I figured I'd send what I have and we can improve on it later.


https://reviews.llvm.org/D34126





More information about the llvm-commits mailing list