Restore StackOverflow error message for repeated frames (#39930)
Fixes backtrace printing to display the number of times a frame is
repeated, if there is a frame that's duplicated several times.
```julia
julia> function foo() foo() end
foo (generic function with 1 method)
julia> foo()
ERROR: StackOverflowError:
Stacktrace:
[1] foo() (repeats 79984 times)
@ Main ./REPL[16]:1
```
Fixes #37587.
Co-authored-by: Nathan Daly <nhdaly@gmail.com>