[PATCH] Refactor llvm-symbolizer to support using PDB instead of DWARF.

Alexey Samsonov vonosmas at gmail.com
Mon Apr 20 21:22:26 PDT 2015

In http://reviews.llvm.org/D9111#158835, @zturner wrote:

> There had been significant discussion about producing a Format agnostic
>  debug info interface, but we all kind of decided that it would be
>  impossible in the general case, or at the very least extremely difficult.
>  Most situations don't require consuming both types of debug info so we
>  decided it would be best to defer this kind of abstraction to the places
>  that needed it.
> We might be able to move a few specific utility classes to a common level,
>  but I don't think it would work in the general case.
> The context, session information, way that you make queries against the
>  debug info are fundamentally different.

Fair enough. So, it means that, in particular, DIContext abstraction (and especially stuff
like DIDumpType) just doesn't work, and we should get rid of it and leave just DWARFContext and
friends. Then we can implement PDBContext in DebugInfoPDB library, that would have its own methods to
query debug info, and dynamically choose between these objects in llvm-symbolizer implementation.

However, for not I'm not convinced about DILineInfo. I haven't seen suggested
SymbolizationContextPDB::getLineInfoForAddress implementation yet, but probably it would be easy
enough to create DILineInfo structure, fill four its fields and return it, than create a class hierarchy
with a bunch of virtual functions.

We can discuss the alternatives in person tomorrow to save cycles.

Comment at: tools/llvm-symbolizer/SymbolizationContext.h:30
@@ +29,3 @@
+  virtual std::string getFileName() const = 0;
+  virtual std::string getFunctionName() const = 0;
Any specific reason why you wouldn't be able to use plain DILineInfo struct to hold data parsed from PDB (if its declaration would be visible?)

Comment at: tools/llvm-symbolizer/SymbolizationContextDWARF.cpp:23
@@ +22,3 @@
+static const std::string kDILineInfoBadString = "<invalid>";
This should probably be moved to DILineInfo definition.



More information about the llvm-commits mailing list