Skip to content

Commit b7bfe39

Browse files
authored
[SYCL][GDB] Fix op[] when called with typedef argument (#6459)
The implementation of 'index' did not strip typedefs from the argument passed to it, when passed as a single number. Instead, TYPE_CODE_INT was expected. This leads to failures when calling 'accessor[arg]' using an arg that is either a typedef or something like size_t, which are considered TYPE_CODE_TYPEDEF inside GDB. The check fails and the function continues on and fails even though the argument could have been used in the int cast. Typedef stripping was added to the if condition to fix this. Signed-off-by: Nils-Christian Kempke <[email protected]>
1 parent e87adfd commit b7bfe39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sycl/gdb/libsycl.so-gdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, obj, result_type, depth):
2828
self.depth = depth
2929

3030
def index(self, arg):
31-
if arg.type.code == gdb.TYPE_CODE_INT:
31+
if arg.type.unqualified().strip_typedefs().code == gdb.TYPE_CODE_INT:
3232
return int(arg)
3333
# unwrap if inside item
3434
try:

0 commit comments

Comments
 (0)