[PATCH] D74923: [DebugInfo]: Do not start parsing macinfo/macinfo.dwo if the section's are empty.
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 12:38:30 PST 2020
SouraVX added a comment.
In D74923#1885240 <https://reviews.llvm.org/D74923#1885240>, @dblaikie wrote:
> Does this matter? "parsing" an empty section would be successfully parsing zero contributions & dumping nothing. That seems like a fine implementation & avoids needing this special case to check the section size first.
Sort of, consider this for a moment --
First we try to parse macinfo --- which for now is empty. assume
then `Macro` is constructed due to this call.
const DWARFDebugMacro *DWARFContext::getDebugMacinfo() {
if (Macro)
return Macro.get();
DWARFDataExtractor MacinfoData(*DObj, DObj->getMacinfoSection(), isLittleEndian(),
0);
Macro.reset(new DWARFDebugMacro());
Macro->parse(*this, MacinfoData, &Offset);
return Macro.get();
Now after wards we try to parse/dump macro section using mostly similar function then,
const DWARFDebugMacro *DWARFContext::getDebugMacro() {
if (Macro) -- since this is constructed previously, function call will return from here it self. hence no contents dumped
return Macro.get();
DWARFDataExtractor MacroData(*DObj, DObj->getMacroSection(), isLittleEndian(),
0);
...
BTW, in current implementation, My checks are heavy or the empty Macro construction/parsing/dumping is heavy ??
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74923/new/
https://reviews.llvm.org/D74923
More information about the llvm-commits
mailing list