Path: blob/master/editor/debugger/debug_adapter/debug_adapter_parser.h
9913 views
/**************************************************************************/1/* debug_adapter_parser.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "core/config/project_settings.h"33#include "core/debugger/remote_debugger.h"34#include "debug_adapter_protocol.h"35#include "debug_adapter_types.h"3637struct DAPeer;38class DebugAdapterProtocol;3940class DebugAdapterParser : public Object {41GDCLASS(DebugAdapterParser, Object);4243private:44friend DebugAdapterProtocol;4546_FORCE_INLINE_ bool is_valid_path(const String &p_path) const {47// If path contains \, it's a Windows path, so we need to convert it to /, and check as case-insensitive.48if (p_path.contains_char('\\')) {49String project_path = ProjectSettings::get_singleton()->get_resource_path();50String path = p_path.replace_char('\\', '/');51return path.containsn(project_path);52}53return p_path.begins_with(ProjectSettings::get_singleton()->get_resource_path());54}5556protected:57static void _bind_methods();5859Dictionary prepare_base_event() const;60Dictionary prepare_success_response(const Dictionary &p_params) const;61Dictionary prepare_error_response(const Dictionary &p_params, DAP::ErrorType err_type, const Dictionary &variables = Dictionary()) const;6263Dictionary ev_stopped() const;6465public:66// Requests67Dictionary req_initialize(const Dictionary &p_params) const;68Dictionary req_launch(const Dictionary &p_params) const;69Dictionary req_disconnect(const Dictionary &p_params) const;70Dictionary req_attach(const Dictionary &p_params) const;71Dictionary req_restart(const Dictionary &p_params) const;72Dictionary req_terminate(const Dictionary &p_params) const;73Dictionary req_configurationDone(const Dictionary &p_params) const;74Dictionary req_pause(const Dictionary &p_params) const;75Dictionary req_continue(const Dictionary &p_params) const;76Dictionary req_threads(const Dictionary &p_params) const;77Dictionary req_stackTrace(const Dictionary &p_params) const;78Dictionary req_setBreakpoints(const Dictionary &p_params) const;79Dictionary req_breakpointLocations(const Dictionary &p_params) const;80Dictionary req_scopes(const Dictionary &p_params) const;81Dictionary req_variables(const Dictionary &p_params) const;82Dictionary req_next(const Dictionary &p_params) const;83Dictionary req_stepIn(const Dictionary &p_params) const;84Dictionary req_evaluate(const Dictionary &p_params) const;85Dictionary req_godot_put_msg(const Dictionary &p_params) const;8687// Internal requests88Dictionary _launch_process(const Dictionary &p_params) const;8990// Events91Dictionary ev_initialized() const;92Dictionary ev_process(const String &p_command) const;93Dictionary ev_terminated() const;94Dictionary ev_exited(const int &p_exitcode) const;95Dictionary ev_stopped_paused() const;96Dictionary ev_stopped_exception(const String &p_error) const;97Dictionary ev_stopped_breakpoint(const int &p_id) const;98Dictionary ev_stopped_step() const;99Dictionary ev_continued() const;100Dictionary ev_output(const String &p_message, RemoteDebugger::MessageType p_type) const;101Dictionary ev_custom_data(const String &p_msg, const Array &p_data) const;102Dictionary ev_breakpoint(const DAP::Breakpoint &p_breakpoint, const bool &p_enabled) const;103};104105106