www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Can I use the stack info in Exception?

reply Dsby <dushibaiyu yahoo.com> writes:
I use the ldc1.1-b5.
when I tach the Exception, in ldc, it not printf the stack info. 
in dmd ,it has.

import std.json;
import std.stdio;

string pjson(ref JSONValue js)
{
     return js["hhh"].str;
}

void main()
{
     JSONValue js;
     js["hh"] = 10;
     try{
         pjson(js);
     } catch(Exception e){
         writeln(e.toString());
     }
}

In ldc , only printf:
std.json.JSONException /build/src/ldc/runtime/phobos/std/json.d(442): Key not
found: hhh
----------------


In dmd , it printf:
std.json.JSONException std/json.d(442): Key not found: hhh
----------------
??:? pure  safe void 
std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[],
ulong, const(char[])) [0x452c66]
??:? pure  safe inout(std.json.JSONValue)* 
std.exception.enforce!(std.json.JSONException, 
inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, 
lazy const(char)[], immutable(char)[], ulong) [0x452cca]
??:? std.json.JSONValue.opIndexinout(pure ref 
inout(std.json.JSONValue) function(immutable(char)[])) [0x448072]
??:? immutable(char)[] exception.pjson(ref std.json.JSONValue) 
[0x442f0a]
??:? _Dmain [0x442f4f]
??:? 
_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 
[0x445142]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x44508c]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).runAll() [0x4450fe]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x44508c]
??:? _d_run_main [0x444ffd]
??:? main [0x443715]
??:? __libc_start_main [0x604f7290]



Does has any parameter  to enable cath the stack info?
Dec 03 2016
next sibling parent Dsby <dushibaiyu yahoo.com> writes:
On Saturday, 3 December 2016 at 15:34:37 UTC, Dsby wrote:
 I use the ldc1.1-b5.
 when I tach the Exception, in ldc, it not printf the stack 
 info. in dmd ,it has.

 import std.json;
 import std.stdio;

 string pjson(ref JSONValue js)
 {
     return js["hhh"].str;
 }

 void main()
 {
     JSONValue js;
     js["hh"] = 10;
     try{
         pjson(js);
     } catch(Exception e){
         writeln(e.toString());
     }
 }

 In ldc , only printf:
 std.json.JSONException /build/src/ldc/runtime/phobos/std/json.d(442): Key not
found: hhh
 ----------------


 In dmd , it printf:
 std.json.JSONException std/json.d(442): Key not found: hhh
 ----------------
 ??:? pure  safe void 
 std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[],
ulong, const(char[])) [0x452c66]
 ??:? pure  safe inout(std.json.JSONValue)* 
 std.exception.enforce!(std.json.JSONException, 
 inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, 
 lazy const(char)[], immutable(char)[], ulong) [0x452cca]
 ??:? std.json.JSONValue.opIndexinout(pure ref 
 inout(std.json.JSONValue) function(immutable(char)[])) 
 [0x448072]
 ??:? immutable(char)[] exception.pjson(ref std.json.JSONValue) 
 [0x442f0a]
 ??:? _Dmain [0x442f4f]
 ??:? 
 _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 
 [0x445142]
 ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
 function(char[][])*).tryExec(scope void delegate()) [0x44508c]
 ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
 function(char[][])*).runAll() [0x4450fe]
 ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
 function(char[][])*).tryExec(scope void delegate()) [0x44508c]
 ??:? _d_run_main [0x444ffd]
 ??:? main [0x443715]
 ??:? __libc_start_main [0x604f7290]



 Does has any parameter  to enable cath the stack info?
I am in Linux X86_64. uname -a 2016年12月03日 星期六 23时37分11秒 13:50:28 UTC 2016 (d1ec066) x86_64 x86_64 x86_64 GNU/Linux cat /etc/os-release 2016年12月03日 星期六 23时37分14秒 NAME="openSUSE Tumbleweed" ID=opensuse ID_LIKE="suse" VERSION_ID="20161201" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20161201" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/"
Dec 03 2016
prev sibling parent Johan Engelen <j j.nl> writes:
On Saturday, 3 December 2016 at 15:34:37 UTC, Dsby wrote:
 I use the ldc1.1-b5.
 when I tach the Exception, in ldc, it not printf the stack 
 info. in dmd ,it has.
https://github.com/ldc-developers/ldc/issues/115 どうも! Johan
Dec 14 2016