[PATCH] gdb-gdb.py: strip typedefs in intrusive_list printer assertion

Simon Marchi simon.marchi@polymtl.ca
Fri Jul 19 20:31:30 GMT 2024



On 2024-07-19 07:42, Andrew Burgess wrote:
> Simon Marchi <simon.marchi@polymtl.ca> writes:
> 
>> When debugging gdb itself and trying to print a intrusive_list that has
>> more than one element, I get:
>>
>>     File "/home/simark/build/binutils-gdb-all-targets/gdb/gdb-gdb.py", line 365, in _children_generator
>>       node_ptr = self._as_node_ptr(elem_ptr)
>>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>     File "/home/simark/build/binutils-gdb-all-targets/gdb/gdb-gdb.py", line 345, in _as_node_ptr
>>       assert elem_ptr.type.code == gdb.TYPE_CODE_PTR
>>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>     AssertionError
>>
>> This is because node_ptr is a typedef
>> (intrusive_list_base_iterator::pointer).  Add a call to strip_typedefs
>> to get to the real type.
>>
>> Enhance gdb.gdb/python-helper.exp with a test that would have caught
>> this bug.
> 
> Thanks for extending the test case.
> 
> This LGTM.
> 
> Approved-By: Andrew Burgess <aburgess@redhat.com>
> 
> Thanks,
> Andrew

Thanks, pushed.

Simon


More information about the Gdb-patches mailing list