markw
markw

Reputation: 321

How to get Scala shell call stack-trace

I'm working interactively from the Scala shell, and am wondering how I can get the call stack-trace of a command (which doesn't throw an exception)

Thanks!

Upvotes: 0

Views: 897

Answers (2)

chengpohi
chengpohi

Reputation: 14217

You can use Ctrl-\ to run to dump, like:

println("Hello") //Use Ctrl - / to run
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.71-b15 mixed mode):
"process reaper" #28 daemon prio=10 os_prio=31 tid=0x00007ff35f8ad000 nid=0x130f waiting on condition [0x00007000000be000]
   java.lang.Thread.State: TIMED_WAITING (parking)
   ...

Upvotes: 1

Fabian Schmitthenner
Fabian Schmitthenner

Reputation: 1706

just use (new RuntimeException).getStackTrace (no need to throw Exception).

Upvotes: 1

Related Questions