@@ -29,6 +29,11 @@ def __init__(self, obj, result_type, depth):
29
29
def index (self , arg ):
30
30
if arg .type .code == gdb .TYPE_CODE_INT :
31
31
return int (arg )
32
+ # unwrap if inside item
33
+ try :
34
+ arg = arg ['MImpl' ]['MIndex' ]
35
+ except :
36
+ pass
32
37
# https://github.com/intel/llvm/blob/97272b7ebd569bfa13811913a31e30f926559217/sycl/include/CL/sycl/accessor.hpp#L678-L690
33
38
result = 0
34
39
for dim in range (self .depth ):
@@ -126,6 +131,17 @@ def get_arg_types(self):
126
131
assert self .depth == 1
127
132
return gdb .lookup_type ('size_t' )
128
133
134
+ class AccessorOpIndexItemTrue (AccessorOpIndex ):
135
+ """Introduces an extra overload for item wrapper"""
136
+
137
+ def get_arg_types (self ):
138
+ return gdb .lookup_type ("cl::sycl::item<%s, true>" % self .depth )
139
+
140
+ class AccessorOpIndexItemFalse (AccessorOpIndex ):
141
+ """Introduces an extra overload for item wrapper"""
142
+
143
+ def get_arg_types (self ):
144
+ return gdb .lookup_type ("cl::sycl::item<%s, false>" % self .depth )
129
145
130
146
class AccessorMatcher (gdb .xmethod .XMethodMatcher ):
131
147
"""Entry point for cl::sycl::accessor"""
@@ -146,6 +162,18 @@ def match(self, class_type, method_name):
146
162
methods = [
147
163
AccessorOpIndex (class_type , result_type , depth )
148
164
]
165
+ try :
166
+ method = AccessorOpIndexItemTrue (class_type , result_type , depth )
167
+ method .get_arg_types ()
168
+ methods .append (method )
169
+ except :
170
+ pass
171
+ try :
172
+ method = AccessorOpIndexItemFalse (class_type , result_type , depth )
173
+ method .get_arg_types ()
174
+ methods .append (method )
175
+ except :
176
+ pass
149
177
if depth == 1 :
150
178
methods .append (AccessorOpIndex1D (class_type , result_type , depth ))
151
179
return methods
0 commit comments