From dev-return-7595-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Fri Dec 04 18:49:25 2009 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 6201 invoked from network); 4 Dec 2009 18:49:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 18:49:25 -0000 Received: (qmail 22712 invoked by uid 500); 4 Dec 2009 18:49:24 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 22627 invoked by uid 500); 4 Dec 2009 18:49:24 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 22617 invoked by uid 99); 4 Dec 2009 18:49:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 18:49:24 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of fdmanana@gmail.com designates 72.14.220.157 as permitted sender) Received: from [72.14.220.157] (HELO fg-out-1718.google.com) (72.14.220.157) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 18:49:22 +0000 Received: by fg-out-1718.google.com with SMTP id 16so41440fgg.5 for ; Fri, 04 Dec 2009 10:49:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=HsJWNAHQzNrucmT6EsAzf27oI3MrYP8lmerVEoQz8Pw=; b=H0KRMFUARZa5BhznNN19Kblei58Rtx1RJVibBu0RoFd3F9R9QPDedC48keBbRStIiz HM6fBMHBzbOlxZVacAJbfXtWiqKVCjQrM89qsZvJ0UNn5wOyh1ODjDXm4KkiuXhx0Gzr 7+LdsAzOVHSU66Wd6W24z+bls8hfQnrWJNAL8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; b=vqYb1W+Z+If0HOzXW5HuK/NwDdzFo3ZrlrhM0uKvbNW4MrB8mcWd9lFEmkRyd3fr6j f6VH1kp2viRwbD0z4CPHNH8N4txTD/FQgeCff4sr41j0sOzAXoFQqxfXrzuXNwwug7Bb zTg9in3EHrqV97tySrg48bk//lGXmHlg01P8U= MIME-Version: 1.0 Received: by 10.239.140.66 with SMTP id w2mr355638hbw.208.1259952540602; Fri, 04 Dec 2009 10:49:00 -0800 (PST) Reply-To: fdmanana@ieee.org In-Reply-To: <871a1cce0912021239g1145b90fm443d94b98b123284@mail.gmail.com> References: <871a1cce0912021239g1145b90fm443d94b98b123284@mail.gmail.com> Date: Fri, 4 Dec 2009 19:48:59 +0100 Message-ID: Subject: Re: Ang.: Re: using Erlang's debugger with couchdb From: Filipe David Manana To: dev@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, thanks for the suggestion Torbj=C3=B6rn, I had not yet the time to test it but it seems promising (I am mostly an Emacs user also). It's on my todo list now. I found the cause of the problem. When debugging using Erlang's debugger, he considers the Length variable used in the second case statement (attribution to #att.len) to be already bound. This is so because the previous case statement also uses a variable named Length in 2 of its branches. Just renaming the second one from Length to Length2 (chouch_httpd_db.erl line 1045) avoids the badmatch error: [#att{ name =3D FileName, type =3D case couch_httpd:header_value(Req,"Content-Type") = of undefined -> % We could throw an error here or guess by the File= Name. % Currently, just giving it a default. <<"application/octet-stream">>; CType -> list_to_binary(CType) end, data =3D case couch_httpd:body_length(Req) of undefined -> <<"">>; {unknown_transfer_encoding, Unknown} -> exit({unknown_transfer_encoding, Unknown}); chunked -> fun(MaxChunkSize, ChunkFun, InitState) -> couch_httpd:recv_chunked(Req, MaxChunkSize, ChunkFun, InitState) end; 0 -> <<"">>; Length when is_integer(Length) -> fun() -> couch_httpd:recv(Req, 0) end; Length -> exit({length_not_integer, Length}) end, len =3D case couch_httpd:header_value(Req,"Content-Length")= of undefined -> undefined; Length2 -> list_to_integer(Length2) end }] end, I wonder why this badmatch error only occurs when interpreting the code with the debugger and not during normal execution. Anyone has a clue? cheers 2009/12/2 Torbj=C3=B6rn T=C3=B6rnkvist : > For some more light weight debugging I can recomend redbug. =C2=A0It is i= ncluded > in the eper repo at google code. > > --Tobbe > > Den 12 1, 2009 11:50 PM, "Robert Dionne" > skrev: > > I've had great luck using Distel[1] =C2=A0on top of aquamacs. Bill Clemen= tson > wrote a couple of nice how to pieces[2] to get you started. Works like a > champ > > [1] http://github.com/bdionne/distel > [2] http://bc.tech.coop/blog/070528.html > > On Dec 1, 2009, at 5:34 PM, Filipe David Manana wrote: > Hello, > > I am > having a strange sit... > --=20 Filipe David Manana, fdmanana@gmail.com PGP key - http://pgp.mit.edu:11371/pks/lookup?op=3Dget&search=3D0xC569452B "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."