Add API to filter named gems from backtraces.

Fixes #1554.