Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bcc: Fix hash table batch operation attribute error
Some tools get errors when kernel supports hash table batch operations and hash key or value is integer type. AttributeError: 'long' object has no attribute 'value' It's caused by ctypes library from python. For example, when hash tables try to do batch lookup, it will alloc arrays to stores keys and values first. If it is a ctypes integer type, after expanding to array, type of element will be changed to python 'long' or 'int'. When trying to access its value attribute, error message is generated. >>> from ctypes import * >>> a = c_uint(10) >>> type(a) <class 'ctypes.c_uint'> >>> a.value 10 >>> b = (c_uint * 1)(10) >>> type(b) <class '__main__.c_uint_Array_1'> >>> b[0].value Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'int' object has no attribute 'value' Turn back to original ctypes type can avoid this error. Change-Id: Ia8598510e79ec9a3b73de3e343b9781c97ead894 Signed-off-by: mickey_zhu <[email protected]>
- Loading branch information