test-target.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* A mock process_stratum target_ops
  2. Copyright (C) 2017-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef TEST_TARGET_H
  15. #define TEST_TARGET_H
  16. #include "process-stratum-target.h"
  17. #if GDB_SELF_TEST
  18. namespace selftests {
  19. /* A mock process_stratum target_ops that doesn't read/write registers
  20. anywhere. */
  21. class test_target_ops : public process_stratum_target
  22. {
  23. public:
  24. test_target_ops () = default;
  25. const target_info &info () const override;
  26. bool has_registers () override
  27. {
  28. return true;
  29. }
  30. bool has_stack () override
  31. {
  32. return true;
  33. }
  34. bool has_memory () override
  35. {
  36. return true;
  37. }
  38. void prepare_to_store (regcache *regs) override
  39. {
  40. }
  41. void store_registers (regcache *regs, int regno) override
  42. {
  43. }
  44. };
  45. } // namespace selftests
  46. #endif /* GDB_SELF_TEST */
  47. #endif /* !defined (TEST_TARGET_H) */