[all-commits] [llvm/llvm-project] 15f902: [lldb/DWARF] Respect member layout for types parse...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Wed Oct 2 02:14:04 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 15f90203bcbc685e8d63a7e52e60adff02bf5499
https://github.com/llvm/llvm-project/commit/15f90203bcbc685e8d63a7e52e60adff02bf5499
Author: Pavel Labath <pavel at labath.sk>
Date: 2024-10-02 (Wed, 02 Oct 2024)
Changed paths:
M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
A lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_declaration-unusual-layout.s
M lldb/test/Shell/SymbolFile/DWARF/x86/DW_AT_declaration-with-children.s
Log Message:
-----------
[lldb/DWARF] Respect member layout for types parsed through declarations (#110648)
LLDB code for using the type layout data from DWARF was not kicking in
for types which were initially parsed from a declaration. The problem
was in these lines of code:
```
if (type)
layout_info.bit_size = type->GetByteSize(nullptr).value_or(0) * 8;
```
which determine the types layout size by getting the size from the
lldb_private::Type object. The problem is that if the type object does
not have this information cached, this request can trigger another
(recursive) request to lay out/complete the type. This one, somewhat
surprisingly, succeeds, but does that without the type layout
information (because it hasn't been computed yet). The reasons why this
hasn't been noticed so far are:
- this is a relatively new bug. I haven't checked but I suspect it was
introduced in the "delay type definition search" patchset from this
summer -- if we search for the definition eagerly, we will always have a
cached size value.
- it requires the presence of another bug/issue, as otherwise the
automatically computed layout will match the real thing.
- it reproduces (much) more easily with -flimit-debug-info (though it is
possible to trigger it without that flag).
My fix consists of always fetching type size information from DWARF
(which so far existed as a fallback path). I'm not quite sure why this
code was there in the first place (the code goes back to before the
Great LLDB Reformat), but I don't believe it is necessary, as the type
size (for types parsed from definition DIEs) is set exactly from this
attribute (in ParseStructureLikeDIE).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list