From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0HGfdIF029763 for ; Mon, 17 Jan 2011 17:41:39 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgoBAOr/M03RVda2kGdsb2JhbACjdVYIFQEBAQEJCQwHEQQgqQOJeoIYhDouhnoBAQMFhUsEhHCGLw X-IronPort-AV: E=Sophos;i="4.60,333,1291590000"; d="scan'208";a="87137688" Received: from mail-iw0-f182.google.com ([209.85.214.182]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-MD5; 17 Jan 2011 17:41:33 +0100 Received: by mail-iw0-f182.google.com with SMTP id 39so5008538iwn.27 for ; Mon, 17 Jan 2011 08:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=w2oFS6VaU7+/ZSOWKe8mK9snrC/M+Qlfe+gvd3A1gm4=; b=OVipBMP3UBs5yyadCILnYptbblMB9noP2PQ5znvuxE9TIc+8pbxXvT5W4Ij219OQRb jW076mQikwJgUzswDkeOpSOy4DHldfT0jCkMfZC1Kz1du0Eh+sWVaxb03yOVK5Ik+Npp OBNWlgGQVbKPVO94erNC5v5z2REy8NgAcXiKA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=BFDeDiED87LSJX/23am6sVi2EX3+VDxjs9SRNABOb4fszmJ+GtxCf4j/mtBy3anAtb ylHzGAat3gCnMz09MPAGJoaOHFUExoXYR64J5AaKHt59DLa4D5WSpjdMK4Djmd8a4JGi BfrW2yWZarbK74H3Je9SDVqG0952Q5jAxZnnA= Received: by 10.231.39.67 with SMTP id f3mr4481639ibe.42.1295282493488; Mon, 17 Jan 2011 08:41:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.14.10 with HTTP; Mon, 17 Jan 2011 08:41:13 -0800 (PST) In-Reply-To: <0AA39519-6C34-4620-9CFA-A99A3EC217CA@inria.fr> References: <0AA39519-6C34-4620-9CFA-A99A3EC217CA@inria.fr> From: Ashish Agarwal Date: Mon, 17 Jan 2011 11:41:13 -0500 Message-ID: To: xclerc Cc: Caml List Content-Type: multipart/alternative; boundary=00032557635ae8800c049a0d74a2 Subject: Re: [Caml-list] printing an exception changes printed backtrace --00032557635ae8800c049a0d74a2 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jan 17, 2011 at 10:37 AM, xclerc wrote: > The underlying problem is that "Printexc.print_backtrace" prints the > backtrace > for the last exception raised... which can be one raised by > "Printf.eprintf" or > "Printexc.to_string", but locally caught and not exposed to the outside > world. > Okay, that makes sense. > You will get different backtraces according to the value of > "custom_printer". > I'm actually getting the same output (just "Not_found" printed). Tried native and byte code, on two different systems. Based on your explanation, I was expecting the following to give different output if you change true to false. But actually nothing is printed out in any case. So I'm really unclear now as to what print_backtrace does. let f () = try raise Not_found with Not_found -> () let g () = raise (Failure "") let () = try g() with e -> ( if true then f() else (); Printexc.print_backtrace stderr ) --00032557635ae8800c049a0d74a2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Jan 17, 2011 at 10:37 AM, xclerc <xavier.clerc@inria.= fr> wrote:
=A0
The underlying problem is that "Printexc.print_backtrace" prints = the backtrace
for the last exception raised... which can be one raised b= y "Printf.eprintf" or
"Printexc.to_string", but loca= lly caught and not exposed to the outside world.

Okay, that makes sense.=A0

<= /div>
=A0
You will get different b= acktraces according to the value of "custom_printer".

I'm actually getting the same output (= just "Not_found" printed). Tried native and byte code, on two dif= ferent systems.

Based on your explanation, I was e= xpecting the following to give different output if you change true to false= . But actually nothing is printed out in any case. So I'm really unclea= r now as to what print_backtrace does.

let f () =3D
=A0=A0try raise Not_found
=A0=A0with Not_found -> ()

let g () = =3D raise (Failure "")

let () =3D
<= div>=A0=A0try g()
=A0=A0with e -> (
=A0=A0 =A0if true then f() else ();
=A0=A0 =A0Printexc.print_backtrace stderr
=A0=A0)


--00032557635ae8800c049a0d74a2--