Skip to content

Commit

Permalink
Add more information when assertion ((size_t)pos < current_exceptions…
Browse files Browse the repository at this point in the history
….size()) fails in RoxorVM::pop_current_exception

Fixes https://www.macruby.org/trac/ticket/1446
  • Loading branch information
msabramo committed Feb 2, 2012
1 parent 53b78ca commit c6375ae
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3597,6 +3597,22 @@ RoxorVM::pop_current_exception(int pos)
return;
}

if (!((size_t)pos < current_exceptions.size()))
{
fprintf(stderr,
"RoxorVM::pop_current_exception (%s:%d) - "
"Warning: Assertion about to fail: "
"((size_t)pos < current_exceptions.size()); pos = %d; "
"current_exceptions.size() = %d\n",
__FILE__, __LINE__, pos, (int)current_exceptions.size());
for (std::vector<VALUE>::iterator iter = current_exceptions.begin(); iter != current_exceptions.end(); iter++)
{
VALUE exc = *iter;
fprintf(stderr,
"current_exceptions[%d]: \"%s\"\n",
pos, RSTRING_PTR(rb_inspect(exc)));
}
}
assert((size_t)pos < current_exceptions.size());

std::vector<VALUE>::iterator iter = current_exceptions.end() - (pos + 1);
Expand Down

0 comments on commit c6375ae

Please sign in to comment.