Hi Max,

That sounds like a great project!

You may have already seen this, but I wrote up a detailed blog post about
my approach for writing the Node.js/V8 ustack helper:
http://dtrace.org/blogs/dap/2013/11/20/understanding-dtrace-ustack-helpers/

Much of this advice was from Bryan, who wrote the ustack helper mechanism
and the first helpers.  The most important piece for me was developing a
working MDB dcmd that could print a stack trace from a variety of core
files.  That's useful on it's own, but it also allowed me to do of the work
of figuring out how to construct the stack trace in an environment that's
easier to work in and debug (namely, an ordinary C program).  Even after
I'd gotten a working helper together, the MDB dcmd is useful when we find
new cases that the helper doesn't handle properly.

Of course, even once you know exactly what to do, it's tricky to translate
that into D.  I worked incrementally, starting with a helper that just
emitted a predefined string for each frame, then extending this to be able
to dump out pointers and the like.  I essentially used printf-style
debugging most of the time, emitting strings to the stack trace buffer, and
comparing the helper's output with information from the dcmd.

Your REPL idea is interesting.  We'd discussed having an MDB dcmd that
could execute a ustack helper on a core file, potentially recording useful
state along the way.  I'm not sure what's involved here, but it would
certainly be useful!

Best of luck, and let us know if you have more specific questions.

-- Dave

On Fri, Jul 14, 2017 at 7:10 AM, Max Rottenkolber <[email protected]> wrote:

> Hi everyone, :-)
> 
> I interested in using Clozure Common Lisp[1] on SmartOS, and want to
> benefit
> from all the nice debugging/observation capabilities offered by the OS. To
> that
> end I ended up writing a ustack helper for CCL. Needless to say, I didn’t
> get
> it right the first time, and now I need to debug it.
> 
> I’m having some well-known issues with that. :-) I already received some
> lovely
> help via IRC, but I think I could use some more pointers, specifically
> regarding the kernel’s dtrace_helptrace.
> 
> I see multiple paths that I imagine would help me forward:
> 
> 1)  write an mdb script that makes the dtrace_helptrace... useful to me.
>  
>  resolve the addresses(?) printed by it to strings from the original D
>  source. (realistic)
> 
> 2) add some kind of trace function to debug D scripts (printf style
>    debugging), or even make printf work inside ustack helpers. (I
> understand
>    there are reasons why printf does *not* work inside ustack helpers, but
>    still...)
> 
> 3)  create an interactive D REPL that can attach to core dumps for
> interactive
>  prototyping. (as a Lisp programmer this would be the promised land for
> me,
>  but I understand that its a non-trivial task)
> 
> I am willing to put in some work to accomplish either of these. As I know
> next
> to nothing about SmartOS, yet, I would appreciate any hints and pointers.
> And
> of course, I might have missed existing facilities that would help me out.
> 
> Cheers,
> Max
> 



-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to