1 /* Target-dependent code for ROCm.
3 Copyright (C) 2019-2020 Free Software Foundation, Inc.
4 Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
6 This file is part of GDB.
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.
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.
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/>. */
22 #define _ROCM_TDEP_H 1
24 #include "gdbsupport/common-defs.h"
25 #include "gdbsupport/observable.h"
27 #include <type_traits>
29 #include <amd-dbgapi.h>
31 /* ROCm Debug API event observers. */
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
;
37 /* Return true if the given ptid is a GPU thread (wave) ptid. */
40 ptid_is_gpu (ptid_t ptid
)
42 return ptid
.pid () != 1 && ptid
.lwp () == 1;
45 /* Return true if this is the AMDGCN architecture. */
46 extern bool rocm_is_amdgcn_gdbarch (struct gdbarch
*gdbarch
);
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);
52 static inline amd_dbgapi_wave_id_t
53 get_amd_dbgapi_wave_id (ptid_t ptid
)
55 return amd_dbgapi_wave_id_t
{
56 static_cast<decltype (amd_dbgapi_wave_id_t::handle
)> (ptid
.tid ())
60 #endif /* rocm-tdep.h */