This function is part of the V8 stack trace API, for more info see: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
978773
function prepareStackTrace(error, stack) {
  // Store source maps in a cache so we don't load them more than once when
  // formatting a single stack trace (don't cache them forever though in case
  // the files change on disk and the user wants to see the updated mapping)
  var cache = {};
  return error + stack.map(function(frame) {
    return '\n    at ' + wrapCallSite(cache, frame);
  }).join('');
}
99088
def remove_stacktrace_locals(client, event):
    
    func = lambda frame: frame.pop("vars", None)
    return _process_stack_frames(event, func)
1037318
function Logger_trace() {
            try {
                throw new Error();
            } catch (e) {
                return core.trim(e.stack.split('\n').slice(3, 4).shift());
            }
        }
730075
protected String captureStackTrace(String message) {
		StringBuilder stringBuilder = new StringBuilder(String.format(message, Thread.currentThread().getName()));
		StackTraceElement[] trace = Thread.currentThread().getStackTrace();
		for (int i = 0; i < trace.length; i++) {
			stringBuilder.append(' ').append(trace[i]).append("\r\n");
		}

		stringBuilder.append("");

		return stringBuilder.toString();
	}
687359
def vm_trace(ext, msg, compustate, opcode, pushcache, tracer=log_vm_op):
    

    op, in_args, out_args, fee = opcodes.opcodes[opcode]

    trace_data = {}
    trace_data['stack'] = list(map(to_string, list(compustate.prev_stack)))
    if compustate.prev_prev_op in ('MLOAD', 'MSTORE', 'MSTORE8', 'SHA3', 'CALL',
                   'CALLCODE', 'CREATE', 'CALLDATACOPY', 'CODECOPY',
                   'EXTCODECOPY'):
        if len(compustate.prev_memory) < 4096:
            trace_data['memory'] = \
                ''.join([encode_hex(ascii_chr(x)) for x
                          in compustate.prev_memory])
        else:
            trace_data['sha3memory'] = \
                encode_hex(utils.sha3(b''.join([ascii_chr(x) for
                                      x in compustate.prev_memory])))
    if compustate.prev_prev_op in ('SSTORE',) or compustate.steps == 0:
        trace_data['storage'] = ext.log_storage(msg.to)
    trace_data['gas'] = to_string(compustate.prev_gas)
    trace_data['gas_cost'] = to_string(compustate.prev_gas - compustate.gas)
    trace_data['fee'] = fee
    trace_data['inst'] = opcode
    trace_data['pc'] = to_string(compustate.prev_pc)
    if compustate.steps == 0:
        trace_data['depth'] = msg.depth
        trace_data['address'] = msg.to
    trace_data['steps'] = compustate.steps
    trace_data['depth'] = msg.depth
    if op[:4] == 'PUSH':
        print(repr(pushcache))
        trace_data['pushvalue'] = pushcache[compustate.prev_pc]
    tracer.trace('vm', op=op, **trace_data)
    compustate.steps += 1
    compustate.prev_prev_op = op
50456
@Nonnull
  public String restoreStackTrace() {
    return "THREAD_ID : " + this.threadDescriptor + this.eol + new String(this.packed ? IOUtils.unpackData(this.stacktrace) : this.stacktrace, UTF8);
  }
197002
function makeWrappedCallback(callback, frameLocation) {
        // add a fake stack frame. we can't get a real one since we aren't inside the original function
        var traceError = new Error();
        traceError.__location = frameLocation;
        traceError.__previous = currentTraceError;
        return function() {
            // if (currentTraceError) {
            //     FIXME: This shouldn't normally happen, but it often does. Do we actually need a stack instead?
            //     console.warn("(long-stack-traces) Internal Error: currentTrace already set.");
            // }
            // restore the trace
            currentTraceError = traceError;
            try {
                return callback.apply(this, arguments);
            } catch (e) {
                console.error("Uncaught " + e.stack);
                if (LST.rethrow)
                    throw ""; // TODO: throw the original error, or undefined?
            } finally {
                // clear the trace so we can check that none is set above.
                // TODO: could we remove this for slightly better performace?
                currentTraceError = null;
            }
        }
    }
1114005
private String getStackTrace(AbstractEngineException data) {
        try (StringBuilderWriter writer = new StringBuilderWriter()) {
            data.printStackTrace(new PrintWriter(writer));
            return writer.getBuilder().toString();
        }
    }
915415
private String filterStackTrace(String trace) {
    for (StackTraceFilter filter : stackFilters) {
      trace = filter.apply(trace);
    }
    return trace;
  }
