[RFC PATCH 0/3] Pretty-printing for errno
Pedro Alves
palves@redhat.com
Thu Sep 7 11:34:00 GMT 2017
On 09/06/2017 10:03 PM, Zack Weinberg wrote:
> So, changes to both gdb and libthread_db seem to be required here. I
> do think that _in principle_ it ought to be possible to use
> libthread_db to retrieve the address of thread-local data even if the
> inferior is not linked with libpthread; glibc has quite a few
> thread-specific variables (errno most prominent, of course, but also
> h_errno, _res, etc), and so might any library which can be used from
> both single- and multithreaded programs.
>
> This is really not code I feel comfortable hacking up, though, and
> it's probably more of a project than I have time for, in any case.
Sounds like a promising approach though. I'd like to see this path
explored a bit more. I'll keep this in my TODO, even though it's
not likely to bubble up very soon. Thanks for the discussion/ideas!
>
> ...
>>> called when the module is loaded; what would I need to add to that so
>>> that the macro is defined (if it isn't already)?
>>
>> I'm hoping that other people more experienced with the gdb
>> Python API can chime in. My idea was just to call
>> gdb.execute ("macro define errno (*(int *) __errno_location ())")
>> somewhere around your Python code.
>
> I'll tinker with that. Thanks.
Thanks,
Pedro Alves
More information about the Libc-alpha
mailing list