GDB (xrefs)
Loading...
Searching...
No Matches
amdgpu-tdep.h
Go to the documentation of this file.
1/* Target-dependent code for the AMDGPU architectures.
2
3 Copyright (C) 2019-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef AMDGPU_TDEP_H
21#define AMDGPU_TDEP_H
22
23#include "gdbarch.h"
24
25#include <amd-dbgapi/amd-dbgapi.h>
26#include <unordered_map>
27
28/* Provide std::unordered_map::Hash for amd_dbgapi_register_id_t. */
30{
31 size_t
32 operator() (const amd_dbgapi_register_id_t &register_id) const
33 {
34 return std::hash<decltype (register_id.handle)> () (register_id.handle);
35 }
36};
37
38/* Provide std::unordered_map::Equal for amd_dbgapi_register_id_t. */
40{
41 bool
42 operator() (const amd_dbgapi_register_id_t &lhs,
43 const amd_dbgapi_register_id_t &rhs) const
44 {
45 return std::equal_to<decltype (lhs.handle)> () (lhs.handle, rhs.handle);
46 }
47};
48
49/* AMDGPU architecture specific information. */
51{
52 /* This architecture's breakpoint instruction. */
53 gdb::unique_xmalloc_ptr<gdb_byte> breakpoint_instruction_bytes;
55
56 /* A vector of register_ids indexed by their equivalent gdb regnum. */
57 std::vector<amd_dbgapi_register_id_t> register_ids;
58
59 /* A vector of register_properties indexed by their equivalent gdb regnum. */
60 std::vector<amd_dbgapi_register_properties_t> register_properties;
61
62 /* A vector of register names indexed by their equivalent gdb regnum. */
63 std::vector<std::string> register_names;
64
65 /* A vector of register types created from the amd-dbgapi type strings,
66 indexed by their equivalent gdb regnum. These are computed lazily by
67 amdgpu_register_type, entries that haven't been computed yet are
68 nullptr. */
69 std::vector<type *> register_types;
70
71 /* A vector of GDB register numbers indexed by DWARF register number.
72
73 Unused DWARF register numbers map to value -1. */
75
76 /* A map of gdb regnums keyed by they equivalent register_id. */
77 std::unordered_map<amd_dbgapi_register_id_t, int, register_id_hash,
80
81 /* A map of register_class_ids keyed by their name. */
82 std::unordered_map<std::string, amd_dbgapi_register_class_id_t>
84};
85
86/* Return true if GDBARCH is of an AMDGPU architecture. */
87bool is_amdgpu_arch (struct gdbarch *gdbarch);
88
89/* Return the amdgpu-specific data associated to ARCH. */
90
92
93#endif /* AMDGPU_TDEP_H */
bool is_amdgpu_arch(struct gdbarch *gdbarch)
Definition amdgpu-tdep.c:40
amdgpu_gdbarch_tdep * get_amdgpu_gdbarch_tdep(gdbarch *arch)
Definition amdgpu-tdep.c:49
std::vector< int > dwarf_regnum_to_gdb_regnum
Definition amdgpu-tdep.h:74
std::unordered_map< std::string, amd_dbgapi_register_class_id_t > register_class_map
Definition amdgpu-tdep.h:83
size_t breakpoint_instruction_size
Definition amdgpu-tdep.h:54
std::vector< amd_dbgapi_register_id_t > register_ids
Definition amdgpu-tdep.h:57
std::vector< type * > register_types
Definition amdgpu-tdep.h:69
std::vector< std::string > register_names
Definition amdgpu-tdep.h:63
gdb::unique_xmalloc_ptr< gdb_byte > breakpoint_instruction_bytes
Definition amdgpu-tdep.h:53
std::unordered_map< amd_dbgapi_register_id_t, int, register_id_hash, register_id_equal_to > regnum_map
Definition amdgpu-tdep.h:79
std::vector< amd_dbgapi_register_properties_t > register_properties
Definition amdgpu-tdep.h:60
bool operator()(const amd_dbgapi_register_id_t &lhs, const amd_dbgapi_register_id_t &rhs) const
Definition amdgpu-tdep.h:42
size_t operator()(const amd_dbgapi_register_id_t &register_id) const
Definition amdgpu-tdep.h:32