Opened 4 years ago

Last modified 3 years ago

#10303 new task

Make it easier to print stack traces when debugging GHC itself

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.1
Keywords: Cc: simonmar
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

As suggested in the mailing list, GHC should have better support for printing its own stack trace when profiling is enabled.

This ticket is to track progress toward this goal.

There are a few moving parts:

  • Just having pprTrace use traceStack is a bad idea, because a profiled compiler will spew lots and lots and lots of output. Instead, I propose a new pprTraceStack :: String -> SDoc -> a -> a.
  • Currently, ASSERT will print a stack trace, but it's sometimes the wrong one. ASSERT throws an error; if this error is caught and re-thrown, the stack trace is at the re-throw. Instead, it should be at the origin.
  • Is it worth adding a new mode in build.mk that enables profiling, DEBUG, and -fprof-auto, just to get good stack traces?

Change History (5)

comment:1 Changed 4 years ago by goldfire

Owner: set to goldfire

I can take a look at this in due course. But if you're itching to do this sooner, by all means take ownership.

Last edited 4 years ago by goldfire (previous) (diff)

comment:2 in reply to:  description Changed 4 years ago by rwbarton

Replying to goldfire:

  • Is it worth adding a new mode in build.mk that enables profiling, DEBUG, and -fprof-auto, just to get good stack traces?

Yes.

(Maybe in the future we'll be able to use DWARF debugging information to get this information in a standard build, but let's not let that keep us from implementing this now.)

comment:3 Changed 4 years ago by simonmar

Cc: simonmar added

comment:4 Changed 3 years ago by mpickering

Owner: changed from goldfire to mpickering

comment:5 Changed 3 years ago by mpickering

Owner: mpickering deleted
Note: See TracTickets for help on using tickets.