From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0EM64u3021715 for ; Fri, 14 Jan 2011 23:06:07 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEBAB5XME3RVda2kGdsb2JhbACkUQgVAQECCQkMBxEEIKMYiXmCF4RKLoZSAQEDBYVKBIRrhis X-IronPort-AV: E=Sophos;i="4.60,324,1291590000"; d="scan'208";a="73102178" Received: from mail-iw0-f182.google.com ([209.85.214.182]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 14 Jan 2011 23:06:06 +0100 Received: by iwn39 with SMTP id 39so3060273iwn.27 for ; Fri, 14 Jan 2011 14:06:05 -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=OrhNETEoafUDh2zzF7h3Fh8JFpNOIKoMQSVhqCAIxqg=; b=seVPayaCOfumqJt6bKjfr8VwznCiJp5mj9FctxzHCzUlXtc9nzLVGZ8K4KGugo+NKm P3fE4qH5V7JxRR+sYiHTHexIt1RvvGcTd0Ya75t95B0aAA/yYbQKKMWJHXnbbn5vtM76 hxLFSP2T0nIOCoEkc+sLhzOxQ77RNhJLXw5y8= 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=DZtKKNrauj47mC2vKumL7busNxa7tEECfHZSNAnRyWtr3bEsrqZYGUx1h209cV4bdx bj0OulMmiDs4F8VrRu9rKhnqdAH2nzRx9BiC7nV9Cr7NClwV8U3iIWgNZlLcZ+xlqepl aUVcXMzPLGfQ3uov8MRcByk2/m9GdfbKobZz8= Received: by 10.231.36.69 with SMTP id s5mr1234116ibd.167.1295042765537; Fri, 14 Jan 2011 14:06:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.14.10 with HTTP; Fri, 14 Jan 2011 14:05:44 -0800 (PST) In-Reply-To: References: From: Ashish Agarwal Date: Fri, 14 Jan 2011 17:05:44 -0500 Message-ID: To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Cc: Caml List Content-Type: multipart/alternative; boundary=0003255760020241830499d5a4ba Subject: Re: [Caml-list] printing an exception changes printed backtrace --0003255760020241830499d5a4ba Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for the workaround; that resolves the issue for me. But this seems very unstable. On Fri, Jan 14, 2011 at 4:59 PM, Daniel B=FCnzli wrote: > > So it appears that printing an exception changes the backtrace. Is that > > possible? > > I don't know about the details of backtrace recording but I suspect > that the call to the printing function interferes with the previously > recorded backtrace. > > What works for me is to immediately get the backtrace as a string [1] > with Printexc.get_backtrace (), then print the exception and then > print the string. > > Also bear in mind that sometimes native backtrace are not as precise > as those in bytecode (tail calls and optimizations ?). > > Daniel > > [1] > Btw. the api could really have given us a list of strings (or even of > string * string * int * (int * int)). I already had to parse that > string to properly format backtraces. > --0003255760020241830499d5a4ba Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for the workaround; that resolves the issue for me. But this seems v= ery unstable.


On Fri, Jan 14, 2011 a= t 4:59 PM, Daniel B=FCnzli <daniel.buenzli@erratique.ch> wrote:
> So it appears that p= rinting an exception changes the backtrace. Is that
> possible?

I don't know about the details of backtrace recording but I suspe= ct
that the call to the printing function interferes with the previously
recorded backtrace.

What works for me is to immediately get the backtrace as a string [1]
with Printexc.get_backtrace (), then print the exception and then
print the string.

Also bear in mind that sometimes native backtrace are not as precise
as those in bytecode (tail calls and optimizations ?).

Daniel

[1]
Btw. the api could really have given us a list of strings (or even of
string * string * int * (int * int)). I already had to parse that
string to properly format backtraces.

--0003255760020241830499d5a4ba--