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 p0ELxbir021338 for ; Fri, 14 Jan 2011 22:59:37 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEBAGpWME3RVdI2kGdsb2JhbACECqBHCBUBAQIJCQwHEQQgoxuJPYJThEqHAAEBAwWBH4M3dASLFolD X-IronPort-AV: E=Sophos;i="4.60,324,1291590000"; d="scan'208";a="86955600" Received: from mail-pz0-f54.google.com ([209.85.210.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Jan 2011 22:59:31 +0100 Received: by pzk32 with SMTP id 32so495868pzk.27 for ; Fri, 14 Jan 2011 13:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=nAfqQrXw2udcfDPRtxJvPYgkOT1I14KwoFsqeWa/5To=; b=gF5T9a6QN6oWQntUnLbCc6FTAhHrtKaXUJzWD1FtVB8h58q38i5G03LVbj5ujjp6BY fDkF+hfqhCV5n1caVV8OrJ8j9/VV5Rw6H1DhR1CrHVDHETvNHGsBua3fzHCRspMHzk3W vG6pfsiOqZL7PDaWYMAnufmDjd/QNwpp7oA08= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=HnDCBp7qxtEuGBxqY8MHVeXdeT0lne+5uMUfNL8FgMeMYAIpKk+8IKROgO4waRXglx mDMtJ5oG9T6BOf0CNM5Nb3J2GLl9tELK2SpG7I//MGiPlDvb8b4fKNC/yaq8X4kGBj1s kL0O7RGXMK7Vao3MHbprUJEHEYWcTIXFVPaSE= MIME-Version: 1.0 Received: by 10.142.179.4 with SMTP id b4mr1192143wff.222.1295042370856; Fri, 14 Jan 2011 13:59:30 -0800 (PST) Sender: daniel.c.buenzli@gmail.com Received: by 10.142.73.8 with HTTP; Fri, 14 Jan 2011 13:59:30 -0800 (PST) In-Reply-To: References: Date: Fri, 14 Jan 2011 22:59:30 +0100 X-Google-Sender-Auth: HO2BbydOTnza4rBKl5pLT4zFmL8 Message-ID: From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: Ashish Agarwal Cc: Caml List Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] printing an exception changes printed backtrace > 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.