debugger.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <memory>
  5. #include "common/common_types.h"
  6. namespace Kernel {
  7. class KThread;
  8. struct DebugWatchpoint;
  9. } // namespace Kernel
  10. namespace Core {
  11. class System;
  12. class DebuggerImpl;
  13. class Debugger {
  14. public:
  15. /**
  16. * Blocks and waits for a connection on localhost, port `server_port`.
  17. * Does not create the debugger if the port is already in use.
  18. */
  19. explicit Debugger(Core::System& system, u16 server_port);
  20. ~Debugger();
  21. /**
  22. * Notify the debugger that the given thread is stopped
  23. * (due to a breakpoint, or due to stopping after a successful step).
  24. *
  25. * The debugger will asynchronously halt emulation after the notification has
  26. * occurred. If another thread attempts to notify before emulation has stopped,
  27. * it is ignored and this method will return false. Otherwise it will return true.
  28. */
  29. bool NotifyThreadStopped(Kernel::KThread* thread);
  30. /**
  31. * Notify the debugger that a shutdown is being performed now and disconnect.
  32. */
  33. void NotifyShutdown();
  34. /*
  35. * Notify the debugger that the given thread has stopped due to hitting a watchpoint.
  36. */
  37. bool NotifyThreadWatchpoint(Kernel::KThread* thread, const Kernel::DebugWatchpoint& watch);
  38. private:
  39. std::unique_ptr<DebuggerImpl> impl;
  40. };
  41. } // namespace Core