Thread Specific Architectures And Python Unwinder API

Luis Machado
Thu Oct 12 11:30:26 GMT 2023

On 10/11/23 11:06, Luis Machado wrote:
> Hi Andrew,
> On 10/11/23 09:47, Andrew Burgess wrote:
>> Hi Luis,
>> While working on something else I was looking at the Python Unwinder API
>> code, and I suspect that the thread-specific architectures support might
>> (currently) break the Python Unwinder support.
>> If it is, then I think the fix is pretty simple, but before I posted it,
>> I wondered if you could confirm that things are indeed, currently
>> broken.
>> Attached at the end of this email is a Python unwinder.  You'll need to
>> supply your own test program that makes use of sve/sme, and thus uses
>> thread-specific architectures.
>> What you'll need to do is:
>>   $ gdb -q test_file_that_uses_sve_sme
>>   Reading symbols from .... etc ...
>>   (gdb) source ./
>>   (gdb) break function_where_a_thread_specific_arch_will_be_in_use
>>   Breakpoint 1 at ... etc ...
>>   (gdb) run
>>   Starting program: ... etc ...
>> Now at this point, when you stop, you should see at least one instance
>> of the banner:
>>   ***********************************
>>   * Have executed the test unwinder *
>>   ***********************************
>> being printed, probably more.  As you step though the function you
>> should see more instances of the banner being printed.
>> To reveal the bug then it is important that when GDB stops in
>> function_where_a_thread_specific_arch_will_be_in_use, the per-thread
>> gdbarch that it creates _must_ be different from the inferior wide,
>> top-level gdbarch.
>> If you don't see the banner then my suspicion is correct, and the Python
>> Unwinder API was broken when the thread-specific architecture support
>> was added.

I've confirmed I don't see the banner. So this seems to be broken.

Is the fix to set the python unwinder hook elsewhere? Or maybe save that
information when we're trying to pick a different gdbarch?

More information about the Gdb mailing list