public inbox for bfd@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Enable vector register visibility in core file for AIX
@ 2023-03-14  7:47 Aditya Kamath1
  2023-03-19 22:46 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Kamath1 @ 2023-03-14  7:47 UTC (permalink / raw)
  To: bfd, amodra; +Cc: Sangamesh Mallayya


[-- Attachment #1.1: Type: text/plain, Size: 6548 bytes --]

Hi all,

Please find attached the patch { 0001-Enable-vector-register-visibility-in-core-file-for-A.patch}

This patch will enable vector register visibility when AIX FOLKS do core file analysis especially using applications like GDB.

Kindly check the outputs with the patch and without the patch. Changes are visible in bold for the output with patch.

Do let me know if any changes are required. If not kindly commit the same.

Thanks and regards,
Aditya.

-------------------------
Output without patch:-

./gdb ~/gdb_tests/bll_core core.13828468
GNU gdb (GDB) 14.0.50.20230221-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.2.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/aditya/gdb_tests/bll_core...
Core was generated by `bll_core'.
#0  main () at /home/aditya/gdb_tests/bll_core.c:24
24          int length1 = 7;
(gdb) info reg
r0             0x2ff22b50          804399952
r1             0x2ff22b10          804399888
r2             0x20000448          536872008
r3             0x2ff22b50          804399952
r4             0x100010e0          268439776
r5             0x0                 0
r6             0x5                 5
r7             0x2b67              11111
r8             0x56ce              22222
r9             0x60                96
r10            0xad9c              44444
r11            0x0                 0
r12            0x22648680          577013376
r13            0xdeadbeef          -559038737
r14            0x1                 1
r15            0x2ff22c00          804400128
r16            0x2ff22c08          804400136
r17            0xdeadbeef          -559038737
r18            0xdeadbeef          -559038737
r19            0xf0806b50          -260019376
r20            0xdeadbeef          -559038737
r21            0xdeadbeef          -559038737
r22            0xdeadbeef          -559038737
r23            0xdeadbeef          -559038737
r24            0xdeadbeef          -559038737
r25            0xdeadbeef          -559038737
r26            0x96c2062c          -1765669332
r27            0x88                136
r28            0x200002ed          536871661
r29            0x10000000          268435456
r30            0x3                 3
r31            0x2ff22b10          804399888
pc             0x10000690          0x10000690 <main+144>
msr            0x200d032           33607730
cnd            0x24648244          610566724
lr             0x10000634          0x10000634 <main+52>
cnt            0x0                 0
xer            0x20040000          537133056
fpscr          0x0                 0
mq             0xdeadbeef          -559038737

------------------------------------------
Output with patch:-

./gdb ~/gdb_tests/bll_core core.13828468
GNU gdb (GDB) 14.0.50.20230221-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc64-ibm-aix7.2.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/aditya/gdb_tests/bll_core...
Core was generated by `bll_core'.
#0  main () at /home/aditya/gdb_tests/bll_core.c:24
24          int length1 = 7;
(gdb) info reg
r0             0x2ff22b50          804399952
r1             0x2ff22b10          804399888
r2             0x20000448          536872008
r3             0x2ff22b50          804399952
r4             0x100010e0          268439776
r5             0x0                 0
r6             0x5                 5
r7             0x2b67              11111
r8             0x56ce              22222
r9             0x60                96
r10            0xad9c              44444
r11            0x0                 0
r12            0x22648680          577013376
r13            0xdeadbeef          3735928559
r14            0x1                 1
r15            0x2ff22c00          804400128
r16            0x2ff22c08          804400136
r17            0xdeadbeef          3735928559
r18            0xdeadbeef          3735928559
r19            0xf0806b50          4034947920
r20            0xdeadbeef          3735928559
r21            0xdeadbeef          3735928559
r22            0xdeadbeef          3735928559
r23            0xdeadbeef          3735928559
r24            0xdeadbeef          3735928559
r25            0xdeadbeef          3735928559
r26            0x96c2062c          2529297964
r27            0x88                136
r28            0x200002ed          536871661
r29            0x10000000          268435456
r30            0x3                 3
r31            0x2ff22b10          804399888
pc             0x10000690          0x10000690 <main+144>
msr            0x200d032           33607730
cr             0x24648244          610566724
lr             0x10000634          0x10000634 <main+52>
ctr            0x0                 0
xer            0x20040000          537133056
fpscr          0x0                 0
vscr           0x0                 0
vrsave         0x1                 1
(gdb) info reg $vr0
vr0            {uint128 = 0x14de4f00a6f27802337255053793c0, v4_float = {0x14de4f, 0xa6f278, 0x2337255, 0x53793c0}, v4_int32 = {0x14de4f, 0xa6f278, 0x2337255, 0x53793c0}, v8_int16 = {0x14, 0xde4f, 0xa6, 0xf278, 0x233, 0x7255, 0x537, 0x93c0}, v16_int8 = {0x0, 0x14, 0xde, 0x4f, 0x0, 0xa6, 0xf2, 0x78, 0x2, 0x33, 0x72, 0x55, 0x5, 0x37, 0x93, 0xc0}}
(gdb)


[-- Attachment #2: 0001-Enable-vector-register-visibility-in-core-file-for-A.patch --]
[-- Type: application/octet-stream, Size: 2785 bytes --]

From e7e441e524d037fe90fdadf198c210a479b63173 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Mon, 13 Mar 2023 07:32:57 -0500
Subject: [PATCH] 
 Enable-vector-register-visibility-in-core-file-for-AIX_binutils

This patch will enable vector register visibility when AIX FOLKS do core file analysis.
---
 bfd/aix5ppc-core.c | 21 +++++++++++++++++++++
 bfd/rs6000-core.c  | 16 +++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/bfd/aix5ppc-core.c b/bfd/aix5ppc-core.c
index 0a338ac391b..174b967cdbe 100644
--- a/bfd/aix5ppc-core.c
+++ b/bfd/aix5ppc-core.c
@@ -142,6 +142,27 @@ xcoff64_core_p (bfd *abfd)
   sec->filepos = 0;
   sec->contents = (bfd_byte *)&new_core_hdr->c_flt.r64;
 
+  if (core.c_extctx)
+  {
+    /* vmx section.  */
+    flags = SEC_HAS_CONTENTS;
+    sec = bfd_make_section_anyway_with_flags (abfd, ".aix-vmx", flags);
+    if (sec == NULL)
+      return NULL;
+    sec->size = 560;
+    sec->vma = 0;
+    sec->filepos = core.c_extctx;
+
+    /* vmx section.  */
+    flags = SEC_HAS_CONTENTS;
+    sec = bfd_make_section_anyway_with_flags (abfd, ".aix-vsx", flags);
+    if (sec == NULL)
+      return NULL;
+    sec->size = 256;
+    sec->vma = 0;
+    sec->filepos = core.c_extctx + 584;
+  }
+
   /* .ldinfo section.
      To actually find out how long this section is in this particular
      core dump would require going down the whole list of struct
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index eb096098256..cb8199ae76d 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -342,7 +342,7 @@ rs6000coff_core_p (bfd *abfd)
   /* Values from new and old core structures.  */
   int c_flag;
   file_ptr c_stack, c_regoff, c_loader;
-  bfd_size_type c_size, c_regsize, c_lsize;
+  bfd_size_type c_size, c_regsize, c_lsize, c_extoff;
   bfd_vma c_stackend;
   void *c_regptr;
   int proc64;
@@ -370,6 +370,7 @@ rs6000coff_core_p (bfd *abfd)
       c_stackend = CNEW_STACKORG (core.new_dump) + c_size;
       c_lsize = CNEW_LSIZE (core.new_dump);
       c_loader = CNEW_LOADER (core.new_dump);
+      c_extoff = core.new_dump.c_extctx;
 #ifndef BFD64
       proc64 = CNEW_PROC64 (core.new_dump);
     }
@@ -517,6 +518,19 @@ rs6000coff_core_p (bfd *abfd)
 			  c_regsize, (bfd_vma) 0, c_regoff))
     goto fail;
 
