labath added a comment.

Thanks. I think we're getting closer, and I think we can start talking about a 
more direct way to test this behavior.

This is now definitely, as Adrian called it, a DWARF peculiarity, and so an 
assembly file with hard-coded dwarf would be much better. Can you take a look 
at the files in `test/Shell/SymbolFile/DWARF` and create something similar. It 
don't think you'll need very complicated dwarf -- it should be sufficient to 
have two compile units with one function each, and set one of the function's 
DW_AT_low_pc to zero. The test command could be something like running 
`lldb-test symbols %t -find=function -name=<foo>` and checking that it returns 
just a single entry...



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2358-2360
+    if (die.GetAttributeValueAsAddress(DW_AT_low_pc, /*fail_value=*/1) == 0 &&
+        !GetObjectFile()->GetModule()->HaveSectionAtAddressZero())
+      continue;
----------------
I think this check should go into the `ResolveFunction` call, as that function 
already does some validation of the function address. 

And I still believe that we shouldn't special case address zero, but rather 
just reject any address that does not map onto a known section (it should be 
sufficient to replace the `addr.IsValid()` check in `ResolveFunction` with 
`addr.IsSectionOffset()`). Functions not mapping to any sections are going to 
be mostly useless anyway, because the first thing that lldb does when resolving 
an address, is to resolve the module it should search in. It uses the section 
list to do that, and so if the function does not belong to any section, lldb 
will never find it, as it will not even get around to asking the Module about 
it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71487/new/

https://reviews.llvm.org/D71487



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to