www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21480] New: uncaught exceptions: stack trace truncated at NUL


          Issue ID: 21480
           Summary: uncaught exceptions: stack trace truncated at NUL char
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: kdevel vogtner.de

http://forum.dlang.org/thread/ggyxirvvnypggstfkbzj forum.dlang.org#post-ggyxirvvnypggstfkbzj:40forum.dlang.org

void main ()
   import std.stdio;
   import std.conv;
   char [2] win = [0, 'X'];
   auto ne = new Exception ("A " ~ win.to!string ~ " B");
   try throw ne;
   catch (Exception e)
      writeln ("exception caught: e.msg = <", e.msg, ">");
   throw ne;


exception caught: e.msg = <A X B>
object.Exception char2.d(6): A              <--- truncated at \0

Commment from P.B.: This is definitely a bug. The problem is that the D runtime
uses `fprintf` to print the exception's error message, when it should be using


Dec 13 2020