Comment by bmn__

Comment by bmn__ 6 months ago

3 replies

> [Lambdas] get non-descriptive, auto-generated names. When I look at call stack of a crash I can’t map the auto-generated closure name to a function in my code.

Well, HN lazyweb, how do you override the stupid name in C++? In other languages this is possible:

  $ node --trace-uncaught -e 'const c = function have_name() {throw null}; c()'

  $ perl -d:Confess -MSub::Util=set_subname -E 'my $c = sub() {die}; set_subname have_name => $c; $c->()'
account42 6 months ago

Better solution would be to map to a source location (filename and line) instead.

  • eddd-ddde 6 months ago

    Not necessary tho, the function already exists in the binary and already has a symbol. All you need is some compiler/language feature to change that symbol.