Re: [Haskell-cafe] Decorating exceptions with backtrace information

Ben Gamari <[email protected]>
Newsgroups gmane.comp.lang.haskell.ghc.devel,gmane.comp.lang.haskell.glasgow.user,gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
Henning Thielemann <[email protected]> writes:

> On Fri, 8 May 2020, Niklas Hambüchen wrote:
>
>> On 5/8/20 7:32 PM, Henning Thielemann wrote:
>>
>>> Can someone please give me examples where current state lacks
>>
>> * Currently stack traces are not printed, so users cannot forward them 
>> to the developer, even if both the users and the developers would like 
>> that.
>
> We are talking about the HasCallStack stack traces, yes?
> How is their emission addressed by extending exceptions with stack
> traces?

HasCallStack stack traces are one type of backtrace that the proposal
supports. However, it's not the only (nor is it even the most useful
sort, in my opinion).

Other mechanisms include cost center stacks from the cost-center
profiler and native stack unwinding.

>
>> * Developers cannot easily produce stack traces do debug unintended 
>> exceptions.
>
> What are "unintended exceptions"?
> What is an example of an "unintended exception"?

For instance,

 * Somewhere deep in my code a colleague used `fromJust` due to a
   miscommunicated invariant

 * Somewhere in my system a `writeFile "tmp" $ repeat 'a'` failed due to
   filling the disk

 * Somewhere in my system I have a partial pattern match in a module
   which was compiled without -Wall

 * Somewhere in my system I `div` by zero due to lack of input
   validation

 * I use a record selector on a sum.

 * A logic error results in an assertion failure deep in my program, but
   it's unclear which path my program took to arrive at the assertion

This list could go on and on...

Currently the proposal does not cover asynchronous exceptions but it
wouldn't be particularly hard to extend it in this direction. This would
allow far better reporting of heap/stack overflows and MVar deadlocks
(which are particularly hard to debug at the moment).

Cheers,

- Ben

_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
signature.asc (application/pgp-signature, 487 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEmwpsh4C13+CdDZRjcVB86Evun78FAl61ongACgkQcVB86Evu
n78ohQgA3lOkoO7HYJDjdBgNZPvuMDTuKCvtiKmBtSb61uQRmg2Z0wCNEI9lE2nA
/umm1//6O4WugOPqFyh0ZNpaTXLA+NKnvvDIDDIWH3AWUOVEacrj0zFZoxnmkvqI
koYWZ6lAtWzE6mC+ip5nU4rou+x+K/V+35kmJlaPrHEJJTIpyGsD9E+CGf1XkPuZ
zBF0i8n15sbj1FWTPypwnvvK4AxtVihdYwi2FCR18zDIiF8hjPxVKUNi3luQLOKs
ZmFd5SNvF6kkukbARZXzrWRM3KzyOZC1NkGPdta4Vv+e3wJDc9F3MEs7C/uYF1kb
FgtFjxcF3rDaJWj4lPmzrp5KrrpjBQ==
=KUIt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.