diff mbox

aarch64: correct a size of struct elf_prstatus

Message ID 1424653681-18053-1-git-send-email-takahiro.akashi@linaro.org
State New
Headers show

Commit Message

AKASHI Takahiro Feb. 23, 2015, 1:08 a.m. UTC
When gdb reads a vmcore file that kdump generated, it fails, saying

	warning: Couldn't find general-purpose registers in core file.

This is because elf64_aarch64_grok_prstatus() fails to read a note section
in a vmcore file due to a wrong size of struct elf_prstatus. The following
commit on kernel changed ELF_NGREG in elf_gregset_t.

	commit 9cf2b72b25f3f6a5a1a46a4f36037e66de52465c
	Author: Will Deacon <will.deacon@arm.com>
	Date:   Tue Jan 22 15:34:40 2013 +0000

	    arm64: elf: fix core dumping to match what glibc expects

This patch fixes an immediate value in elf64_aarch64_grok_prstatus().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 bfd/elf64-aarch64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

AKASHI Takahiro Feb. 23, 2015, 2:54 p.m. UTC | #1
Hi

On 02/23/2015 05:52 PM, Marcus Shawcroft wrote:
> On 23 February 2015 at 01:08, AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
>
>> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>> ---
>>   bfd/elf64-aarch64.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> Hi, I'm confused about which tree / branch this patch is intended for.
> The file elf64-aarch64.c was replaced with elfxx-aarch64.c and
> elfnn-aarch64.c back in 2013 with this commit:
>
> 2013-06-26  Yufeng Zhang  <yufeng.zhang@arm.com>
>          * Makefile.am (BFD64_BACKENDS): Add elfxx-aarch64.c.

I didn't know this. I checked only v7.6, which is a base version
of linaro's gdb, and found a wrong value there, so ...
I will contact our toolchain team.

Thanks,
-Takahiro AKASHI

>> diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c
>> index 94d90c5..0454a18 100644
>> --- a/bfd/elf64-aarch64.c
>> +++ b/bfd/elf64-aarch64.c
>> @@ -1529,7 +1529,7 @@ elf64_aarch64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
>>         default:
>>          return FALSE;
>>
>> -      case 408:                /* sizeof(struct elf_prstatus) on Linux/arm64.  */
>> +      case 392:                /* sizeof(struct elf_prstatus) on Linux/arm64.  */
>>          /* pr_cursig */
>>          elf_tdata (abfd)->core->signal
>>            = bfd_get_16 (abfd, note->descdata + 12);
>
> The identical patch was applied to the tree in late 2013 by Matt Leach:
>
> +2013-11-12  Matthew Leach  <Matthew.Leach@arm.comm>
> +
> +       * elfxx-aarch64.c (_bfd_aarch64_elf_grok_prstatus): Fix hard-coded
> +       size of struct elf_prstatus.
> +
> -      case 408:                /* sizeof(struct elf_prstatus) on
> Linux/arm64.  */
> +      case 392:                /* sizeof(struct elf_prstatus) on
> Linux/arm64.  */
>
> Cheers
> /Marcus
>
diff mbox

Patch

diff --git a/bfd/elf64-aarch64.c b/bfd/elf64-aarch64.c
index 94d90c5..0454a18 100644
--- a/bfd/elf64-aarch64.c
+++ b/bfd/elf64-aarch64.c
@@ -1529,7 +1529,7 @@  elf64_aarch64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
       default:
 	return FALSE;
 
-      case 408:		/* sizeof(struct elf_prstatus) on Linux/arm64.  */
+      case 392:		/* sizeof(struct elf_prstatus) on Linux/arm64.  */
 	/* pr_cursig */
 	elf_tdata (abfd)->core->signal
 	  = bfd_get_16 (abfd, note->descdata + 12);