[wip] gdb: include NT_I386_TLS note in generated core files
This commit extends GDB for x86/Linux to include the NT_I386_TLS note
in generated core file (i.e. created with `generate-core-file`
command).
The NT_I386_TLS note should be added for i386 binaries, and for
binaries compiled with -m32.
[TODO] This commit does adds a basic framework for accessing the TLS
data, but currently only reads the information for one thread (the
current thread when the core file is created), which is not correct.
An actual kernel create core file includes a NT_I386_TLS for each
thread, so that needs fixing.
[TODO] Also, this commit doesn't know how to fetch the TLS descriptor
information for remote targets, so that needs fixing.
[TODO] Looking at how ARM/AArch64 handles similar TLS data, that
targets seems to use a custom register set. I wonder if the approach
I've taken here is the wrong one; maybe we should add 3 custom
registers, each register representing 1 GDT entry, with an entry being
a base-address and limit. GDB would then try to read that register
set for each thread... I'm not entirely sure on the details, I'll
need to investigate how ARM/AArch64 does this a little more.
[TODO] This commit could do with a test in gdb.arch/. Not sure
exactly what the test should do yet, but probably create a
multi-threaded inferior (with some TLS usage?) and generate a core
file. We can then check that there is a NT_I386_TLS for each thread.
We can then load the core file and perform some action that depends on
the TLS descriptor ... need to figure out exactly what that is though.
[TODO] Finally, I wonder if we should add a new command that allows a
user to inspect the TLS descriptor information, though this should
probably be broken out into a separate commit.