No subject


Thu Jul 5 12:38:43 CEST 2012


third party library to track the problem. If there is nothing builtin, I'll
just mark head lines in my code to find the culprit, but it really seems
wrong and disappointing from a modern language if there is no better way.

emmanuel


On Tue, Nov 6, 2012 at 10:37 PM, Emmanuel Touzery <etouzery at gmail.com>wrote:

> so in the end I had to build the program with:
>
>  ghc -prof -auto-all -rtsopts -osuf prof *.hs
>
> so also -rtsopts. After the simple ghc *.hs build.
>
> then I run it with:
>
> +RTS -xc -RTS
>
> in the command-line.
>
> but it doesn't appear to work properly, I guess I didn't quite compile or
> run it correctly. It constantly displays me some stack position during the
> whole runtime even when there is no problem.
> When the real problem comes, it still displays the same stack it did for
> the whole runtime, but there is no "head" in that function.
>
> I'll probably end up debugging this one "by hand", but I would really
> would like to have a general solution for the problem for the future, where
> tooling would help me...
>
> annotating/modifying my code... it really seems wrong in this case :-/
>
> On Tue, Nov 6, 2012 at 8:34 PM, Emmanuel Touzery <etouzery at gmail.com>wrote:
>
>> well it certainly requires will to build with profiling.
>> i had to reinstall all my cabal packages with profiling enabled, which i
>> finally managed to do now..
>>
>> and now it tells me:
>> ghc -prof -auto-all Prog.hs
>>
>>     Dynamic linking required, but this is a non-standard build (eg. prof).
>>     You need to build the program twice: once the normal way, and then
>>     in the desired way using -osuf to set the object file suffix.
>>
>> Ah well.. I'll fight some more with this later. Not exactly "out of the
>> box"...
>>
>> Emmanuel
>>
>>
>> On Tue, Nov 6, 2012 at 1:02 PM, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
>>
>>> Hi Emmanuel,
>>>
>>> It is indeed good practice to write total programs in general. However,
>>> I understand the need for stack traces in practice.
>>>
>>> There are some slides by Simon Marlow on the issue, ironically using
>>> your example in the title.
>>>
>>> In short: check the -xc flag in
>>> http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/runtime-control.html
>>>
>>> Hope this helps,
>>> Ozgur
>>>
>>>
>>
>

--f46d043c81a6c6d5f904cdda83db
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

well studying it further it seems the output I got was:<br><br>&lt;GHC.List=
.CAF&gt;TvChannelsParse: Prelude.head: empty list<br><br>It was a bit diffi=
cult to extract it because the normal output of my program is really floode=
d by extra text from the RTS options.<br>
<br>So I get this GHC.List.CAF extra information; not particularly useful (=
I mean for sure the head fails in GHC.List, I already knew that). I see oth=
ers got the same as I did:<br><a href=3D"http://www.haskell.org/pipermail/h=
askell-cafe/2008-February/040053.html">http://www.haskell.org/pipermail/has=
kell-cafe/2008-February/040053.html</a><br>
<br>=A0So maybe there is nothing to expect from that profiling trick after =
all... From what I can tell on the link that I found, the person ended up u=
sing a third party library to track the problem. If there is nothing builti=
n, I&#39;ll just mark head lines in my code to find the culprit, but it rea=
lly seems wrong and disappointing from a modern language if there is no bet=
ter way.<br>
<br>emmanuel<br><br><br><div class=3D"gmail_quote">On Tue, Nov 6, 2012 at 1=
0:37 PM, Emmanuel Touzery <span dir=3D"ltr">&lt;<a href=3D"mailto:etouzery@=
gmail.com" target=3D"_blank">etouzery at gmail.com</a>&gt;</span> wrote:<br><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex">
so in the end I had to build the program with:<br><br>=A0ghc -prof -auto-al=
l -rtsopts -osuf prof *.hs<br><br>so also -rtsopts. After the simple ghc *.=
hs build.<br><br>then I run it with:<br><br>+RTS -xc -RTS<br><br>in the com=
mand-line.<br>

<br>but it doesn&#39;t appear to work properly, I guess I didn&#39;t quite =
compile or run it correctly. It constantly displays me some stack position =
during the whole runtime even when there is no problem.<br>When the real pr=
oblem comes, it still displays the same stack it did for the whole runtime,=
 but there is no &quot;head&quot; in that function.<br>

<br>I&#39;ll probably end up debugging this one &quot;by hand&quot;, but I =
would really would like to have a general solution for the problem for the =
future, where tooling would help me...<br><br>annotating/modifying my code.=
.. it really seems wrong in this case :-/<br>

<br><div class=3D"gmail_quote"><div class=3D"im">On Tue, Nov 6, 2012 at 8:3=
4 PM, Emmanuel Touzery <span dir=3D"ltr">&lt;<a href=3D"mailto:etouzery at gma=
il.com" target=3D"_blank">etouzery at gmail.com</a>&gt;</span> wrote:<br></div=
><div>
<div class=3D"h5"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex">
well it certainly requires will to build with profiling.<br>i had to reinst=
all all my cabal packages with profiling enabled, which i finally managed t=
o do now..<br><br>and now it tells me:<br>ghc -prof -auto-all Prog.hs<br>


<br>=A0=A0=A0 Dynamic linking required, but this is a non-standard build (e=
g. prof).<br>=A0=A0=A0 You need to build the program twice: once the normal=
 way, and then<br>=A0=A0=A0 in the desired way using -osuf to set the objec=
t file suffix.<br>


<br>Ah well.. I&#39;ll fight some more with this later. Not exactly &quot;o=
ut of the box&quot;...<span><font color=3D"#888888"><br><br>Emmanuel</font>=
</span><div><div><br><br><div class=3D"gmail_quote">
On Tue, Nov 6, 2012 at 1:02 PM, Ozgur Akgun <span dir=3D"ltr">&lt;<a href=
=3D"mailto:ozgurakgun at gmail.com" target=3D"_blank">ozgurakgun at gmail.com</a>=
&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Hi Emmanuel,<div><br></div><div>It is indeed=
 good practice to write total programs in general. However, I understand th=
e need for stack traces in practice.</div>


<div><br></div><div>There are some slides by Simon Marlow on the issue, iro=
nically using your example in the title.</div>

<div><br></div><div>In short: check the -xc flag in=A0<a href=3D"http://www=
.haskell.org/ghc/docs/7.0.1/html/users_guide/runtime-control.html" target=
=3D"_blank">http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/runtime-=
control.html</a></div>




<div><br></div><div>Hope this helps,</div><div>Ozgur</div><div><br></div>
</blockquote></div><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>

--f46d043c81a6c6d5f904cdda83db--



More information about the Beginners mailing list