873851
def on_stacktrace_request(self, py_db, request):
        '''
        
        '''
        # : :type stack_trace_arguments: StackTraceArguments
        stack_trace_arguments = request.arguments
        thread_id = stack_trace_arguments.threadId
        start_frame = stack_trace_arguments.startFrame
        levels = stack_trace_arguments.levels

        fmt = stack_trace_arguments.format
        if hasattr(fmt, 'to_dict'):
            fmt = fmt.to_dict()
        self.api.request_stack(py_db, request.seq, thread_id, fmt=fmt, start_frame=start_frame, levels=levels)
226663
private LoggingEvent appendStackTraceToEvent(final LoggingEvent event) {
    String message = event.getMessage().toString();
    // If there is a stack trace available, print it out
    if (event.getThrowableInformation() != null) {
      final String[] s = event.getThrowableStrRep();
      for (final String line : s) {
        message += "\n" + line;
      }
    }
    message = message
        .replace("\\", "\\\\")
        .replace("\n", "\\n")
        .replace("\"", "\\\"")
        .replace("\t", "\\t");

    final Throwable throwable = event.getThrowableInformation() == null ? null
        : event.getThrowableInformation().getThrowable();
    return new LoggingEvent(event.getFQNOfLoggerClass(),
        event.getLogger(),
        event.getTimeStamp(),
        event.getLevel(),
        message,
        throwable);
  }
444887
private static StackTraceElement getStackTrace() {
    StackTraceElement[] stack = Thread.currentThread().getStackTrace();

    int i = 2; // we can skip the first two (first is getStackTrace(), second is this method)
    while (i < stack.length) {
      boolean isLoggingClass = false;
      for (String loggingClass : loggingClasses) {
        String className = stack[i].getClassName();
        if (className.startsWith(loggingClass)) {
          isLoggingClass = true;
          break;
        }
      }
      if (!isLoggingClass) {
        break;
      }

      i += 1;
    }

    // if we didn't find anything, keep last element (probably shouldn't happen, but could if people add too many logging classes)
    if (i >= stack.length) {
      i = stack.length - 1;
    }
    return stack[i];
  }
948440
function Stack(trace, options) {
  if (!(this instanceof Stack)) return new Stack(trace, options);

  if ('object' === typeof trace && !trace.length) {
    options = trace;
    trace = null;
  }

  options = options || {};
  options.guess = 'guess' in options ? options.guess : true;

  if (!trace) {
    var imp = new stacktrace.implementation()
      , err = options.error || options.err || options.e
      , traced;

    traced = imp.run(err);
    trace = options.guess ? imp.guessAnonymousFunctions(traced) : traced;
  }

  this.traces = this.parse(trace);
}
1094227
function stringifyStackTrace (stackTrace) {

  var i, len, result = [];

  for (i = 0, len = stackTrace.length; i < len; i++) {
    if (stackTrace[i]) {
      result.push(stackTrace[i].methodName + "::" + stackTrace[i].className + " (" + stackTrace[i].fileName + ":" + stackTrace[i].lineNumber + ")");
    }
  }

  return result.join("\n");
}
1366966
def tail(conn, stack_name, log_func=_tail_print, sleep_time=5,
         include_initial=True):
    """"""
    # First dump the full list of events in chronological order and keep
    # track of the events we've seen already
    seen = set()
    initial_events = get_events(conn, stack_name)
    for e in initial_events:
        if include_initial:
            log_func(e)
        seen.add(e.event_id)

    # Now keep looping through and dump the new events
    while 1:
        events = get_events(conn, stack_name)
        for e in events:
            if e.event_id not in seen:
                log_func(e)
                seen.add(e.event_id)
        time.sleep(sleep_time)
1364860
function getRelevantStackFrom (stack) {
  var filteredStack = [];
  var relevantStack = [];

  stack = stack.split('\n');

  for (var i = 0; i < stack.length; i += 1) {
    if (isExternalStackEntry(stack[i])) {
      filteredStack.push(stack[i])
    }
  }

  // If the filtered stack is empty, i.e. the error originated entirely from within jasmine or karma, then the whole stack
  // should be relevant.
  if (filteredStack.length === 0) {
    filteredStack = stack
  }

  for (i = 0; i < filteredStack.length; i += 1) {
    if (filteredStack[i]) {
      relevantStack.push(filteredStack[i])
    }
  }

  return relevantStack
}
1306421
def stack_trace(depth=None):
    
    frames = inspect.stack()[2:]
    if depth:
        frames = frames[:depth]
        
    result = StringIO()
    result.write("----------------------------------------------------\n")
    for (frame, file, line, context, code, status) in frames:
        result.write("In %s from %s\n%s %s" % (context, file, line, "\n".join(code)))
        result.write("----------------------------------------------------\n")        
    return result.getvalue()