* [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch @ 2023-03-13 12:23 Aditya Kamath1 2023-03-13 13:06 ` Ulrich Weigand 0 siblings, 1 reply; 10+ messages in thread From: Aditya Kamath1 @ 2023-03-13 12:23 UTC (permalink / raw) To: Ulrich Weigand, Aditya Kamath1 via Gdb-patches; +Cc: Sangamesh Mallayya [-- Attachment #1.1: Type: text/plain, Size: 6648 bytes --] Hi all, This patch is a small change that will enable vector register visibility when AIX FOLKS do core file analysis. Kindly check the outputs with the patch and without the patch. Changes are visible in bold for the output with patch. Since we now support vector register contents debugging, we have added the below architecture. That is all the change. - bfd_mach_rs6k, &tdesc_rs6000}, + bfd_mach_rs6k, &tdesc_powerpc_vsx32}, Let me know if there are any changes. If not kindly push the same. Have a nice day ahead. 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-for-AIX.patch --] [-- Type: application/octet-stream, Size: 982 bytes --] From d83fd4e73f8859e895c48b96a443d94c2c9120c6 Mon Sep 17 00:00:00 2001 From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com> Date: Mon, 13 Mar 2023 07:12:48 -0500 Subject: [PATCH] Enable vector register visibility in core for AIX. This patch enables AIX folks to see vector register contents while they analyse the core file. --- gdb/rs6000-tdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 592b447948e..4547ac2085e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3470,7 +3470,7 @@ static struct ppc_variant variants[] = {"powerpc", "PowerPC user-level", bfd_arch_powerpc, bfd_mach_ppc, &tdesc_powerpc_altivec32}, {"power", "POWER user-level", bfd_arch_rs6000, - bfd_mach_rs6k, &tdesc_rs6000}, + bfd_mach_rs6k, &tdesc_powerpc_vsx32}, {"403", "IBM PowerPC 403", bfd_arch_powerpc, bfd_mach_ppc_403, &tdesc_powerpc_403}, {"405", "IBM PowerPC 405", bfd_arch_powerpc, -- 2.38.3 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-13 12:23 [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch Aditya Kamath1 @ 2023-03-13 13:06 ` Ulrich Weigand 2023-03-14 7:43 ` Aditya Kamath1 0 siblings, 1 reply; 10+ messages in thread From: Ulrich Weigand @ 2023-03-13 13:06 UTC (permalink / raw) To: gdb-patches, Aditya Kamath1; +Cc: Sangamesh Mallayya Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >Since we now support vector register contents debugging, we have added the below architecture. That is all the change. >- bfd_mach_rs6k, &tdesc_rs6000}, >+ bfd_mach_rs6k, &tdesc_powerpc_vsx32}, Sorry, this is wrong - it will enable those sections unconditionally across all platforms and operating systems. Instead, you need to implement a function rs6000_aix_core_read_description that will determine the correct tdesc to use for any particular core file depending on the sections that are actually present there. You can see e.g. ppc_linux_core_read_description for examples how to implement this routine. Bye, Ulrich ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-13 13:06 ` Ulrich Weigand @ 2023-03-14 7:43 ` Aditya Kamath1 2023-03-14 17:58 ` Ulrich Weigand 0 siblings, 1 reply; 10+ messages in thread From: Aditya Kamath1 @ 2023-03-14 7:43 UTC (permalink / raw) To: Ulrich Weigand, gdb-patches; +Cc: Sangamesh Mallayya [-- Attachment #1.1: Type: text/plain, Size: 7778 bytes --] Hi Ulrich and community, Please find attached the patch. >Sorry, this is wrong - it will enable those sections unconditionally >across all platforms and operating systems. >Instead, you need to implement a function >rs6000_aix_core_read_description >that will determine the correct tdesc to use for any particular >core file depending on the sections that are actually present there. >You can see e.g. ppc_linux_core_read_description for >examples how to implement this routine. Kindly check in this patch.. It is a simple check to see for aix-vmx or vsx presence in a bfd file. And then we return the required target desc. --------------------------------------------------------- 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) From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com> Date: Monday, 13 March 2023 at 6:36 PM To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com> Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com> Subject: Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >Since we now support vector register contents debugging, we have added the below architecture. That is all the change. >- bfd_mach_rs6k, &tdesc_rs6000}, >+ bfd_mach_rs6k, &tdesc_powerpc_vsx32}, Sorry, this is wrong - it will enable those sections unconditionally across all platforms and operating systems. Instead, you need to implement a function rs6000_aix_core_read_description that will determine the correct tdesc to use for any particular core file depending on the sections that are actually present there. You can see e.g. ppc_linux_core_read_description for examples how to implement this routine. Bye, Ulrich [-- Attachment #2: 0001-Enable-vector-register-visibility-in-core-for-AIX.patch --] [-- Type: application/octet-stream, Size: 2029 bytes --] From 1ab600eaf27504ed507c0320fc1edb67ffea1e58 Mon Sep 17 00:00:00 2001 From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com> Date: Tue, 14 Mar 2023 02:27:22 -0500 Subject: [PATCH] Enable vector register visibility in core for AIX. This patch enables AIX folks to see vector register contents while they analyse the core file. --- gdb/rs6000-tdep.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 592b447948e..1689d668d54 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -7461,6 +7461,34 @@ rs6000_program_breakpoint_here_p (gdbarch *gdbarch, CORE_ADDR address) return false; } +static const struct target_desc * +ppc_aix_core_read_description (struct gdbarch *gdbarch, + struct target_ops *target, + bfd *abfd) +{ + asection *altivec = bfd_get_section_by_name (abfd, ".aix-vmx"); + asection *vsx = bfd_get_section_by_name (abfd, ".aix-vsx"); + asection *section = bfd_get_section_by_name (abfd, ".reg"); + + if (!section) + return NULL; + + int arch64 = 0; + if (bfd_section_size (section) == 48 * 8) + arch64 = 1; + + if (vsx && arch64) + return tdesc_powerpc_vsx64; + else if (vsx && !arch64) + return tdesc_powerpc_vsx32; + else if (altivec && arch64) + return tdesc_powerpc_altivec64; + else if (altivec && !arch64) + return tdesc_powerpc_altivec32; + + return NULL; +} + /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created during this debugging session. @@ -8454,6 +8482,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else register_ppc_ravenscar_ops (gdbarch); + set_gdbarch_core_read_description (gdbarch, ppc_aix_core_read_description); set_gdbarch_disassembler_options (gdbarch, &powerpc_disassembler_options); set_gdbarch_valid_disassembler_options (gdbarch, disassembler_options_powerpc ()); -- 2.38.3 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-14 7:43 ` Aditya Kamath1 @ 2023-03-14 17:58 ` Ulrich Weigand 2023-03-15 4:54 ` Aditya Kamath1 0 siblings, 1 reply; 10+ messages in thread From: Ulrich Weigand @ 2023-03-14 17:58 UTC (permalink / raw) To: gdb-patches, Aditya Kamath1; +Cc: Sangamesh Mallayya Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >Kindly check in this patch.. It is a simple check to see for >aix-vmx or vsx presence in a bfd file. And then we return >the required target desc. The function looks reasonable, but it's in the wrong file - you still install it unconditionally on all operating systems. Instead, this function should go to rs6000-aix-tdep.c (next to rs6000_aix_iterate_over_regset_sections) and should be installed from rs6000_aix_init_osabi. Bye, Ulrich ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-14 17:58 ` Ulrich Weigand @ 2023-03-15 4:54 ` Aditya Kamath1 2023-03-15 18:32 ` Ulrich Weigand 0 siblings, 1 reply; 10+ messages in thread From: Aditya Kamath1 @ 2023-03-15 4:54 UTC (permalink / raw) To: Ulrich Weigand, gdb-patches; +Cc: Sangamesh Mallayya [-- Attachment #1.1: Type: text/plain, Size: 11448 bytes --] Hi Ulrich and community, Please find attached the patch. >The function looks reasonable, but it's in the wrong file - >you still install it unconditionally on all operating systems. >Instead, this function should go to rs6000-aix-tdep.c (next >to rs6000_aix_iterate_over_regset_sections) and should be >installed from rs6000_aix_init_osabi. This is done. Kindly check it out. I have pasted both 64 bit and 32 bit core file outputs below. It works alright. Thank you for the guidance. So I always thought rs6000-tdep.c is only used by AIX. Just for my knowledge kindly let me know who else is using it? Is it powerpc Linux folks? And is the rs600-tdep file is common to both of us. This will be useful for me if ever I need to do any change in the future. Kindly push this if there are no more changes required from your end. If there are, then let me know. Have a nice day ahead. Thanks and regards, Aditya. ------------------------------------- 32 bit 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}} ----------------------------------------------- 64 bit output with patch ./gdb ~/gdb_tests/vector_lab_test_64 core.24773118 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/vector_lab_test_64... Core was generated by `vector_lab_test_64'. #0 main () at /home/aditya/gdb_tests/vector_lab_test.c:26 26 printf("Arr3[1] = { %d, %d, %d, %d }\n", Arr3[1][0], Arr3[1][1], Arr3[1][2], Arr3[1][3]); (gdb) info reg r0 0xffffffff 4294967295 r1 0xffffffffffff8f0 1152921504606845168 r2 0x110000310 4563403536 r3 0xe 14 r4 0x9001000a009ad4e 648535941212384590 r5 0xfffffffffffffe8 1152921504606846952 r6 0x800000000000d032 9223372036854829106 r7 0x3ba0 15264 r8 0x0 0 r9 0x120 288 r10 0x0 0 r11 0x1030 4144 r12 0x100000740 4294969152 r13 0xbadc0ffee0ddf00d 13464654573299691533 r14 0x1 1 r15 0xffffffffffffad0 1152921504606845648 r16 0xffffffffffffae0 1152921504606845664 r17 0x800200140000000 576495942044221440 r18 0xffffffffffffed0 1152921504606846672 r19 0x9fffffff000ec40 720575940110904384 r20 0xbadc0ffee0ddf00d 13464654573299691533 r21 0xbadc0ffee0ddf00d 13464654573299691533 r22 0xbadc0ffee0ddf00d 13464654573299691533 r23 0xbadc0ffee0ddf00d 13464654573299691533 r24 0xbadc0ffee0ddf00d 13464654573299691533 r25 0xbadc0ffee0ddf00d 13464654573299691533 r26 0xbadc0ffee0ddf00d 13464654573299691533 r27 0xbadc0ffee0ddf00d 13464654573299691533 r28 0xbadc0ffee0ddf00d 13464654573299691533 r29 0xbadc0ffee0ddf00d 13464654573299691533 r30 0xbadc0ffee0ddf00d 13464654573299691533 r31 0xffffffffffff8f0 1152921504606845168 pc 0x100000760 0x100000760 <main+192> msr 0xa00000000200d032 11529215046102077490 cr 0x82240228 2183397928 lr 0x100000740 0x100000740 <main+160> ctr 0xe 14 xer 0xe 14 fpscr 0x0 0 vscr 0x0 0 vrsave 0x1 1 (gdb) info reg $vr0 vr0 {uint128 = 0x4c60000098c00000e5200001318, v4_float = {0x4c6, 0x98c, 0xe52, 0x1318}, v4_int32 = {0x4c6, 0x98c, 0xe52, 0x1318}, v8_int16 = {0x0, 0x4c6, 0x0, 0x98c, 0x0, 0xe52, 0x0, 0x1318}, v16_int8 = {0x0, 0x0, 0x4, 0xc6, 0x0, 0x0, 0x9, 0x8c, 0x0, 0x0, 0xe, 0x52, 0x0, 0x0, 0x13, 0x18}} (gdb) -------------------------------------------------- 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 From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com> Date: Tuesday, 14 March 2023 at 11:28 PM To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com> Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com> Subject: Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >Kindly check in this patch.. It is a simple check to see for >aix-vmx or vsx presence in a bfd file. And then we return >the required target desc. The function looks reasonable, but it's in the wrong file - you still install it unconditionally on all operating systems. Instead, this function should go to rs6000-aix-tdep.c (next to rs6000_aix_iterate_over_regset_sections) and should be installed from rs6000_aix_init_osabi. Bye, Ulrich [-- Attachment #2: 0001-Enable-vector-register-visibility-in-core-for-AIX.patch --] [-- Type: application/octet-stream, Size: 2588 bytes --] From 84d5cba220470e74a359bfc34aa548ea3c19fab6 Mon Sep 17 00:00:00 2001 From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com> Date: Tue, 14 Mar 2023 22:48:40 -0500 Subject: [PATCH] Enable vector register visibility in core for AIX. This patch enables AIX folks to see vector register contents while they analyse the core file. --- gdb/rs6000-aix-tdep.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 9a3a5396508..41558ff31ff 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -40,6 +40,11 @@ #include "trad-frame.h" #include "frame-unwind.h" +#include "features/rs6000/powerpc-altivec32.c" +#include "features/rs6000/powerpc-vsx32.c" +#include "features/rs6000/powerpc-altivec64.c" +#include "features/rs6000/powerpc-vsx64.c" + /* If the kernel has to deliver a signal, it pushes a sigcontext structure on the stack and then calls the signal handler, passing the address of the sigcontext in an argument register. Usually @@ -450,6 +455,36 @@ rs6000_aix_iterate_over_regset_sections (struct gdbarch *gdbarch, } +/* Read core file description for AIX. */ + +static const struct target_desc * +ppc_aix_core_read_description (struct gdbarch *gdbarch, + struct target_ops *target, + bfd *abfd) +{ + asection *altivec = bfd_get_section_by_name (abfd, ".aix-vmx"); + asection *vsx = bfd_get_section_by_name (abfd, ".aix-vsx"); + asection *section = bfd_get_section_by_name (abfd, ".reg"); + ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch); + + if (!section) + return NULL; + + int arch64 = 0; + if (tdep->wordsize == 8) + arch64 = 1; + + if (vsx && arch64) + return tdesc_powerpc_vsx64; + else if (vsx && !arch64) + return tdesc_powerpc_vsx32; + else if (altivec && arch64) + return tdesc_powerpc_altivec64; + else if (altivec && !arch64) + return tdesc_powerpc_altivec32; + + return NULL; +} /* Pass the arguments in either registers, or in the stack. In RS/6000, the first eight words of the argument list (that might be less than @@ -1348,6 +1383,7 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) (gdbarch, rs6000_aix_iterate_over_regset_sections); set_gdbarch_core_xfer_shared_libraries_aix (gdbarch, rs6000_aix_core_xfer_shared_libraries_aix); + set_gdbarch_core_read_description (gdbarch, ppc_aix_core_read_description); if (tdep->wordsize == 8) tdep->lr_frame_offset = 16; -- 2.38.3 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-15 4:54 ` Aditya Kamath1 @ 2023-03-15 18:32 ` Ulrich Weigand 2023-03-15 19:04 ` Simon Marchi 0 siblings, 1 reply; 10+ messages in thread From: Ulrich Weigand @ 2023-03-15 18:32 UTC (permalink / raw) To: gdb-patches, Aditya Kamath1; +Cc: Sangamesh Mallayya Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >This is done. Kindly check it out. I have pasted both 64 bit and 32 >bit core file outputs below. It works alright. Thank you for the >guidance. This is OK, I've checked the patch in now. Thanks! >So I always thought rs6000-tdep.c is only used by AIX. Just for my >knowledge kindly let me know who else is using it? Is it powerpc >Linux folks? And is the rs600-tdep file is common to both of us. The rs6000-tdep.c file is used on *all* PowerPC targets (every target that starts with rs6000- or powerpc*-). This includes AIX and Linux, but also various BSDs and others. If you want to find out which tdep file is used for which targets, you can check the configure.tgt file. You will see the rs6000-tdep.o file listed in the "gdb_target_obs" variable for all those targets. Bye, Ulrich ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-15 18:32 ` Ulrich Weigand @ 2023-03-15 19:04 ` Simon Marchi 2023-03-16 12:50 ` Luis Machado 2023-03-16 13:51 ` Tom Tromey 0 siblings, 2 replies; 10+ messages in thread From: Simon Marchi @ 2023-03-15 19:04 UTC (permalink / raw) To: Ulrich Weigand, gdb-patches, Aditya Kamath1; +Cc: Sangamesh Mallayya On 3/15/23 14:32, Ulrich Weigand via Gdb-patches wrote: > Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: > >> This is done. Kindly check it out. I have pasted both 64 bit and 32 >> bit core file outputs below. It works alright. Thank you for the >> guidance. > > This is OK, I've checked the patch in now. Thanks! Hi Ulrich, I see: CXX rs6000-aix-tdep.o In file included from /home/smarchi/src/binutils-gdb/gdb/rs6000-aix-tdep.c:46: /home/smarchi/src/binutils-gdb/gdb/features/rs6000/powerpc-vsx64.c:10:1: error: ‘void initialize_tdesc_powerpc_vsx64()’ defined but not used [-Werror=unused-function] 10 | initialize_tdesc_powerpc_vsx64 (void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Simon ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-15 19:04 ` Simon Marchi @ 2023-03-16 12:50 ` Luis Machado 2023-03-16 13:51 ` Tom Tromey 1 sibling, 0 replies; 10+ messages in thread From: Luis Machado @ 2023-03-16 12:50 UTC (permalink / raw) To: Simon Marchi, Ulrich Weigand, gdb-patches, Aditya Kamath1 Cc: Sangamesh Mallayya On 3/15/23 19:04, Simon Marchi via Gdb-patches wrote: > On 3/15/23 14:32, Ulrich Weigand via Gdb-patches wrote: >> Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote: >> >>> This is done. Kindly check it out. I have pasted both 64 bit and 32 >>> bit core file outputs below. It works alright. Thank you for the >>> guidance. >> >> This is OK, I've checked the patch in now. Thanks! > > Hi Ulrich, > > I see: > > > CXX rs6000-aix-tdep.o > In file included from /home/smarchi/src/binutils-gdb/gdb/rs6000-aix-tdep.c:46: > /home/smarchi/src/binutils-gdb/gdb/features/rs6000/powerpc-vsx64.c:10:1: error: ‘void initialize_tdesc_powerpc_vsx64()’ defined but not used [-Werror=unused-function] > 10 | initialize_tdesc_powerpc_vsx64 (void) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Simon I see the same when building with --enable-targets=all. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-15 19:04 ` Simon Marchi 2023-03-16 12:50 ` Luis Machado @ 2023-03-16 13:51 ` Tom Tromey 2023-03-16 15:11 ` Ulrich Weigand 1 sibling, 1 reply; 10+ messages in thread From: Tom Tromey @ 2023-03-16 13:51 UTC (permalink / raw) To: Simon Marchi via Gdb-patches Cc: Ulrich Weigand, Aditya Kamath1, Simon Marchi, Sangamesh Mallayya >>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes: Simon> CXX rs6000-aix-tdep.o Simon> In file included from /home/smarchi/src/binutils-gdb/gdb/rs6000-aix-tdep.c:46: Simon> /home/smarchi/src/binutils-gdb/gdb/features/rs6000/powerpc-vsx64.c:10:1: error: ‘void initialize_tdesc_powerpc_vsx64()’ defined but not used [-Werror=unused-function] Simon> 10 | initialize_tdesc_powerpc_vsx64 (void) Simon> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I sent a patch for this. I think it ought to work in any configuration but perhaps someone else ought to check. Tom ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch 2023-03-16 13:51 ` Tom Tromey @ 2023-03-16 15:11 ` Ulrich Weigand 0 siblings, 0 replies; 10+ messages in thread From: Ulrich Weigand @ 2023-03-16 15:11 UTC (permalink / raw) To: gdb-patches, tom; +Cc: simark, Aditya Kamath1, Sangamesh Mallayya Tom Tromey <tom@tromey.com> wrote: >Simon> CXX rs6000-aix-tdep.o >Simon> In file included from /home/smarchi/src/binutils-gdb/gdb/rs6000-aix-tdep.c:46: >Simon> /home/smarchi/src/binutils-gdb/gdb/features/rs6000/powerpc-vsx64.c:10:1: error: ‘void initialize_tdesc_powerpc_vsx64()’ defined but not used [-Werror=unused-function] >Simon> 10 | initialize_tdesc_powerpc_vsx64 (void) >Simon> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >I sent a patch for this. I think it ought to work in any configuration >but perhaps someone else ought to check. Your patch LGTM. Thanks for the quick fix and sorry for the breakage. Bye, Ulrich ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-03-16 15:11 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-03-13 12:23 [PATCH] Enable-vector-register-visibility-in-core-file-for-AIX.patch Aditya Kamath1 2023-03-13 13:06 ` Ulrich Weigand 2023-03-14 7:43 ` Aditya Kamath1 2023-03-14 17:58 ` Ulrich Weigand 2023-03-15 4:54 ` Aditya Kamath1 2023-03-15 18:32 ` Ulrich Weigand 2023-03-15 19:04 ` Simon Marchi 2023-03-16 12:50 ` Luis Machado 2023-03-16 13:51 ` Tom Tromey 2023-03-16 15:11 ` Ulrich Weigand
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).