Handle multiple target events before commit resume
[deliverable/binutils-gdb.git] / gdb / rocm-tdep.h
1 /* Target-dependent code for ROCm.
2
3 Copyright (C) 2019-2020 Free Software Foundation, Inc.
4 Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 #ifndef _ROCM_TDEP_H
22 #define _ROCM_TDEP_H 1
23
24 #include "gdbsupport/common-defs.h"
25 #include "gdbsupport/observable.h"
26
27 #include <type_traits>
28
29 #include <amd-dbgapi.h>
30
31 /* ROCm Debug API event observers. */
32
33 extern gdb::observers::observable<> amd_dbgapi_activated;
34 extern gdb::observers::observable<> amd_dbgapi_deactivated;
35 extern gdb::observers::observable<> amd_dbgapi_code_object_list_updated;
36
37 /* Return true if the given ptid is a GPU thread (wave) ptid. */
38
39 static inline bool
40 ptid_is_gpu (ptid_t ptid)
41 {
42 return ptid.pid () != 1 && ptid.lwp () == 1;
43 }
44
45 /* Return true if this is the AMDGCN architecture. */
46 extern bool rocm_is_amdgcn_gdbarch (struct gdbarch *gdbarch);
47
48 /* Return the current inferior's amd_dbgapi process id. */
49 extern amd_dbgapi_process_id_t
50 get_amd_dbgapi_process_id (struct inferior *inferior = nullptr);
51
52 static inline amd_dbgapi_wave_id_t
53 get_amd_dbgapi_wave_id (ptid_t ptid)
54 {
55 return amd_dbgapi_wave_id_t{
56 static_cast<decltype (amd_dbgapi_wave_id_t::handle)> (ptid.tid ())
57 };
58 }
59
60 #endif /* rocm-tdep.h */
This page took 0.02988 seconds and 4 git commands to generate.