#if defined(V8_OS_STARBOARD)
#include "starboard/system.h"
#define __builtin_abort …
#endif
#include "src/inspector/v8-stack-trace-impl.h"
#include <algorithm>
#include <memory>
#include <vector>
#include "../../third_party/inspector_protocol/crdtp/json.h"
#include "src/debug/debug-interface.h"
#include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-inspector-impl.h"
#include "src/tracing/trace-event.h"
ConvertJSONToCBOR;
namespace v8_inspector {
namespace {
static const char kId[] = …;
static const char kDebuggerId[] = …;
static const char kShouldPause[] = …;
static const v8::StackTrace::StackTraceOptions stackTraceOptions = …;
std::vector<std::shared_ptr<StackFrame>> toFramesVector(
V8Debugger* debugger, v8::Local<v8::StackTrace> v8StackTrace,
int maxStackSize) { … }
void calculateAsyncChain(V8Debugger* debugger,
std::shared_ptr<AsyncStackTrace>* asyncParent,
V8StackTraceId* externalParent, int* maxAsyncDepth) { … }
std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectCommon(
V8Debugger* debugger,
const std::vector<std::shared_ptr<StackFrame>>& frames,
const String16& description,
const std::shared_ptr<AsyncStackTrace>& asyncParent,
const V8StackTraceId& externalParent, int maxAsyncDepth) { … }
}
V8StackTraceId::V8StackTraceId()
: … { … }
V8StackTraceId::V8StackTraceId(uintptr_t id,
const std::pair<int64_t, int64_t> debugger_id)
: … { … }
V8StackTraceId::V8StackTraceId(uintptr_t id,
const std::pair<int64_t, int64_t> debugger_id,
bool should_pause)
: … { … }
V8StackTraceId::V8StackTraceId(StringView json)
: … { … }
bool V8StackTraceId::IsInvalid() const { … }
std::unique_ptr<StringBuffer> V8StackTraceId::ToString() { … }
StackFrame::StackFrame(String16&& functionName, int scriptId,
String16&& sourceURL, int lineNumber, int columnNumber,
bool hasSourceURLComment)
: … { … }
const String16& StackFrame::functionName() const { … }
int StackFrame::scriptId() const { … }
const String16& StackFrame::sourceURL() const { … }
int StackFrame::lineNumber() const { … }
int StackFrame::columnNumber() const { … }
std::unique_ptr<protocol::Runtime::CallFrame> StackFrame::buildInspectorObject(
V8InspectorClient* client) const { … }
bool StackFrame::isEqual(StackFrame* frame) const { … }
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(
V8Debugger* debugger, v8::Local<v8::StackTrace> v8StackTrace,
int maxStackSize) { … }
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(
V8Debugger* debugger, int maxStackSize) { … }
V8StackTraceImpl::V8StackTraceImpl(
std::vector<std::shared_ptr<StackFrame>> frames, int maxAsyncDepth,
std::shared_ptr<AsyncStackTrace> asyncParent,
const V8StackTraceId& externalParent)
: … { … }
V8StackTraceImpl::~V8StackTraceImpl() = default;
std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone() { … }
StringView V8StackTraceImpl::firstNonEmptySourceURL() const { … }
bool V8StackTraceImpl::isEmpty() const { … }
StringView V8StackTraceImpl::topSourceURL() const { … }
int V8StackTraceImpl::topLineNumber() const { … }
int V8StackTraceImpl::topColumnNumber() const { … }
int V8StackTraceImpl::topScriptId() const { … }
StringView V8StackTraceImpl::topFunctionName() const { … }
std::vector<V8StackFrame> V8StackTraceImpl::frames() const { … }
std::unique_ptr<protocol::Runtime::StackTrace>
V8StackTraceImpl::buildInspectorObjectImpl(V8Debugger* debugger) const { … }
std::unique_ptr<protocol::Runtime::StackTrace>
V8StackTraceImpl::buildInspectorObjectImpl(V8Debugger* debugger,
int maxAsyncDepth) const { … }
std::unique_ptr<protocol::Runtime::API::StackTrace>
V8StackTraceImpl::buildInspectorObject(int maxAsyncDepth) const { … }
std::unique_ptr<StringBuffer> V8StackTraceImpl::toString() const { … }
bool V8StackTraceImpl::isEqualIgnoringTopFrame(
V8StackTraceImpl* stackTrace) const { … }
V8StackTraceImpl::StackFrameIterator::StackFrameIterator(
const V8StackTraceImpl* stackTrace)
: … { … }
void V8StackTraceImpl::StackFrameIterator::next() { … }
bool V8StackTraceImpl::StackFrameIterator::done() { … }
StackFrame* V8StackTraceImpl::StackFrameIterator::frame() { … }
std::shared_ptr<AsyncStackTrace> AsyncStackTrace::capture(
V8Debugger* debugger, const String16& description, bool skipTopFrame) { … }
AsyncStackTrace::AsyncStackTrace(
const String16& description,
std::vector<std::shared_ptr<StackFrame>> frames,
std::shared_ptr<AsyncStackTrace> asyncParent,
const V8StackTraceId& externalParent)
: … { … }
std::unique_ptr<protocol::Runtime::StackTrace>
AsyncStackTrace::buildInspectorObject(V8Debugger* debugger,
int maxAsyncDepth) const { … }
uintptr_t AsyncStackTrace::store(V8Debugger* debugger,
std::shared_ptr<AsyncStackTrace> stack) { … }
const String16& AsyncStackTrace::description() const { … }
std::weak_ptr<AsyncStackTrace> AsyncStackTrace::parent() const { … }
bool AsyncStackTrace::isEmpty() const { … }
}