Assertion failure in debugging code

Carl Worth cworth at cworth.org
Fri Aug 24 12:26:08 PDT 2012


José Fonseca <jose.r.fonseca at gmail.com> writes:
> These regions appear to be merely contiguous and not really intersect.

Good, that's what I thought.

> It looks like there is a bug in either of these functions calls
>
>     RegionMap::iterator start = lowerBound(address);
>     RegionMap::iterator stop = upperBound(address + size);

OK. I looked at those carefully for any bugs, but they actually look
correct to me.

> as they should return iterator such that start == stop, that is, an
> empty set.

I think the bug is in the assumption you make in the above statement.

Assume the region map contains a single range and we are attempting to
add the immediately previous, contiguous range.

In this case, lowerBound(address) will behave as documented:

	// Iterator to the first region that contains the address, or
	/  the first after

and will point to the existing range, (the "first after" since no range
contains 'address').

Then, upperBound(address+size) will point to the position just after the
existing range.

Therefore, there's a non-empty set for the loop to iterate over, even
though no existing range intersects the new range being added.

So perhaps what is desired is something like the patch below?

-Carl

PS. Having just applied this patch, re-running the trace caused a GPU
hang for me. I believe that's unrelated, (since previously I was able to
run the entire trace if I just compiled with NDEBUG=1). I'll reboot now
to verify that.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: region.patch
Type: text/x-diff
Size: 1044 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20120824/8774c431/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20120824/8774c431/attachment.pgp>


More information about the apitrace mailing list