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

Console * console ()

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

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

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

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 85 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

void ~DebugAdapterContext ()

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

const std::vector<fxl::WeakPtr<Breakpoint>> & GetFunctionBreakpoints ()

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

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

Defined at line 153 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 162 of file ../../src/developer/debug/zxdb/debug_adapter/context.h

fxl::WeakPtr<DebugAdapterContext> GetWeakPtr ()

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

void OnStreamReadable ()

Notification about the stream.

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

void OnProcessPaused (Process * process)

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

void OnThreadPaused (Thread * thread)

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

void DidResolveConnection (const Err & err)

SessionObserver implementation:

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

void DidCreateThread (Thread * thread)

ThreadObserver implementation:

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

void WillDestroyThread (Thread * thread)

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

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

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

void DidUpdateStackFrames (Thread * thread)

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

void DidCreateProcess (Process * process, uint64_t timestamp)

ProcessObserver implementation:

Defined at line 478 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 496 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

void OnBreakpointMatched (Breakpoint * breakpoint, bool user_requested)

BreakpointObserver implementation:

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

void WillDestroyFilter (Filter * filter)

SystemObserver implementation:

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

Thread * GetThread (uint64_t koid)

Defined at line 539 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 561 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 582 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 614 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

Frame * FrameforId (int64_t id)

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

void DeleteFrameIdsForThread (Thread * thread)

Defined at line 650 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 675 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

VariablesRecord * VariablesRecordForID (int64_t id)

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

void DeleteVariablesIdsForFrameId (int64_t id)

Defined at line 712 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 722 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

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

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

void StoreFunctionBreakpoint (Breakpoint * bp)

Helper methods to get/set function breakpoint mapping.

Defined at line 752 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 515 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc

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

These methods only delete breakpoints added by the debug adapter.

Breakpoints added from console are not deleted.

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

void DeleteAllFunctionBreakpoints ()

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

void DeleteAllBreakpoints ()

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

void StoreFilter (Filter * filter)

Defined at line 781 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 795 of file ../../src/developer/debug/zxdb/debug_adapter/context.cc