[Lldb-commits] [PATCH] D88483: Add possibility to get module from SBType

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 29 14:32:27 PDT 2020


jingham added a comment.

In D88483#2363075 <https://reviews.llvm.org/D88483#2363075>, @fallkrum wrote:

> @JDevlieghere @jingham api test failed after my commit:
> http://lab.llvm.org:8011/#/builders/68/builds/1040
> Had no such an error on my computer, please help to figure out what went wrong.

The test is failing because

  type_name = comp_unit.GetTypes().GetTypeAtIndex(0).GetName()

is returning an empty string.  I can't tell from the error whether that's because comp_unit is not valid in this case, or because GetTypeAtIndex(0) is not valid, or because for some reason this compile unit has an anonymous type injected as the first type in the CU.

You are also assuming that the compile units will come in order with main as the 0-th.  That seems reasonable, but there's no law about what order the compiler has to insert compile units into the debug information, so the CU at index 2 could also be the wrong CU.

Particularly when writing tests, I try never to chain calls together like this and instead to check each entity I care about as I get it.  Otherwise you get these "happens on a remote machine I can't access" failures and you can't tell from the failure site what was actually failing.

Can you rewrite the test to check that the comp_unit you get is valid and has the name you expected?  Then get the type and check that it is valid.  Then check its name.  If you make up that patch we can resubmit this change and the next time it fails you should get more information about why.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88483



More information about the lldb-commits mailing list