Page MenuHomePhabricator

Ignores functions that have a range starting outside of a code section
ClosedPublic

Authored by aadsm on Sep 4 2020, 5:03 PM.

Details

Summary

This is a similar patch to https://reviews.llvm.org/D87172. Greg said we should also do it for functions.

Diff Detail

Event Timeline

aadsm created this revision.Sep 4 2020, 5:03 PM
Herald added a project: Restricted Project. · View Herald Transcript
aadsm requested review of this revision.Sep 4 2020, 5:03 PM
clayborg added inline comments.Sep 4 2020, 5:27 PM
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
2269–2272

This is a bit more expensive than comparing against the m_first_code_address like we do in D87172. We could just modify the "if" statement on line 2256:

if (lowest_func_addr >= m_first_code_address && 
    lowest_func_addr != LLDB_INVALID_ADDRESS &&
    lowest_func_addr <= highest_func_addr) {
aadsm added inline comments.Sep 4 2020, 6:35 PM
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
2269–2272

yeah, I was not expecting to matter that much since it's only 2 function calls?

aadsm updated this revision to Diff 290113.Sep 5 2020, 5:04 PM

Check lowest code address instead of checking if the section is code.

clayborg accepted this revision.Sep 14 2020, 3:40 PM
This revision is now accepted and ready to land.Sep 14 2020, 3:40 PM
aadsm updated this revision to Diff 301503.Oct 28 2020, 6:55 PM

Rewrote the test in lit.

I had to do it in an non standard way. It seems that lldb will exit with an error code if you do -b -o of a command that doesn't "work", (e.g.: image lookup finds nothing). Since lit runs this with set -o pipefail it will fail the FileCheck as well. To get around that I did echo ``, a bit lame but works.

echo `` is funny and creative, but I doubt it will work on windows. :) The way that other tests deal with that is they put the commands to run into a file, and then run

%lldb -o 'settings set interpreter.stop-command-source-on-error false' -s commands

For the command file, we have several options on how to create it:

  • a separate Input/... file
  • create it in the test with a sequence of echo commands
  • use the llvm split-file utility to create it automatically from a single file
aadsm updated this revision to Diff 302150.Nov 1 2020, 8:44 AM

Used -s to feed commands and disabled errors when interpreting them

labath accepted this revision.Nov 2 2020, 12:59 AM
labath added inline comments.
lldb/test/Shell/SymbolFile/DWARF/function-entries-invalid-addresses.yaml
6–13

Now that the command interpreter doesn't stop when it encounters errors, you can merge these two checks into one. You can check for the commands in order to "divide" the output:

# CHECK-LABEL: image lookup -F main
# CHECK: 1 match found
# CHECK-LABEL: image lookup -F foo
# CHECK-NOT: 1 match found

(CHECK-LABEL behaves like a regular CHECK, only it also gives a hint to FileCheck that the checks are independent -- so it will e.g. still try to match the second one if the first one fails).

aadsm updated this revision to Diff 303746.Nov 8 2020, 6:32 PM

Merged the 2 run/checks into one

This revision was landed with ongoing or failed builds.Nov 9 2020, 8:26 AM
This revision was automatically updated to reflect the committed changes.

When I landed this I got test errors on the windows machine (the same tests pass on the other machine). I tried to repro this on 2 different machines I was able to get access but to no avail.
These are the failing tests: http://lab.llvm.org:8011/#/builders/83/builds/644 but when I ran lldb-test on the find-basic-function the output was what I would expect so not really sure how I can figure this out. Any ideas?

You can ask the bot owner (@stella.stamenova) if you have problems reproducing/understanding the failure.