class DebugAdapterContext

Defined at line 60 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

Handles processing requests from debug adapter client with help from zxdb client session and dap

library.

Note: All methods in this class need to be executed on main thread to avoid concurrency bugs.

Public Methods

void DebugAdapterContext (Console * console, debug::StreamBuffer * stream)

Defined at line 68 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

Console * console ()

Defined at line 71 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

Session * session ()

Defined at line 72 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

dap::Session & dap ()

Defined at line 73 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

debug::StreamBuffer * stream ()

Defined at line 74 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

bool supports_run_in_terminal ()

Defined at line 75 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

void set_destroy_connection_callback (DestroyConnectionCallback cb)

Callback to delete the connection and hence this context. This callback will be posted on

message loop.

Defined at line 82 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

void ~DebugAdapterContext ()

Defined at line 113 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

const std::vector<Filter *> & filters ()

Defined at line 143 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

void DeinitializeAsyncBacktraceSubscriptionForTesting ()

Deinitializes the `AsyncBacktraceSubscription` for testing purposes.

This can be used to reduce noise for tests that don't care about async backtrace behavior, as

leaving it in-place results in additional `dap::Event`s on thread events, requiring extra

`RunClient()` calls.

This can only be called once, after `DebugAdapterContext::Init`.

Defined at line 152 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

void OnStreamReadable ()

Notification about the stream.

Defined at line 330 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DidResolveConnection (const Err & err)

SessionObserver implementation:

Defined at line 125 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DidCreateThread (Thread * thread)

ThreadObserver implementation:

Defined at line 340 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void WillDestroyThread (Thread * thread)

Defined at line 347 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void OnThreadStopped (Thread * thread, const StopInfo & info)

Defined at line 354 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DidUpdateStackFrames (Thread * thread)

Defined at line 400 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DidCreateProcess (Process * process, uint64_t timestamp)

ProcessObserver implementation:

Defined at line 402 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void WillDestroyProcess (Process * process, DestroyReason reason, int exit_code, uint64_t timestamp)

Defined at line 420 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void OnBreakpointMatched (Breakpoint * breakpoint, bool user_requested)

BreakpointObserver implementation:

Defined at line 450 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void WillDestroyFilter (Filter * filter)

SystemObserver implementation:

Defined at line 717 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

Thread * GetThread (uint64_t koid)

Defined at line 463 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

Err CheckStoppedThread (Thread * thread)

Checks if thread is in stopped state; returns error if not stopped.

`thread` can be nullptr, in which case an error is returned.

Defined at line 485 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

std::vector<PrettyStackManager::Match> GetElidedFrames (const Stack & stack)

Returns a vector of elided frame matches against a stack.

The returned vector will have the same `size()` as the `stack`.

Defined at line 506 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

int64_t IdForFrame (uint64_t thread_koid, int64_t stack_index)

Helper methods to get/set frame to ID mapping

Defined at line 538 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

Frame * FrameforId (int64_t id)

Defined at line 554 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DeleteFrameIdsForThread (Thread * thread)

Defined at line 574 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

int64_t IdForVariables (int64_t frame_id, VariablesType type, std::unique_ptr<FormatNode> parent, fxl::WeakPtr<FormatNode> child)

Helper methods to get/set variables references

Defined at line 599 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

VariablesRecord * VariablesRecordForID (int64_t id)

Defined at line 623 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DeleteVariablesIdsForFrameId (int64_t id)

Defined at line 636 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void StoreBreakpointForSource (const std::filesystem::path & source, Breakpoint * bp)

Helper methods to get/set breakpoint to source file mapping.

Defined at line 646 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

std::vector<fxl::WeakPtr<Breakpoint>> * GetBreakpointsForSource (const std::filesystem::path & source)

Defined at line 652 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

int64_t IdForBreakpoint (Breakpoint * breakpoint)

Helper methods to get/set breakpoint to ID mapping

Defined at line 439 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DeleteBreakpointsForSource (const std::filesystem::path & source)

These 2 methods only delete breakpoints added by the debug adapter.

Breakpoints added from console are not deleted.

Defined at line 661 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DeleteAllBreakpoints ()

Defined at line 676 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void StoreFilter (Filter * filter)

Defined at line 688 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void DeleteAllFilters ()

Deletes all filters created dynamically by this DAP connection context.

We manage and clean up our own filters locally via `filters_` instead of calling the global

`session()->system().GetFilters()` because the debugger process and the core Session survive

DAP disconnections. Deleting all global filters on connection teardown would destructively

wipe out the developer's pre-configured startup filters loaded from `~/.fuchsia/debug/zxdbrc`

(e.g., `attach cobalt.cm`).

Defined at line 702 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc