digitalmars.D - call traceback is indecipherable garbage
- forkit (31/31) Jan 25 2022 has anyone ever considered getting rid of the indecipherable
- rikki cattermole (4/21) Jan 25 2022 That's your call stack (addresses).
- forkit (5/9) Jan 25 2022 I'd rather have more options available to me:
- Steven Schveighoffer (4/19) Jan 25 2022 Catching an exception and handling it directly is exactly how you do
- forkit (8/12) Jan 25 2022 of course opening a non-existent file was an arbitrary example
- Steven Schveighoffer (7/22) Jan 25 2022 If you compile with debug symbols, you get an actual stack trace. (even
- forkit (9/12) Jan 25 2022 or better yet, just make an addition to the already existing
- forkit (3/7) Jan 25 2022 Why could argue, that it's already been caught ;-)
- H. S. Teoh (33/50) Jan 25 2022 Did you compile with debugging symbols, i.e., with -g?
- forkit (6/9) Jan 25 2022 Interesting. Thanks for mentioning that -g option.
- H. S. Teoh (15/18) Jan 25 2022 It's easy, just wrap your main() in a try-catch block:
- forkit (24/35) Jan 25 2022 great!
- frame (4/7) Jan 26 2022 There is currently an open bug which prevents a stack trace -
- WebFreak001 (18/29) Jan 26 2022 you could implement a custom _d_print_throwable:
- Dennis (6/10) Jan 26 2022 https://forum.dlang.org/post/m09gue$38e$1@digitalmars.com
- Steven Schveighoffer (5/45) Jan 25 2022 Regardless of the "correct" way to deal with this, I agree with you that...
- forkit (3/7) Jan 25 2022 You mean stop using Windows?
- Steven Schveighoffer (8/16) Jan 25 2022 No I mean, on Windows, is there no better thing to print out for a stack...
- zjh (2/3) Jan 25 2022 `Forum oriented programming`.
- forkit (5/5) Jan 26 2022 On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:
- rikki cattermole (3/11) Jan 26 2022 Here is where that would be implemented (I think anyway).
- H. S. Teoh (6/14) Jan 26 2022 [...]
- forkit (11/25) Jan 26 2022 will look into this. In the meantime, I can just comment out 2
- forkit (3/17) Jan 30 2022 https://github.com/dlang/DIPs/pull/222
- max haughton (2/22) Jan 30 2022 This should be a druntime PR
- kinke (14/27) Feb 04 2022 One can easily disable any exception traces via
- forkit (10/23) Feb 04 2022 Thanks. Very useful info :-)
- forkit (8/17) Feb 04 2022 oops. of course I meant:
- forkit (11/12) Feb 04 2022 this seems messy:
- H. S. Teoh (18/19) Feb 04 2022 version(debug) {} else {
- FeepingCreature (6/12) Jan 31 2022 I think this is not a good idea. This sounds like the sort of
- forkit (9/14) Jan 31 2022 so that 'gotcha' is easily solved.
- FeepingCreature (20/37) Jan 31 2022 I think you're coming at this with the model that the user can
- forkit (11/32) Jan 31 2022 A running program is unaffected.
- Siarhei Siamashka (6/15) Feb 01 2022 End-users are not supposed to decipher this nonsense. They are
- bauss (7/24) Feb 01 2022 I would much rather that you disable stacktraces rather than
- deadalnix (6/37) Jan 27 2022 You might want to share how you are compiling this. The detail
has anyone ever considered getting rid of the indecipherable garbage after ---- (or having some compile time option to not output it?) I don't want to see it. I sure don't want my end-users to see it either. / -- module test; import std; void main() { File f = File("nosuchfile"); } // -- Exit code is: 1 std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ---------------- 0x000000013FB5F836 0x000000013FB53423 0x000000013FB51269 0x000000013FB51057 0x000000013FB5ECB3 0x000000013FB5EB2F 0x000000013FB5EC1B 0x000000013FB5EB2F 0x000000013FB5EA56 0x000000013FB53171 0x000000013FB51094 0x000000013FBD2F68 0x0000000076F9556D in BaseThreadInitThunk 0x00000000771F372D in RtlUserThreadStart
Jan 25 2022
On 26/01/2022 3:20 PM, forkit wrote:std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ---------------- 0x000000013FB5F836 0x000000013FB53423 0x000000013FB51269 0x000000013FB51057 0x000000013FB5ECB3 0x000000013FB5EB2F 0x000000013FB5EC1B 0x000000013FB5EB2F 0x000000013FB5EA56 0x000000013FB53171 0x000000013FB51094 0x000000013FBD2F68 0x0000000076F9556D in BaseThreadInitThunk 0x00000000771F372D in RtlUserThreadStartThat's your call stack (addresses). It doesn't have the function name/module because you haven't compiled it in. If you don't want it, catch any exceptions that can be thrown.
Jan 25 2022
On Wednesday, 26 January 2022 at 02:22:53 UTC, rikki cattermole wrote:That's your call stack (addresses). It doesn't have the function name/module because you haven't compiled it in. If you don't want it, catch any exceptions that can be thrown.I'd rather have more options available to me: e.g: dmd -tracebackPrint=no myfile.d
Jan 25 2022
On 1/25/22 9:27 PM, forkit wrote:On Wednesday, 26 January 2022 at 02:22:53 UTC, rikki cattermole wrote:Catching an exception and handling it directly is exactly how you do this. Dmd can't have all the options to write code for you. -SteveThat's your call stack (addresses). It doesn't have the function name/module because you haven't compiled it in. If you don't want it, catch any exceptions that can be thrown.I'd rather have more options available to me: e.g: dmd -tracebackPrint=no myfile.d
Jan 25 2022
On Wednesday, 26 January 2022 at 02:31:25 UTC, Steven Schveighoffer wrote:Catching an exception and handling it directly is exactly how you do this. Dmd can't have all the options to write code for you. -Steveof course opening a non-existent file was an arbitrary example (and should be ignored). The garbage being output is really the focus of my question. At the very least, it should be removed in -release I think. I'd be interested in knowing how many (and who) actually make use of the output under the ------ part.
Jan 25 2022
On 1/25/22 9:40 PM, forkit wrote:On Wednesday, 26 January 2022 at 02:31:25 UTC, Steven Schveighoffer wrote:If you compile with debug symbols, you get an actual stack trace. (even in -release mode) Now, with proper spelunking tools, I'm sure you could figure out all the information from those addresses, but the runtime is printing everything it can about the stack trace, which isn't much. -SteveCatching an exception and handling it directly is exactly how you do this. Dmd can't have all the options to write code for you.of course opening a non-existent file was an arbitrary example (and should be ignored). The garbage being output is really the focus of my question. At the very least, it should be removed in -release I think. I'd be interested in knowing how many (and who) actually make use of the output under the ------ part.
Jan 25 2022
On Wednesday, 26 January 2022 at 02:27:52 UTC, forkit wrote:I'd rather have more options available to me: e.g: dmd -tracebackPrint=no myfile.dor better yet, just make an addition to the already existing -debug=(option) dmd -debug=stracktrace myfile.d after all, a dump of stack trace is for 'debugging', and not something that one should see in -release. How hard would that be I wonder? btw. I just noticed a big difference in what ldc2 dumps, compared to what dmd dumps??
Jan 25 2022
On Wednesday, 26 January 2022 at 02:22:53 UTC, rikki cattermole wrote:That's your call stack (addresses). It doesn't have the function name/module because you haven't compiled it in. If you don't want it, catch any exceptions that can be thrown.Why could argue, that it's already been caught ;-)
Jan 25 2022
On Wed, Jan 26, 2022 at 02:20:17AM +0000, forkit via Digitalmars-d wrote: [...]std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ---------------- 0x000000013FB5F836 0x000000013FB53423 0x000000013FB51269 0x000000013FB51057 0x000000013FB5ECB3 0x000000013FB5EB2F 0x000000013FB5EC1B 0x000000013FB5EB2F 0x000000013FB5EA56 0x000000013FB53171 0x000000013FB51094 0x000000013FBD2F68 0x0000000076F9556D in BaseThreadInitThunk 0x00000000771F372D in RtlUserThreadStartDid you compile with debugging symbols, i.e., with -g? For example, given this code: void can() { throw new Exception("buahaha"); } void if_you() { can(); } void catch_me() { if_you(); } void can_you() { catch_me(); } void main() { can_you(); } Running with `dmd -run test.d` produces: object.Exception /tmp/test.d(1): buahaha ---------------- ??:? void test.can() [0x55c95255673b] ??:? void test.if_you() [0x55c952556748] ??:? void test.catch_me() [0x55c952556754] ??:? void test.can_you() [0x55c952556760] ??:? _Dmain [0x55c95255676c] Not bad, but not very helpful. If there are some inner functions you might not get the function names either. Running with `dmd -g -run test.d` produces: object.Exception /tmp/test.d(1): buahaha ---------------- /tmp/test.d:1 void test.can() [0x55cff3e3773b] /tmp/test.d:2 void test.if_you() [0x55cff3e37748] /tmp/test.d:3 void test.catch_me() [0x55cff3e37754] /tmp/test.d:4 void test.can_you() [0x55cff3e37760] /tmp/test.d:6 _Dmain [0x55cff3e3776c] Voila! Line numbers and source filenames! T -- Gone Chopin. Bach in a minuet.
Jan 25 2022
On Wednesday, 26 January 2022 at 03:33:31 UTC, H. S. Teoh wrote:Running with `dmd -g -run test.d` produces: .... TInteresting. Thanks for mentioning that -g option. Still, it makes complete sense to me, that a stack trace dump is 'debugging material', and that -release should print only the exeption, and nothing else. Surely I'm not the only one who has come to that conclusion :-(
Jan 25 2022
On Wed, Jan 26, 2022 at 03:51:55AM +0000, forkit via Digitalmars-d wrote: [...]Still, it makes complete sense to me, that a stack trace dump is 'debugging material', and that -release should print only the exeption, and nothing else.It's easy, just wrap your main() in a try-catch block: int main() { try { // ... rest of code goes here return 0; } catch(Exception e) { writeln("Error: %s", e.msg); return 1; } } T -- Your inconsistency is the only consistent thing about you! -- KD
Jan 25 2022
On Wednesday, 26 January 2022 at 04:25:47 UTC, H. S. Teoh wrote:It's easy, just wrap your main() in a try-catch block: int main() { try { // ... rest of code goes here return 0; } catch(Exception e) { writeln("Error: %s", e.msg); return 1; } } Tgreat! .. now my 2 little lines of code, has turned into all this peripheral nonesense, just to avoid displaying the useless stack dump. ;-( // -- module test; import std; int main() { try { auto f = File("d://tewxt.txt").byLine; f.take(1).each!writeln; return 0; } catch(Exception e) { writeln("Error: %s", e.msg); return 1; } } // ---
Jan 25 2022
On Wednesday, 26 January 2022 at 05:17:48 UTC, forkit wrote:.. now my 2 little lines of code, has turned into all this peripheral nonesense, just to avoid displaying the useless stack dump.There is currently an open bug which prevents a stack trace - just link a DLL statically with an initialized runtime in it :D https://issues.dlang.org/show_bug.cgi?id=22181
Jan 26 2022
On Wednesday, 26 January 2022 at 05:17:48 UTC, forkit wrote:On Wednesday, 26 January 2022 at 04:25:47 UTC, H. S. Teoh wrote:you could implement a custom _d_print_throwable: https://github.com/dlang/druntime/blob/33511e263134530a5994a775b03a061ea3f1aa34/src/rt/dmain2.d#L560 This is called on uncaught exceptions, on assert failure and other internal fatal errors that exit the program. So make sure that the handler itself doesn't crash! Example: https://run.dlang.io/is/DBhyZW ```d void main() { throw new Exception("uncaught!"); } extern (C) void _d_print_throwable(Throwable t) nothrow { import core.stdc.stdio; fprintf(stderr, "%.*s", cast(int)t.msg.length, t.msg.ptr); } ```It's easy, just wrap your main() in a try-catch block: [...]great! .. now my 2 little lines of code, has turned into all this peripheral nonesense, just to avoid displaying the useless stack dump. ;-( [...]
Jan 26 2022
On Wednesday, 26 January 2022 at 03:51:55 UTC, forkit wrote:Still, it makes complete sense to me, that a stack trace dump is 'debugging material', and that -release should print only the exeption, and nothing else. Surely I'm not the only one who has come to that conclusion :-(https://forum.dlang.org/post/m09gue$38e$1 digitalmars.com I wouldn't be against only printing the Exception message by default either, but others consider letting an Exception escape `main` a bug, and think you should explicitly catch Exceptions that you expect might be thrown.
Jan 26 2022
On 1/25/22 9:20 PM, forkit wrote:has anyone ever considered getting rid of the indecipherable garbage after ---- (or having some compile time option to not output it?) I don't want to see it. I sure don't want my end-users to see it either. / -- module test; import std; void main() { File f = File("nosuchfile"); } // -- Exit code is: 1 std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ---------------- 0x000000013FB5F836 0x000000013FB53423 0x000000013FB51269 0x000000013FB51057 0x000000013FB5ECB3 0x000000013FB5EB2F 0x000000013FB5EC1B 0x000000013FB5EB2F 0x000000013FB5EA56 0x000000013FB53171 0x000000013FB51094 0x000000013FBD2F68 0x0000000076F9556D in BaseThreadInitThunk 0x00000000771F372D in RtlUserThreadStartRegardless of the "correct" way to deal with this, I agree with you that printing code addresses is not helpful. I'm assuming this is Windows? Is there nothing better that can be done? -Steve
Jan 25 2022
On Wednesday, 26 January 2022 at 03:45:01 UTC, Steven Schveighoffer wrote:Regardless of the "correct" way to deal with this, I agree with you that printing code addresses is not helpful. I'm assuming this is Windows? Is there nothing better that can be done? -SteveYou mean stop using Windows?
Jan 25 2022
On 1/25/22 10:56 PM, forkit wrote:On Wednesday, 26 January 2022 at 03:45:01 UTC, Steven Schveighoffer wrote:No I mean, on Windows, is there no better thing to print out for a stack frame other than the address? Not a question aimed at you ;) If I don't include debug info for Mac (even if I strip the executable), I still get function names, but not file/line info. I'm pretty sure Windows isn't the only OS that does this by default, but I can't remember all the different OSes I've tried D on. -SteveRegardless of the "correct" way to deal with this, I agree with you that printing code addresses is not helpful. I'm assuming this is Windows? Is there nothing better that can be done?You mean stop using Windows?
Jan 25 2022
On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:has anyone ever considered getting rid of the indecipherable`Forum oriented programming`.
Jan 25 2022
On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:btw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 26 2022
On 27/01/2022 10:02 AM, forkit wrote:On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:Here is where that would be implemented (I think anyway). https://github.com/dlang/druntime/blob/33511e263134530a5994a775b03a061ea3f1aa34/src/rt/dmain2.d#L530btw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 26 2022
On Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via Digitalmars-d wrote:On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:[...] File this as an enhancement request, it might be worth implementing. T -- Doubt is a self-fulfilling prophecy.btw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 26 2022
On Wednesday, 26 January 2022 at 21:11:42 UTC, H. S. Teoh wrote:On Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via Digitalmars-d wrote:will look into this. In the meantime, I can just comment out 2 lines, and problem goes away ;-) try { /* sink("\n----------------"); */ /* line 2463 object.d */ foreach (t; info) { /* sink("\n"); sink(t); */ /* line 2466 object.d */ } }On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:[...] File this as an enhancement request, it might be worth implementing. Tbtw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 26 2022
On Wednesday, 26 January 2022 at 21:11:42 UTC, H. S. Teoh wrote:On Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via Digitalmars-d wrote:https://github.com/dlang/DIPs/pull/222 tested and working fine ;-)On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:[...] File this as an enhancement request, it might be worth implementing. Tbtw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 30 2022
On Monday, 31 January 2022 at 00:56:38 UTC, forkit wrote:On Wednesday, 26 January 2022 at 21:11:42 UTC, H. S. Teoh wrote:This should be a druntime PROn Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via Digitalmars-d wrote:https://github.com/dlang/DIPs/pull/222 tested and working fine ;-)On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:[...] File this as an enhancement request, it might be worth implementing. Tbtw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 30 2022
On Wednesday, 26 January 2022 at 21:11:42 UTC, H. S. Teoh wrote:On Wed, Jan 26, 2022 at 09:02:09PM +0000, forkit via Digitalmars-d wrote:One can easily disable any exception traces via https://dlang.org/phobos/core_runtime.html#.Runtime.traceHandler: ``` void main() { import core.runtime : Runtime; Runtime.traceHandler = null; throw new Exception("oops"); } ``` [That won't just avoid the output, but also makes EH faster.] One can also set a custom function, e.g., to make tracing depend on some environment variable, reusing https://dlang.org/phobos/core_runtime.html#.defaultTraceHandler.On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:[...] File this as an enhancement request, it might be worth implementing.btw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Feb 04 2022
On Friday, 4 February 2022 at 19:04:24 UTC, kinke wrote:One can easily disable any exception traces via https://dlang.org/phobos/core_runtime.html#.Runtime.traceHandler: ``` void main() { import core.runtime : Runtime; Runtime.traceHandler = null; throw new Exception("oops"); } ``` [That won't just avoid the output, but also makes EH faster.] One can also set a custom function, e.g., to make tracing depend on some environment variable, reusing https://dlang.org/phobos/core_runtime.html#.defaultTraceHandler.Thanks. Very useful info :-) Although, I almost always need to compile with '-g' in order for the strace to be of any practical use. So I will likely end up incorporating above, into this: debug { import core.runtime : Runtime; Runtime.traceHandler = null; }
Feb 04 2022
On Friday, 4 February 2022 at 22:47:18 UTC, forkit wrote:Thanks. Very useful info :-) Although, I almost always need to compile with '-g' in order for the strace to be of any practical use. So I will likely end up incorporating above, into this: debug { import core.runtime : Runtime; Runtime.traceHandler = null; }oops. of course I meant: !debug { import core.runtime : Runtime; Runtime.traceHandler = null; } btw. how do I do that exactly (ie. !debug)
Feb 04 2022
On Friday, 4 February 2022 at 22:50:12 UTC, forkit wrote:btw. how do I do that exactly (ie. !debug)this seems messy: debug { } else { import core.runtime : Runtime; Runtime.traceHandler = null; } !debug would be much nicer.
Feb 04 2022
On Fri, Feb 04, 2022 at 10:50:12PM +0000, forkit via Digitalmars-d wrote: [...]btw. how do I do that exactly (ie. !debug)version(debug) {} else { ... // non-debug stuff goes here } If you don't like that, e.g. if you have to do this many times in your code, you could do something like this: // Do this once version(debug) enum isDebug = true; else enum isDebug = false; ... // Do this whenever you need static if (!isDebug) { ... // non-debug stuff here } T -- Guns don't kill people. Bullets do.
Feb 04 2022
On Wednesday, 26 January 2022 at 21:02:09 UTC, forkit wrote:On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:I think this is not a good idea. This sounds like the sort of environment variable that you usually, when it matters, want to *have set* a while ago, rather than set that moment. It's just one more "gotcha that you just need to know to work with the language."btw. I really like how Rust does it: just set an environment variable (set RUST_BACKTRACE=1) then run your program, and it will dump the backtrace, when you run your program.
Jan 31 2022
On Monday, 31 January 2022 at 08:56:17 UTC, FeepingCreature wrote:I think this is not a good idea. This sounds like the sort of environment variable that you usually, when it matters, want to *have set* a while ago, rather than set that moment. It's just one more "gotcha that you just need to know to work with the language."so that 'gotcha' is easily solved. when an error is printed, on the next line it could say this: ========================= std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ------------------------------------------------------------------ To see stack backtrace, set evironment variable: DLANG_BACKTRACE=1 =============================================
Jan 31 2022
On Monday, 31 January 2022 at 09:42:27 UTC, forkit wrote:On Monday, 31 January 2022 at 08:56:17 UTC, FeepingCreature wrote:I think you're coming at this with the model that the user can just re-run the program that's thrown the error. But consider long-running services deployed in an enterprise context. In that situation, if an error occurs, there might be quite a long time until you get to see it again - you can't just rerun the program, because the "program" is actually a docker container processing live user data, and you can't just call up your users and tell them "do that thing again" because it may have been many hours ago. In that situation - well, in that situation, usually you will have long ago set that environment variable by default in your reused deployment code. But it's still going to be annoying to the people trying to debug what went wrong there. On the other hand, with a console app usually the developer will have encountered errors plenty of times during development. So they'll probably have wrapped main with a `catch (Throwable) { writeln(Throwable.msg); exit(1); }` or something. I think it's better by default to give more info rather than less. You can always ignore stuff you don't care about; you can't anti-ignore stuff that was never printed.I think this is not a good idea. This sounds like the sort of environment variable that you usually, when it matters, want to *have set* a while ago, rather than set that moment. It's just one more "gotcha that you just need to know to work with the language."so that 'gotcha' is easily solved. when an error is printed, on the next line it could say this: ========================= std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ------------------------------------------------------------------ To see stack backtrace, set evironment variable: DLANG_BACKTRACE=1 =============================================
Jan 31 2022
On Monday, 31 January 2022 at 15:57:44 UTC, FeepingCreature wrote:I think you're coming at this with the model that the user can just re-run the program that's thrown the error. But consider long-running services deployed in an enterprise context. In that situation, if an error occurs, there might be quite a long time until you get to see it again - you can't just rerun the program, because the "program" is actually a docker container processing live user data, and you can't just call up your users and tell them "do that thing again" because it may have been many hours ago. In that situation - well, in that situation, usually you will have long ago set that environment variable by default in your reused deployment code. But it's still going to be annoying to the people trying to debug what went wrong there.A running program is unaffected. It would have to be recompiled before this change is adopted. This provides the opportunity to set that environment variable, 'if needed'.On the other hand, with a console app usually the developer will have encountered errors plenty of times during development. So they'll probably have wrapped main with a `catch (Throwable) { writeln(Throwable.msg); exit(1); }` or something.Nice. I hope the developer properly considered this during the development process ;-)I think it's better by default to give more info rather than less. You can always ignore stuff you don't care about; you can't anti-ignore stuff that was never printed.Knowing what frames are on the call stack when an exception is caught by the runtime is a 'debugging aid'. I do not see the case for having it printed by default, resulting in end-users trying to decipher it's nonsense.
Jan 31 2022
On Monday, 31 January 2022 at 20:43:21 UTC, forkit wrote:On Monday, 31 January 2022 at 15:57:44 UTC, FeepingCreature wrote:End-users are not supposed to decipher this nonsense. They are supposed to paste it in a bugreport reported against your application, so that you can decipher it. Some applications even have built-in pop-up dialogs, suggesting the user to send a crash report to developers with just a single button click.I think it's better by default to give more info rather than less. You can always ignore stuff you don't care about; you can't anti-ignore stuff that was never printed.Knowing what frames are on the call stack when an exception is caught by the runtime is a 'debugging aid'. I do not see the case for having it printed by default, resulting in end-users trying to decipher it's nonsense.
Feb 01 2022
On Monday, 31 January 2022 at 09:42:27 UTC, forkit wrote:On Monday, 31 January 2022 at 08:56:17 UTC, FeepingCreature wrote:I would much rather that you disable stacktraces rather than enables them. I have systems running for months without being able to just rerun on the fly when it fails. Without a stacktrace that would fail and I most definitely wouldn't remember to enable that for every program I run.I think this is not a good idea. This sounds like the sort of environment variable that you usually, when it matters, want to *have set* a while ago, rather than set that moment. It's just one more "gotcha that you just need to know to work with the language."so that 'gotcha' is easily solved. when an error is printed, on the next line it could say this: ========================= std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ------------------------------------------------------------------ To see stack backtrace, set evironment variable: DLANG_BACKTRACE=1 =============================================
Feb 01 2022
On Wednesday, 26 January 2022 at 02:20:17 UTC, forkit wrote:has anyone ever considered getting rid of the indecipherable garbage after ---- (or having some compile time option to not output it?) I don't want to see it. I sure don't want my end-users to see it either. / -- module test; import std; void main() { File f = File("nosuchfile"); } // -- Exit code is: 1 std.exception.ErrnoException std\stdio.d(545): Cannot open file `nosuchfile' in mode `rb' (No such file or directory) ---------------- 0x000000013FB5F836 0x000000013FB53423 0x000000013FB51269 0x000000013FB51057 0x000000013FB5ECB3 0x000000013FB5EB2F 0x000000013FB5EC1B 0x000000013FB5EB2F 0x000000013FB5EA56 0x000000013FB53171 0x000000013FB51094 0x000000013FBD2F68 0x0000000076F9556D in BaseThreadInitThunk 0x00000000771F372D in RtlUserThreadStartYou might want to share how you are compiling this. The detail will change how much the runtime can tell you. Make sure you compile in the debug mode. If you don't use the compiler itself to link, make sure you pass the `-export-dynamic` flag to the linker.
Jan 27 2022