[commit+7.4,arm/bfd] Fill in core_pid to fix GDB corethreads.exp failures

Message ID 201112212125.pBLLPwQa029028@d06av02.portsmouth.uk.ibm.com
State Accepted
Headers show

Commit Message

Ulrich Weigand Dec. 21, 2011, 9:25 p.m.

I've noticed another couple of additional test suite failures in GDB 7.4:
FAIL: gdb.threads/corethreads.exp: thread0 found
FAIL: gdb.threads/corethreads.exp: thread1 found

These test verify that GDB shows proper pthread_t thread IDs for core
files.  This works only if bfd_core_file_pid returns the correct PID,
which only works if the ->core_pid field is filled in by target code.

This has been added on a number of platforms, but not ARM so far.

The (obvious) patch below fixes this by filling in this field in

Tested on arm-linux-gnueabi, fixes the above test cases.
Committed to mainline and (GDB) 7.4 branch.



	* elf32-arm.c (elf32_arm_nabi_grok_psinfo): Fill in core_pid.


Index: bfd/elf32-arm.c
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.281
diff -u -p -r1.281 elf32-arm.c
--- bfd/elf32-arm.c	17 Nov 2011 00:20:01 -0000	1.281
+++ bfd/elf32-arm.c	21 Dec 2011 20:18:30 -0000
@@ -1966,6 +1966,8 @@  elf32_arm_nabi_grok_psinfo (bfd *abfd, E
 	return FALSE;
       case 124:		/* Linux/ARM elf_prpsinfo.  */
+	elf_tdata (abfd)->core_pid
+	 = bfd_get_32 (abfd, note->descdata + 12);
 	elf_tdata (abfd)->core_program
 	 = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
 	elf_tdata (abfd)->core_command