This prevents for having an assert instead of just returning an empty DIEsForAddress object.
Testing that the program doesn't crash is a fairly broad test (what does it do instead? It could print all sorts of odd/weird/incorrect output while still passing this test) - could you test for the specific output that was hidden behind this crash previously?
Hmm, could you help me understand under what conditions the crash occurs? And why printing the compile_unit is the correct behavior here?
In other cases I've just tested, passing lookup a value it can't find - had a simple file with two functions ([0-6) and [16-22)). Querying for zero actually seems (probably unrelatedly) buggy - it prints all 3 DIEs (the CU and both subprograms).
0: prints all 3 DIEs
Hmm, I suppose, then, it makes sense to print the CU - because the address is within the range of the CU but not within the range of anything inside of it.
Maybe add a "CHECK-NOT: DW_TAG" at the end of the checks?
(& not sure - but perhaps this test would be easier to understand if it had its own test file, rather than using a larger/more complicated one from another test)
I think you're right. As the address only belongs to the compile unit, this is all we want to be printed here.
Do you really think that we need a separate file. The bug pretty much describes itself I think.