IRC channel logs
2015-03-01.log
back to list of logs
<jralls>I've managed to get guild to crash after getting a std::bad-alloc thrown inside of it. How do I debug it? <mark_weaver>having a C++ exception attempt to unwind through Guile's stack frames sounds like a recipe for badness. <mark_weaver>I think you'll need to catch C++ exceptions at the point where C++ is called from Scheme, to prevent that. <jralls>mark_weaver: It looks to me like guile is what's throwing the exception... <jralls>mark_weaver: So how would compiling scheme raise a C++ exception? <mark_weaver>I suppose it is possible if the code you are compiling includes bindings to a C++ library. <mark_weaver>Scheme procedural macros (e.g. syntax-case) allows arbitrary Scheme code to be run at macro expansion time, and macro expansion is the first phase of compilation. <mark_weaver>and even outside of macros, there are various ways to run arbitrary code at macro expansion time. <mark_weaver>so that code could load dynamic modules containing C++ code and call into it. <mark_weaver>jralls: why don't you get a core dump and use gdb to get a backtrace <mark_weaver>I suppose it's possible that one of the libraries that Guile uses has some C++ in it, but personally I've never seen a C++ exception thrown within core Guile. <jralls>mark_weaver: I'm working on GnuCash. I've rewritten the date/time code to use boost::date_time, wrapped in C functions for the rest of GnuCash to consume. <jralls>mark_weaver: How do I get guild to dump core? <mark_weaver>from bash, "ulimit -c unlimited" will enable core dumps. if using a different shell, look up how to set rlimits <mark_weaver>hmm, although I'm not sure it will dump core in the right place to get a stack trace from where the exception was thrown. <mark_weaver>maybe it would be better to just run guild within gdb in the first place <mark_weaver>the top bit of it is bourne shell, and then it runs guile with some arguments. <mark_weaver>you can just run "gdb guile", run guile to get the repl, then (load "/path/to/guild") and (main <arguments to guild here>) <mark_weaver>I'm not sure how best to get gdb to stop where the exception was thrown. I've managed to avoid C++ for the last 15 years :) <jralls>mark_weaver: Doesn't look like it. Also looks like I'll have to build Guile from source; neither debian nor fedora provide symbols. <jralls>mark_weaver: Sorry, doesn't look like the core dump has a useful stack trace. It's only four deep, and since there are no guile symbols it has only hex addresses. <mark_weaver>jralls: yeah, I think you'll have to run it in gdb and ask gdb to stop where the exception is thrown. <jralls>mark_weaver: And "catch" is the gdb command for setting a breakpoint on catching a C++ exception. <mark_weaver>jralls: to clarify, the call to 'main' should be something like (main "compile" "-L" "<path>" "-o" "foo.go" "foo.scm") <zacts>mark_weaver: hey dude. I just got the 2nd edition of SICM in the mail today. <zacts>mark_weaver: yeah, so this SICM 2nd edition looks really really cool <zacts>I have yet to read it, but I've skimmed some pages <daviid>wingo: hello! any news wrt merge-generics settting @ load time ?