Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.thread.getStackDump
on getStackDump (adrTable) { <<Changes: <<1/15/02; 10:52:45 AM by DB -- created <<Created. Get the current thread stack traceback information. Pull from the thread statistics and populate a table for easy access <<http://docserver.userland.com/thread/getStackDump local (stats); if (not defined (adrTable^)) or (typeOf (adrTable^) != tableType) { new (tableType, adrTable)} else { table.emptyTable (adrTable)}; thread.getStats (@stats); local (trace = stats.["thread" + thread.getCurrentId ()].traceback); for i = 1 to sizeOf (trace) { local (name = trace [i] [3]); local (level = string.padWithZeros (i, 2) + " (" + trace [i][1] + ")"); if defined (name^) { name = address (name)}; adrTable^.["level" + level] = name}; return (true)} <<bundle // test code <<thread.getStackDump (@scratchpad.dump)
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.