This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][NativePDB] Let native pdb use class layout in debug info.
ClosedPublic

Authored by zequanwu on Sep 22 2022, 6:28 PM.

Details

Summary

Before, class layout in native pdb is not hooked up in here.
This changes hooked it up by refactoring SymbolFileNativePDB and PdbAstBuilder.
PdbIndex (corresponds to a single pdb file) is removed from PdbAstBuilder, so it
can only be accessed via SymbolFileNativePDB and we can construct PdbAstBuilder
with just TypeSystemClang.

Diff Detail

Event Timeline

zequanwu created this revision.Sep 22 2022, 6:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 6:28 PM
zequanwu requested review of this revision.Sep 22 2022, 6:28 PM
Herald added a project: Restricted Project. · View Herald Transcript

It's not clear to me how much of this patch is pure refactoring, and how much of it is adding new features. It would have been better to split that out into two patches.

I see some layout handling code in UdtRecordCompleter constructor, but that's just two lines of code. Is that it, or should I look elsewhere?

lldb/include/lldb/Symbol/TypeSystem.h
31–32

Uh-oh. This is definitely not an intuitive naming scheme. How about we keep this class in the lldb_private::npdb namespace? You can forward-declare it there just as well.

Layering-wise, this code here is pretty bad, but moving the parser declaration into the global namespace is not going to make that better. And then you can undo all of the namespacing churn in the patch.

zequanwu updated this revision to Diff 462555.Sep 23 2022, 11:08 AM

Seperate refactor and the chang that fix class layout.
This just hooks PdbAstBuilder to TypeSystem to use class layout from native pdb, but it's still broken because the layout bitsize is missing.

zequanwu marked an inline comment as done.Sep 23 2022, 11:11 AM

It's not clear to me how much of this patch is pure refactoring, and how much of it is adding new features. It would have been better to split that out into two patches.

I see some layout handling code in UdtRecordCompleter constructor, but that's just two lines of code. Is that it, or should I look elsewhere?

That change in UdtRecordCompleter is fixing the class layout bit size. I'll put it in a separate patch.

Now this patch just does refactoring and hooks PdbAstBuilder to TypeSystem to use class layout in native pdb.

labath accepted this revision.Sep 27 2022, 7:49 AM
This revision is now accepted and ready to land.Sep 27 2022, 7:49 AM