This is an archive of the discontinued LLVM Phabricator instance.

Add a few basic tests for llvm-pdbdump
ClosedPublic

Authored by zturner on Feb 15 2015, 4:16 PM.

Details

Summary

This is my first time writing a lit test, so I'm not sure if I really did this right.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 19992.Feb 15 2015, 4:16 PM
zturner retitled this revision from to Add a few basic tests for llvm-pdbdump.
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added reviewers: chandlerc, dblaikie.
zturner added a subscriber: Unknown Object (MLST).
dblaikie edited edge metadata.Feb 15 2015, 4:45 PM

Might be helpful to show the full (or at least abbreviated) output & explain what you're trying to test for/against - since I haven't actually seen the output of pdbdump, it's hard to tell what the tests would catch/avoid/etc.

test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp
6 ↗(On Diff #19992)

add the missing newline here

test/DebugInfo/PDB/Inputs/symbolformat.cpp
1 ↗(On Diff #19992)

do you need stdio here? It'd be best to have standalone examples as much as possible.

zturner updated this revision to Diff 20221.Feb 18 2015, 2:12 PM
zturner edited edge metadata.

Fixed suggested issues. To address the issue of displaying the output format so you can see what it looks like, I opted to instead just include the full output as part of the test. If someone recompiles the files, they will need to change these. I could have used a regex as before to make the lines independent of address, but I felt like it detracted from the readability of the test.

zturner updated this revision to Diff 20222.Feb 18 2015, 2:15 PM

The last diff didn't generate correctly for some reason. Try this one.

Bump. The options being specified on the command line might be a little confusing. I actually have a followup patch which drastically simplifies the options and probably will make reading these tests easier. But I was goign to commit that after this (as the patch updates the tests and output as well).

In any case, the basic idea of pdbdump-symbol-format.test is to dump symbol entries from object files. Since we don't know what the internal format of PDB is, I wrote the dumper to dump entries in ways that would make it easier for people to understand what the information in the PDB represents *semantically*, as opposed to physically. This is useful for someone writing a debugger, for example, so that they can know at a high level what kind of information they can expect to get from the PDB.

In this example, you can see that the PDB knows about 2 object files, symbolformat.obj and symbolformat-fpo.obj. For each one, all the symbols are dumped, which consist mostly of functions due to the fact that the original source code also consists mostly of functions. RVAs of the functions are dumped as well, in a format like [start+prologue_length - end-epilogue_length]

RVA - relative virtual address (i.e. offset from the beginning of the
module, so that when it is loaded at runtime, you add that value to the
module load address to get the absolute virtual address of the symbol). I
thought this was a universal term, but I guess not :) What does DWARF call
this?

This revision was automatically updated to reflect the committed changes.

I had to revert this because of some failing bots.

Examples:
http://lab.llvm.org:8011/builders/llvm-s390x-linux1/builds/13731/steps/test-llvm/logs/stdio
http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/15858/steps/test-llvm/logs/stdio

Although there were a few others. Now obviously the test should register as unsupported on those platforms, but they're not. I tested this on both my Linux and my Mac workstations and the tests correctly didn't run due to being unsupported. But I'm not sure how to diagnose the problem further of why they are not getting flagged as unsupported here.

HAVE_DIA_SDK is only set to 1 under an "if (MSVC)" check in the CMake, so I've no idea why it might be getting set here, or if something else might be going on. David, Chandler, any ideas how to figure this out?