+  if (c_extoff)
+  {
+    if (!make_bfd_asection (abfd, ".aix-vmx",
+			    SEC_HAS_CONTENTS,
+		560, (bfd_vma) 0, c_extoff))
+      goto fail;
+
+    if (!make_bfd_asection (abfd, ".aix-vsx",
+			    SEC_HAS_CONTENTS,
+	   256, (bfd_vma) 0, c_extoff + 584))
+      goto fail;
+  }
+
   /* .ldinfo section.
      To actually find out how long this section is in this particular
      core dump would require going down the whole list of struct ld_info's.
-- 
2.38.3


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

* Re: [PATCH] Enable vector register visibility in core file for AIX
  2023-03-14  7:47 [PATCH] Enable vector register visibility in core file for AIX Aditya Kamath1
@ 2023-03-19 22:46 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-03-19 22:46 UTC (permalink / raw)
  To: Aditya Kamath1; +Cc: bfd, Sangamesh Mallayya

On Tue, Mar 14, 2023 at 07:47:09AM +0000, Aditya Kamath1 wrote:
> This patch will enable vector register visibility when AIX FOLKS do core file analysis especially using applications like GDB.

Applied, with some formatting fixes.

-- 
Alan Modra
Australia Development Lab, IBM

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

end of thread, other threads:[~2023-03-19 22:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14  7:47 [PATCH] Enable vector register visibility in core file for AIX Aditya Kamath1
2023-03-19 22:46 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).