[1/2] Nios2, libbfd: Support new coredump .reg section

Message ID fm-32642-202404191039259a5b01c9539d209231-2oN7gY@errorhandling.siemens-energy.com
State New
Headers
Series [1/2] Nios2, libbfd: Support new coredump .reg section |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Moritz Strübe April 19, 2024, 10:39 a.m. UTC
  The coredumps of the current kernel are larger.
---
 bfd/elf32-nios2.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Comments

Tom Tromey April 19, 2024, 3:06 p.m. UTC | #1
>>>>> "Moritz" == Moritz Strübe <moritz.struebe@siemens-energy.com> writes:

Moritz> The coredumps of the current kernel are larger.

Hi.  BFD patches should go to the binutils list.

FWIW I'm a little surprised to see this given that nios2 was just
deprecated in GCC.

Tom
  
Luis Machado April 23, 2024, 1:28 p.m. UTC | #2
Hi,

I just spotted Sandra's message [1] about nios2 deprecation.

Do we have plans for deprecating such support in binutils/gdb as well, for the
sake of reducing future maintenance burden?


On 4/19/24 11:39, Moritz Strübe wrote:
> The coredumps of the current kernel are larger.
> ---
>  bfd/elf32-nios2.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
> index 806ec314c82..3d0fa6fbf27 100644
> --- a/bfd/elf32-nios2.c
> +++ b/bfd/elf32-nios2.c
> @@ -1921,7 +1921,18 @@ nios2_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
>      {
>      default:
>        return false;
> +    case 272:  /* Linux/Nios II */
> +      /* pr_cursig */
> +      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
> +
> +      /* pr_pid */
> +      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
>  
> +      /* pr_reg */
> +      offset = 72;
> +      size = 196;
> +
> +      break;
>      case 212:	      /* Linux/Nios II */
>        /* pr_cursig */
>        elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);

[1] https://gcc.gnu.org/pipermail/gcc/2024-April/243749.html
  
Sandra Loosemore April 23, 2024, 2:51 p.m. UTC | #3
On 4/23/24 07:28, Luis Machado wrote:
> Hi,
> 
> I just spotted Sandra's message [1] about nios2 deprecation.
> 
> Do we have plans for deprecating such support in binutils/gdb as well, for the
> sake of reducing future maintenance burden?

Yes, I plan to take care of producing patches to remove the nios2 port 
entirely from binutils/gdb, as well as from gcc, a little bit farther 
down the line.  I'm not sure of the best timing with respect to upcoming 
releases, and at the moment I am swamped with other tasks anyway, but 
it's definitely on my list of things to do -- I don't want to leave this 
as a pointless maintenance burden for others.

-Sandra
  
Simon Marchi April 23, 2024, 3:31 p.m. UTC | #4
On 2024-04-23 10:51, Sandra Loosemore wrote:
> On 4/23/24 07:28, Luis Machado wrote:
>> Hi,
>>
>> I just spotted Sandra's message [1] about nios2 deprecation.
>>
>> Do we have plans for deprecating such support in binutils/gdb as well, for the
>> sake of reducing future maintenance burden?
> 
> Yes, I plan to take care of producing patches to remove the nios2 port entirely from binutils/gdb, as well as from gcc, a little bit farther down the line.  I'm not sure of the best timing with respect to upcoming releases, and at the moment I am swamped with other tasks anyway, but it's definitely on my list of things to do -- I don't want to leave this as a pointless maintenance burden for others.
> 
> -Sandra

Thanks a lot for being proactive with this.

Simon
  
Luis Machado April 23, 2024, 3:32 p.m. UTC | #5
On 4/23/24 15:51, Sandra Loosemore wrote:
> On 4/23/24 07:28, Luis Machado wrote:
>> Hi,
>>
>> I just spotted Sandra's message [1] about nios2 deprecation.
>>
>> Do we have plans for deprecating such support in binutils/gdb as well, for the
>> sake of reducing future maintenance burden?
> 
> Yes, I plan to take care of producing patches to remove the nios2 port entirely from binutils/gdb, as well as from gcc, a little bit farther down the line.  I'm not sure of the best timing with respect to upcoming releases, and at the moment I am swamped with other tasks anyway, but it's definitely on my list of things to do -- I don't want to leave this as a pointless maintenance burden for others.
> 
> -Sandra

Great. Thanks for the update Sandra.
  

Patch

diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 806ec314c82..3d0fa6fbf27 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -1921,7 +1921,18 @@  nios2_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
     {
     default:
       return false;
+    case 272:  /* Linux/Nios II */
+      /* pr_cursig */
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
+
+      /* pr_pid */
+      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
 
+      /* pr_reg */
+      offset = 72;
+      size = 196;
+
+      break;
     case 212:	      /* Linux/Nios II */
       /* pr_cursig */
       elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);