freenode/#sbcl - IRC Chatlog
Search
10:37:28
lukego
Hey when I do `C-c C-k' in SLIME and hit a compile-time error during compilation - sldb debugger pops up - is there an easy way to see how that relates to the source code that's being compiled? I'm finding the backtrace from the sbcl compiler pretty opaque
10:48:26
phoe
lukego: sldb does not pop up during read errors or macroexpansion errors, I get *slime-compilation* pop up instead
10:49:17
phoe
load-time errors, like a file containing (defun foo () (error "asdfsfsdf")) (foo), cause SLDB to pop up but then you should get a decent stack trace - in my case (foo) is on the stack
11:01:25
lukego
thanks, I'll pay more attention next time, I was just fishing in case there was an answer like "yeah press C-a C-b C-c to highlight the current source form being compiled"
11:04:03
phoe
lukego: I mean, it likely won't be able to give you this data, because it has already compiled everything that it could
11:05:34
lukego
okay here's a concrete example. I compile a file containing the form (defclass foo (foo) ()). This brings up a debugger telling me that a class cannot be its own superclass. In this context can I call up the source code where this line occurs?
11:07:13
phoe
the question is whether there is a link between the FASL command that is currently being loaded and the concrete source location
11:07:31
lukego
ah! but that should almost make it easier right, since source locations will exist for the compiled code?
11:08:44
lukego
yeah and I guess whether that source information is preserved when putting the values into a fasl. okay cool, I'll add this to my list of issues that I could dive into to better understand sbcl internals
11:08:46
phoe
we have a form that is sorta-not-yet-loaded so it is not yet put in the internal xref databases, but there should be source location in the FASL
11:09:19
phoe
I think that it would be a nice improvement to make it usable, or if it already exists, then document and publish this information somehow
11:10:02
phoe
because I don't know if it doesn't already exist in some form, it's just not in plain sight
11:11:15
lukego
yeah that's okay I'd rather consult the source anyway, I need to get into that habit
11:18:29
luis
lukego: in your example, pressing v on the ((sb-c::top-level-form ...)) frame jumps to the defclass form. Does that help?
11:21:43
lukego
oh now I see it. that line even appears in green to stand out from the noisy internals. thanks!
11:22:46
lukego
yeah. what else do you set? I actually have the form (declaim (optimize (speed 1) (safety 3) (debug 3))) lying around but evidently it's not loaded by my asdf system def
11:24:24
lukego
hm I evaluated that form but `C-c C-k' didn't change behaviour. works if I put it into the same source file, but I thought declaim was side-effecting on the global env?
11:27:32
lukego
anyone have some .sbclrc type examples I can crib from? I'm surely missing more good stuff than just this
11:29:17
lukego
hm but would restricting to minimum 3 mean that I can't override that locally e.g. (defun x (declare (optimize (debug 0))) ...) ? I'd want to be able to do that e.g. just when playing with the compiler
11:40:08
lukego
I'd really prefer to set a default but this is a big improvement anyway. what's the right solution? put a #.(myapp:standard-declaration) in each file?
11:41:24
lukego
aside: I'd really like to not get dropped into ldb when heap and/or stack is exhausted, but to just abort and recover every time. how is that achieved? compile all libraries with SAFETY >= n? I don't immediately see it in the compiler policy info listing
11:43:36
lukego
seems funny to optimize away the ability to trace load-time value errors with default settings though?
11:44:07
lukego
but yeah I'm content to set the policy for my own image and not meddle in other peoples' :)
14:10:44
luis
lukego: we use (proclaim '(optimize (debug 3))) early on in the compilation (saving a core resets that so you'll need to re-proclaim in that case).
14:11:40
lukego
oh, I see, I think I have been using DECLAIM and thinking it had the same scope as PROCLAIM.
14:11:51
luis
the main rationale was to disable TCO which really messes up debugging and production backtraces for us.
14:20:19
luis
lukego: regarding declaim/proclaim, what happens IIRC is that compile-file reverts the optimization settings back to what they were before it was invoked. So if you want a default, you need to set it outside the context of compile-file.
14:22:52
lukego
hm right so I see DECLAIM is just a macro that expands into a series of %PROCLAIM calls. So then doesn't that mean I can just put a (DECLAIM (OPTIMIZE (DEBUG 3))) in a file that's compiled/loaded early and it should apply to my whole application? or does neither DECLAIM nor PROCLAIM do that?
14:24:55
phoe
this actually is a SBCL question because AFAIR whether and how DECLAIM leaks from a file into a global environment is undefined by the specification
14:34:23
lukego
do you normally compile SBCL itself with more debug etc when hacking on it? e.g. it seems annoying that running `who-sets' on *POLICY* has no hits, maybe an SBCL recompile is the solution?
15:00:38
lukego
ACTION recompiles sbcl with all the luxurious and experimental looking features he can find
15:12:27
luis
Apparently LOAD also resets the optimization policy, which means we've only actually been using (debug 3) for stuff compiled interactively. That's funny. So I don't actually know whether (debug 3) affects our run times, d'oh.
15:24:41
lukego
Maybe I'll put a #.(myapp:standard-declaimer) at the top of my source files to establish a default for "my" code. I guess I'll have to eventually "do science" on the dependencies to see whether I can compile them with more debug/safety without impacting my own application perf
17:45:52
_death
Krystof: I've already reverted the change, but it was something about dump-fop+operands expecting an (unsigned-byte 64) where something else was passed (a symbol EVENT-DATA in the case of clx).. all I had was to try to load that system.. the same kind of error when I tried to compile sbcl (with this change reverted) so I had to copy sbcl.old to sbcl etc.. I guess anyone who'll try it is likely to stumble on it, so it's basically a
17:52:02
luis
stassats: perhaps "reset" is not the best choice of words. What I mean is that echo "(proclaim '(optimize (debug 3)))" > test-problem.lisp; sbcl --load test-proclaim.lisp --eval '(sb-ext:describe-compiler-policy)' --quit | grep "DEBUG =" # yields DEBUG = 1
18:10:24
luis
Right, but not by LOADing a file. What I meant is that changes to optimization policy within LOAD are restored when LOAD finishes. (I assume there's a dynamic variable or whatever.)
18:47:13
karlosz
probably the issue is that the second arg just needs to be fopcompiled or something but that seems less worth it