On Fri, 29 May 2015 15:43:19 +0200, Yao Qi wrote: > Jan Kratochvil writes: > > The terminology seems bogus there. > > > > "partially ambiguous" was meant the chain: > > main -> a -> -> d > > An intersection of all possible chains. > > Sounds like "partially ambiguous" is equivalent to "ambiguous". Yes, probably, I am not sure how to call it all myself. > If that is right, the assert below is too strict, isn't? Yes, it is too strict, this is why I agree with the fix by Andreas. > /* See call_site_find_chain_1 why there is no way to reach the bottom callee > PC again. In such case there must be two different code paths to reach > it, therefore some of the former determined intermediate PCs must differ > and the unambiguous chain gets shortened. */ > gdb_assert (result->callers + result->callees < result->length); > > > but that doe snot matter). Consequently its elements from the middle are > > being removed and there remains only some few unambiguous top and > > bottom ones. > > If there is no call sites removed from the chain during the intersection, > CALLERS + CALLEES == LENGTH, right? Just I expected there always has to be some site removed from the chain. I do not find obvious it does not have to. But maybe someone else finds it obvious. > in function chain_candidate, > result->length is set by the length of a chain. If this chain is the > shortest one, CALLERS + CALLEES == LENGTH otherwise, > CALLERS + CALLEES < LENGTH. Is it right? It is right now. But when one does not think about self-tail-calls then even the shortest one will get one frame removed. > If so, we need to relax the > condition in the assert and update the comments. Yes, attached with updated comment. > > I did not realize that there can be self-tail-call: > > main(0x100) -> a(0x200) -> d(0x400) > > main(0x100) -> a(0x280) -> a(0x200) -> d(0x400) > > which intersects to: > > main(0x100) -> ? -> a(0x200) -> d(0x400) > > And so if the first chain was chosen the > > main(0x100) -> a(0x200) -> d(0x400) > > then the final intersection has callers+callees==length. > > What are the definitions of CALLERS, CALLEES, top and bottom? given this example? top=CALLERS=main(0x100), therefore 1 bottom=CALLEES=d(0x400), therefore 1 top = topmost, where you can go by GDB "up" commands, also called "prev" in struct frame_info. bottom = bottommost, where you can go by GDB "down" commands, also called "next" in struct frame_info. Jan