public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mm 42/43] x86 core dump TLS
  2007-12-20 11:52 [PATCH -mm 00/43] user_regset framework -- arch maintainers take note! Roland McGrath
@ 2007-12-20 12:00 ` Roland McGrath
  0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2007-12-20 12:00 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel

This makes ELF core dumps of 32-bit processes include a new
note type NT_386_TLS (0x200) giving the contents of the TLS
slots in struct user_desc format.  This lets post mortem
examination figure out what the segment registers mean like
the debugger does with get_thread_area on a live process.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/ptrace.c |    1 +
 include/linux/elf.h      |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index e8c2ba3..25b6578 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1314,6 +1314,7 @@ static const struct user_regset x86_32_regsets[] = {
 		.active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
 	},
 	[REGSET_TLS] = {
+		.core_note_type = NT_386_TLS,
 		.n = GDT_ENTRY_TLS_ENTRIES, .bias = GDT_ENTRY_TLS_MIN,
 		.size = sizeof(struct user_desc),
 		.align = sizeof(struct user_desc),
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ba268b2..30eb6fb 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -356,6 +356,7 @@ typedef struct elf64_shdr {
 #define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
 #define NT_PPC_VMX	0x100		/* PowerPC Altivec/VMX registers */
 #define NT_PPC_SPE	0x101		/* PowerPC SPE/EVR registers */
+#define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
 
 
 /* Note header in a PT_NOTE section */
-- 
1.5.3.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -mm 42/43] x86 core dump TLS
@ 2010-10-20 14:31 Tom Horsley
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Horsley @ 2010-10-20 14:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Horsley, Tom

Way back in 2007 this patch started wending its way into the
kernel:

http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg242889.html

That adds the NT_386_TLS NOTE segment entries to core files, which
are quite handy for recovering the pthread_self() values for
multiple threads in a core file from a 32 bit x86 threaded program.

Does anyone know why there doesn't appear to be any similar info
dumped for the thread info in 64 bit x86_64 threaded programs?
The pthread library uses the arch_prctl() service to setup the
segment registers there, and it would be handy for debuggers
to be able to recover the thread info in 64 bit core files as well.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-20 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 14:31 [PATCH -mm 42/43] x86 core dump TLS Tom Horsley
  -- strict thread matches above, loose matches on Subject: below --
2007-12-20 11:52 [PATCH -mm 00/43] user_regset framework -- arch maintainers take note! Roland McGrath
2007-12-20 12:00 ` [PATCH -mm 42/43] x86 core dump TLS Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox