aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch/arm-get-next-pcs.h
blob: 583046eed448df3d80a9a94650d394c82eb2f799 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Common code for ARM software single stepping support.

   Copyright (C) 1988-2023 Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef ARCH_ARM_GET_NEXT_PCS_H
#define ARCH_ARM_GET_NEXT_PCS_H

#include <vector>

/* Forward declaration.  */
struct arm_get_next_pcs;

/* get_next_pcs operations.  */
struct arm_get_next_pcs_ops
{
  ULONGEST (*read_mem_uint) (CORE_ADDR memaddr, int len, int byte_order);
  CORE_ADDR (*syscall_next_pc) (struct arm_get_next_pcs *self);
  CORE_ADDR (*addr_bits_remove) (struct arm_get_next_pcs *self, CORE_ADDR val);
  int (*is_thumb) (struct arm_get_next_pcs *self);

  /* Fix up PC if needed.  */
  CORE_ADDR (*fixup) (struct arm_get_next_pcs *self, CORE_ADDR pc);
};

/* Context for a get_next_pcs call on ARM.  */
struct arm_get_next_pcs
{
  /* Operations implementations.  */
  struct arm_get_next_pcs_ops *ops;
  /* Byte order for data.  */
  int byte_order;
  /* Byte order for code.  */
  int byte_order_for_code;
  /* Whether the target has 32-bit thumb-2 breakpoint defined or
     not.  */
  int has_thumb2_breakpoint;
  /* Registry cache.  */
  struct regcache *regcache;
};

/* Initialize arm_get_next_pcs.  */
void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
			    struct arm_get_next_pcs_ops *ops, int byte_order,
			    int byte_order_for_code, int has_thumb2_breakpoint,
			    struct regcache *regcache);

/* Find the next possible PCs after the current instruction executes.  */
std::vector<CORE_ADDR> arm_get_next_pcs (struct arm_get_next_pcs *self);

#endif /* ARCH_ARM_GET_NEXT_PCS_H */