public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Modify altivec-regs.exp testcase for AIX
@ 2022-10-14  7:38 Aditya Kamath1
  2022-10-14  7:38 ` Aditya Kamath1
  2022-10-14 12:47 ` Ulrich Weigand
  0 siblings, 2 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-14  7:38 UTC (permalink / raw)
  To: Aditya Kamath1 via Gdb-patches, Ulrich Weigand, simark; +Cc: Sangamesh Mallayya

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them. Hence any ptrace () call will not be able to fetch or set the vector registers. Currently the test case sets a breakpoint in the main and makes an attempt to set the vector registers which will not work in AIX.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.

Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch]

Kindly let me know what you think.

Thanks and regards,
Aditya.

[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1180 bytes --]

From 6b35f6dd99df4896ae54fee5c85f0f97382a2875 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Fri, 14 Oct 2022 01:52:07 -0500
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.
---
 gdb/testsuite/gdb.arch/altivec-regs.exp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 87e48058ad3..fc168e5df34 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -57,7 +57,10 @@ if ![runto_main] then {
 }
 
 gdb_test "set print frame-arguments all"
-
+if {[istarget "powerpc*-*-aix*"]} then {
+  gdb_test "next"
+  gdb_test "next"
+}
 
 # set all the registers integer portions to 1
 for {set i 0} {$i < 32} {incr i 1} {
-- 
2.31.1


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

* [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-14  7:38 [PATCH] Modify altivec-regs.exp testcase for AIX Aditya Kamath1
@ 2022-10-14  7:38 ` Aditya Kamath1
  2022-10-14 12:47 ` Ulrich Weigand
  1 sibling, 0 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-14  7:38 UTC (permalink / raw)
  To: Aditya Kamath1 via Gdb-patches, Ulrich Weigand, simark; +Cc: Sangamesh Mallayya


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

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them. Hence any ptrace () call will not be able to fetch or set the vector registers. Currently the test case sets a breakpoint in the main and makes an attempt to set the vector registers which will not work in AIX.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.

Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch]

Kindly let me know what you think.

Thanks and regards,
Aditya.

[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1180 bytes --]

From 6b35f6dd99df4896ae54fee5c85f0f97382a2875 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Fri, 14 Oct 2022 01:52:07 -0500
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.
---
 gdb/testsuite/gdb.arch/altivec-regs.exp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 87e48058ad3..fc168e5df34 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -57,7 +57,10 @@ if ![runto_main] then {
 }
 
 gdb_test "set print frame-arguments all"
-
+if {[istarget "powerpc*-*-aix*"]} then {
+  gdb_test "next"
+  gdb_test "next"
+}
 
 # set all the registers integer portions to 1
 for {set i 0} {$i < 32} {incr i 1} {
-- 
2.31.1


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-14  7:38 [PATCH] Modify altivec-regs.exp testcase for AIX Aditya Kamath1
  2022-10-14  7:38 ` Aditya Kamath1
@ 2022-10-14 12:47 ` Ulrich Weigand
  2022-10-17  6:51   ` Aditya Kamath1
  1 sibling, 1 reply; 15+ messages in thread
From: Ulrich Weigand @ 2022-10-14 12:47 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-14 12:47 ` Ulrich Weigand
@ 2022-10-17  6:51   ` Aditya Kamath1
  2022-10-17  6:51     ` Aditya Kamath1
  2022-10-17  9:57     ` Ulrich Weigand
  0 siblings, 2 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-17  6:51 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-17  6:51   ` Aditya Kamath1
@ 2022-10-17  6:51     ` Aditya Kamath1
  2022-10-17  9:57     ` Ulrich Weigand
  1 sibling, 0 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-17  6:51 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-17  6:51   ` Aditya Kamath1
  2022-10-17  6:51     ` Aditya Kamath1
@ 2022-10-17  9:57     ` Ulrich Weigand
  2022-10-17  9:57       ` Ulrich Weigand
  2022-10-19  6:00       ` Aditya Kamath1
  1 sibling, 2 replies; 15+ messages in thread
From: Ulrich Weigand @ 2022-10-17  9:57 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

Hi Aditya,

the string "func2 breakpoint here, first time" is just a comment that will be used to identify this particular command in the output; e.g. if continuing to the breakpoint fails, this comment will be used in the "FAIL" error message (so you know where specifically the test execution fails).

Apart from that, this string doesn't have any meaning in particular, it could be anything. I guess the author of the test case added the "first time" text here because in the process of running this particular test, we'll get back to that same place multiple times.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  Distinguished Engineer, Open source compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vors. des Aufsichtsrats: Gregor Pillen | Geschäftsführung: David Faller
  Sitz d. Ges.: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294

-----Original Message-----
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com<mailto:Aditya%20Kamath1%20%3cAditya.Kamath1@ibm.com%3e>>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com<mailto:Ulrich%20Weigand%20%3cUlrich.Weigand@de.ibm.com%3e>>, gdb-patches@sourceware.org <gdb-patches@sourceware.org<mailto:%22gdb-patches@sourceware.org%22%20%3cgdb-patches@sourceware.org%3e>>, simark@simark.ca <simark@simark.ca<mailto:%22simark@simark.ca%22%20%3csimark@simark.ca%3e>>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com<mailto:Sangamesh%20Mallayya%20%3csangamesh.swamy@in.ibm.com%3e>>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Date: Mon, 17 Oct 2022 06:51:17 +0000

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-17  9:57     ` Ulrich Weigand
@ 2022-10-17  9:57       ` Ulrich Weigand
  2022-10-19  6:00       ` Aditya Kamath1
  1 sibling, 0 replies; 15+ messages in thread
From: Ulrich Weigand @ 2022-10-17  9:57 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

[-- Attachment #1: Type: text/plain, Size: 3224 bytes --]

Hi Aditya,

the string "func2 breakpoint here, first time" is just a comment that will be used to identify this particular command in the output; e.g. if continuing to the breakpoint fails, this comment will be used in the "FAIL" error message (so you know where specifically the test execution fails).

Apart from that, this string doesn't have any meaning in particular, it could be anything. I guess the author of the test case added the "first time" text here because in the process of running this particular test, we'll get back to that same place multiple times.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  Distinguished Engineer, Open source compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vors. des Aufsichtsrats: Gregor Pillen | Geschäftsführung: David Faller
  Sitz d. Ges.: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294

-----Original Message-----
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com<mailto:Aditya%20Kamath1%20%3cAditya.Kamath1@ibm.com%3e>>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com<mailto:Ulrich%20Weigand%20%3cUlrich.Weigand@de.ibm.com%3e>>, gdb-patches@sourceware.org <gdb-patches@sourceware.org<mailto:%22gdb-patches@sourceware.org%22%20%3cgdb-patches@sourceware.org%3e>>, simark@simark.ca <simark@simark.ca<mailto:%22simark@simark.ca%22%20%3csimark@simark.ca%3e>>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com<mailto:Sangamesh%20Mallayya%20%3csangamesh.swamy@in.ibm.com%3e>>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Date: Mon, 17 Oct 2022 06:51:17 +0000

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-17  9:57     ` Ulrich Weigand
  2022-10-17  9:57       ` Ulrich Weigand
@ 2022-10-19  6:00       ` Aditya Kamath1
  2022-10-19  6:00         ` Aditya Kamath1
  2023-02-23 12:54         ` Aditya Kamath1
  1 sibling, 2 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-19  6:00 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya

[-- Attachment #1: Type: text/plain, Size: 3872 bytes --]

Hi Ulrich,

I have modified the test case as per your feedback. Thank you for letting me know this way.

Please find attached the patch. [See 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch ].

Kindly let me know if any changes required.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 17 October 2022 15:27
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi Aditya,

the string "func2 breakpoint here, first time" is just a comment that will be used to identify this particular command in the output; e.g. if continuing to the breakpoint fails, this comment will be used in the "FAIL" error message (so you know where specifically the test execution fails).

Apart from that, this string doesn't have any meaning in particular, it could be anything. I guess the author of the test case added the "first time" text here because in the process of running this particular test, we'll get back to that same place multiple times.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  Distinguished Engineer, Open source compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vors. des Aufsichtsrats: Gregor Pillen | Geschäftsführung: David Faller
  Sitz d. Ges.: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294

-----Original Message-----
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com<mailto:Aditya%20Kamath1%20%3cAditya.Kamath1@ibm.com%3e>>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com<mailto:Ulrich%20Weigand%20%3cUlrich.Weigand@de.ibm.com%3e>>, gdb-patches@sourceware.org <gdb-patches@sourceware.org<mailto:%22gdb-patches@sourceware.org%22%20%3cgdb-patches@sourceware.org%3e>>, simark@simark.ca <simark@simark.ca<mailto:%22simark@simark.ca%22%20%3csimark@simark.ca%3e>>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com<mailto:Sangamesh%20Mallayya%20%3csangamesh.swamy@in.ibm.com%3e>>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Date: Mon, 17 Oct 2022 06:51:17 +0000

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1835 bytes --]

From fa7a6293012bf785851f7b2b38975b7c29ff2df1 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 19 Oct 2022 00:53:16 -0500
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.
---
 gdb/testsuite/gdb.arch/altivec-regs.c   | 3 +++
 gdb/testsuite/gdb.arch/altivec-regs.exp | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.c b/gdb/testsuite/gdb.arch/altivec-regs.c
index 4d4fe3f5dbb..a12297cd8bc 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.c
+++ b/gdb/testsuite/gdb.arch/altivec-regs.c
@@ -27,6 +27,9 @@ main ()
      so we don't want to execute them yet.  */
   a = 9;
   x = ((vector unsigned int) vec_splat_u8 (-2));
+
+  /* AIX altivec-regs testcase breakpoint here.  */
+
   y = ((vector unsigned int) vec_splat_u8 (1));
 	
   z = vector_fun (x, y);
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 37dbccea704..a38c03278ca 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -57,6 +57,11 @@ if ![runto_main] then {
 
 gdb_test "set print frame-arguments all"
 
+if {[istarget "powerpc*-*-aix*"]} then {
+    gdb_breakpoint [gdb_get_line_number "AIX altivec-regs testcase breakpoint here"]
+    gdb_continue_to_breakpoint "AIX altivec-regs testcase breakpoint hits first time"
+}
+
 # set all the registers integer portions to 1
 
 for {set i 0} {$i < 32} {incr i 1} {
-- 
2.31.1


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-19  6:00       ` Aditya Kamath1
@ 2022-10-19  6:00         ` Aditya Kamath1
  2023-02-23 12:54         ` Aditya Kamath1
  1 sibling, 0 replies; 15+ messages in thread
From: Aditya Kamath1 @ 2022-10-19  6:00 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya


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

Hi Ulrich,

I have modified the test case as per your feedback. Thank you for letting me know this way.

Please find attached the patch. [See 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch ].

Kindly let me know if any changes required.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 17 October 2022 15:27
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi Aditya,

the string "func2 breakpoint here, first time" is just a comment that will be used to identify this particular command in the output; e.g. if continuing to the breakpoint fails, this comment will be used in the "FAIL" error message (so you know where specifically the test execution fails).

Apart from that, this string doesn't have any meaning in particular, it could be anything. I guess the author of the test case added the "first time" text here because in the process of running this particular test, we'll get back to that same place multiple times.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  Distinguished Engineer, Open source compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vors. des Aufsichtsrats: Gregor Pillen | Geschäftsführung: David Faller
  Sitz d. Ges.: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294

-----Original Message-----
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com<mailto:Aditya%20Kamath1%20%3cAditya.Kamath1@ibm.com%3e>>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com<mailto:Ulrich%20Weigand%20%3cUlrich.Weigand@de.ibm.com%3e>>, gdb-patches@sourceware.org <gdb-patches@sourceware.org<mailto:%22gdb-patches@sourceware.org%22%20%3cgdb-patches@sourceware.org%3e>>, simark@simark.ca <simark@simark.ca<mailto:%22simark@simark.ca%22%20%3csimark@simark.ca%3e>>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com<mailto:Sangamesh%20Mallayya%20%3csangamesh.swamy@in.ibm.com%3e>>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Date: Mon, 17 Oct 2022 06:51:17 +0000

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,

In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",


What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich


[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1835 bytes --]

From fa7a6293012bf785851f7b2b38975b7c29ff2df1 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 19 Oct 2022 00:53:16 -0500
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.
---
 gdb/testsuite/gdb.arch/altivec-regs.c   | 3 +++
 gdb/testsuite/gdb.arch/altivec-regs.exp | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.c b/gdb/testsuite/gdb.arch/altivec-regs.c
index 4d4fe3f5dbb..a12297cd8bc 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.c
+++ b/gdb/testsuite/gdb.arch/altivec-regs.c
@@ -27,6 +27,9 @@ main ()
      so we don't want to execute them yet.  */
   a = 9;
   x = ((vector unsigned int) vec_splat_u8 (-2));
+
+  /* AIX altivec-regs testcase breakpoint here.  */
+
   y = ((vector unsigned int) vec_splat_u8 (1));
 	
   z = vector_fun (x, y);
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 37dbccea704..a38c03278ca 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -57,6 +57,11 @@ if ![runto_main] then {
 
 gdb_test "set print frame-arguments all"
 
+if {[istarget "powerpc*-*-aix*"]} then {
+    gdb_breakpoint [gdb_get_line_number "AIX altivec-regs testcase breakpoint here"]
+    gdb_continue_to_breakpoint "AIX altivec-regs testcase breakpoint hits first time"
+}
+
 # set all the registers integer portions to 1
 
 for {set i 0} {$i < 32} {incr i 1} {
-- 
2.31.1


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2022-10-19  6:00       ` Aditya Kamath1
  2022-10-19  6:00         ` Aditya Kamath1
@ 2023-02-23 12:54         ` Aditya Kamath1
  2023-02-24 15:37           ` Ulrich Weigand
  1 sibling, 1 reply; 15+ messages in thread
From: Aditya Kamath1 @ 2023-02-23 12:54 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya


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

Hi Ulrich and community,

Kindly review the patch in the previous email which changed the altivec-regs.exp so that AIX folks can also use this while in development. We are currently working on this feature. If the changes are alright, kindly push the same. I have attached the same again here as well.

Thanks,
Aditya.

From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Date: Wednesday, 19 October 2022 at 11:30 AM
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, gdb-patches@sourceware.org <gdb-patches@sourceware.org>, simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Hi Ulrich,

I have modified the test case as per your feedback. Thank you for letting me know this way.

Please find attached the patch. [See 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch ].
Kindly let me know if any changes required.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 17 October 2022 15:27
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi Aditya,

the string "func2 breakpoint here, first time" is just a comment that will be used to identify this particular command in the output; e.g. if continuing to the breakpoint fails, this comment will be used in the "FAIL" error message (so you know where specifically the test execution fails).

Apart from that, this string doesn't have any meaning in particular, it could be anything. I guess the author of the test case added the "first time" text here because in the process of running this particular test, we'll get back to that same place multiple times.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  Distinguished Engineer, Open source compilers and toolchain
  IBM Deutschland Research & Development GmbH
  Vors. des Aufsichtsrats: Gregor Pillen | Geschäftsführung: David Faller
  Sitz d. Ges.: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294

-----Original Message-----
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com<mailto:Aditya%20Kamath1%20%3cAditya.Kamath1@ibm.com%3e>>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com<mailto:Ulrich%20Weigand%20%3cUlrich.Weigand@de.ibm.com%3e>>, gdb-patches@sourceware.org <gdb-patches@sourceware.org<mailto:%22gdb-patches@sourceware.org%22%20%3cgdb-patches@sourceware.org%3e>>, simark@simark.ca <simark@simark.ca<mailto:%22simark@simark.ca%22%20%3csimark@simark.ca%3e>>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com<mailto:Sangamesh%20Mallayya%20%3csangamesh.swamy@in.ibm.com%3e>>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Date: Mon, 17 Oct 2022 06:51:17 +0000

Hi Ulrich,

Thank you for the reply. This was useful. While I was exploring other stuff related to this test case,
In the line gdb_continue_to_breakpoint "func2 breakpoint here, first time",





What does "first time" in the command gdb_continue_to_breakpoint here mean?? I can see a marker with name func2 breakpoint.. Does it mean continue to execute till that marker hits for the first time??

I am curious to know it. It will be helpful. Kindly let me know.

Have a nice day ahead.

Thanks and regards,
Aditya.
________________________________
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Sent: 14 October 2022 18:17
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch. [See:- 0001-Modify-altivec-regs.exp-
>testcase-for-AIX.patch]

>+if {[istarget "powerpc*-*-aix*"]} then {
>+  gdb_test "next"
>+  gdb_test "next"
>+}

Hard-coding the fact that there need to be exactly
two "next" iterations is not really a good idea.

Usually this is done by placing a marker comment
in the source code at the target location, and
then using something like:

        gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
        gdb_continue_to_breakpoint "func2 breakpoint here, first time"

(example from gdb.base/watchpoint.exp).

Bye,
Ulrich

[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 1835 bytes --]

From fa7a6293012bf785851f7b2b38975b7c29ff2df1 Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Wed, 19 Oct 2022 00:53:16 -0500
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

Hi,

In AIX, unless and until the debugee uses the vector registers, one cannot fetch or write on them.

This patch ensures the completion of the execution of the line that uses vector registers first time only in AIX target.

Then the testcase will be able to set and fetch the vector registers.

For the remaining targets test case will stay as it is.
---
 gdb/testsuite/gdb.arch/altivec-regs.c   | 3 +++
 gdb/testsuite/gdb.arch/altivec-regs.exp | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.c b/gdb/testsuite/gdb.arch/altivec-regs.c
index 4d4fe3f5dbb..a12297cd8bc 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.c
+++ b/gdb/testsuite/gdb.arch/altivec-regs.c
@@ -27,6 +27,9 @@ main ()
      so we don't want to execute them yet.  */
   a = 9;
   x = ((vector unsigned int) vec_splat_u8 (-2));
+
+  /* AIX altivec-regs testcase breakpoint here.  */
+
   y = ((vector unsigned int) vec_splat_u8 (1));
 	
   z = vector_fun (x, y);
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 37dbccea704..a38c03278ca 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -57,6 +57,11 @@ if ![runto_main] then {
 
 gdb_test "set print frame-arguments all"
 
+if {[istarget "powerpc*-*-aix*"]} then {
+    gdb_breakpoint [gdb_get_line_number "AIX altivec-regs testcase breakpoint here"]
+    gdb_continue_to_breakpoint "AIX altivec-regs testcase breakpoint hits first time"
+}
+
 # set all the registers integer portions to 1
 
 for {set i 0} {$i < 32} {incr i 1} {
-- 
2.31.1


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2023-02-23 12:54         ` Aditya Kamath1
@ 2023-02-24 15:37           ` Ulrich Weigand
  2023-03-01 13:45             ` Aditya Kamath1
  0 siblings, 1 reply; 15+ messages in thread
From: Ulrich Weigand @ 2023-02-24 15:37 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Kindly review the patch in the previous email which changed
>the altivec-regs.exp so that AIX folks can also use this while
>in development. We are currently working on this feature.

This still needs at the very least more comments.  Note that
the existing comments in the test case specifically say that
this test *wants* to verify that VRs can be written before
they were ever used - which works on Linux but apparently
doesn't work on AIX.

Your patch changes this, but doesn't change those comments,
which makes the resulting test confusing to read.

Also, as a functional concern: you now execute the GDB
commands to modify vector register *after* the line
   x = ((vector unsigned int) vec_splat_u8 (-2));
was executed.

If the compiler chose to hold the value of x in a
register at this point, those GDB commands would
clobber the value of x, causing subsequent execution
to fail.

While this might happen to work with the executable
produced with the current compiler and/or settings,
this is not guaranteed.

I think it would be preferable to instead extend the
test case (when compiled on AIX only) by adding some
other instruction early in main, but before that
assignment to x, that touches a vector register,
and then perform the GDB register tests after that
new instruction and before the assignment to x.

Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2023-02-24 15:37           ` Ulrich Weigand
@ 2023-03-01 13:45             ` Aditya Kamath1
  2023-03-03 15:50               ` Ulrich Weigand
  0 siblings, 1 reply; 15+ messages in thread
From: Aditya Kamath1 @ 2023-03-01 13:45 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

Hi Ulrich and community,

>I think it would be preferable to instead extend the
>test case (when compiled on AIX only) by adding some
>other instruction early in main, but before that
>assignment to x, that touches a vector register,
>and then perform the GDB register tests after that
>new instruction and before the assignment to x.

So I do not have the knowledge to do that. I had seen the align-c test case which uses a tcl script and can do the same. However in .exp file how can we do it? Do you have an example which I can look into and learn how to does it, anything different also is fine. Kindly let me know. It will be of help to me, to contribute the same.

Have a nice day ahead.

Thanks and regards,
Aditya.

From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Date: Friday, 24 February 2023 at 9:07 PM
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com>, simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Kindly review the patch in the previous email which changed
>the altivec-regs.exp so that AIX folks can also use this while
>in development. We are currently working on this feature.

This still needs at the very least more comments.  Note that
the existing comments in the test case specifically say that
this test *wants* to verify that VRs can be written before
they were ever used - which works on Linux but apparently
doesn't work on AIX.

Your patch changes this, but doesn't change those comments,
which makes the resulting test confusing to read.

Also, as a functional concern: you now execute the GDB
commands to modify vector register *after* the line
   x = ((vector unsigned int) vec_splat_u8 (-2));
was executed.

If the compiler chose to hold the value of x in a
register at this point, those GDB commands would
clobber the value of x, causing subsequent execution
to fail.

While this might happen to work with the executable
produced with the current compiler and/or settings,
this is not guaranteed.

I think it would be preferable to instead extend the
test case (when compiled on AIX only) by adding some
other instruction early in main, but before that
assignment to x, that touches a vector register,
and then perform the GDB register tests after that
new instruction and before the assignment to x.

Bye,
Ulrich

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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2023-03-01 13:45             ` Aditya Kamath1
@ 2023-03-03 15:50               ` Ulrich Weigand
  2023-03-06  7:49                 ` Aditya Kamath1
  0 siblings, 1 reply; 15+ messages in thread
From: Ulrich Weigand @ 2023-03-03 15:50 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>>I think it would be preferable to instead extend the
>>test case (when compiled on AIX only) by adding some
>>other instruction early in main, but before that
>>assignment to x, that touches a vector register,
>>and then perform the GDB register tests after that
>>new instruction and before the assignment to x.
>
>So I do not have the knowledge to do that. I had seen the align-c
>test case which uses a tcl script and can do the same. However
>in .exp file how can we do it? Do you have an example which I
>can look into and learn how to does it, anything different also
>is fine. Kindly let me know. It will be of help to me,
>to contribute the same. 

The test case source file currently looks like this:

int
main ()
{
  vector unsigned int y;
  vector unsigned int x;
  vector unsigned int z;
  int a;

  /* This line may look unnecessary but we do need it, because we want to
     have a line to do a next over (so that gdb refetches the registers)
     and we don't want the code to change any vector registers.
     The splat operations below modify the VRs,i
     so we don't want to execute them yet.  */
  a = 9;
  x = ((vector unsigned int) vec_splat_u8 (-2));
  y = ((vector unsigned int) vec_splat_u8 (1));


I was thinking of simply modifying it along those lines:

int
main ()
{
  vector unsigned int y;
  vector unsigned int x;
  vector unsigned int z;
  int a;

#ifdef _AIX
  /* On AIX, the debugger cannot access vector registers before they
     are first used by the inferior.  Perform such an access here.  */
  x = ((vector unsigned int) vec_splat_u8 (0));
#endif

  /* This line may look unnecessary but we do need it, because we want to
     have a line to do a next over (so that gdb refetches the registers)
     and we don't want the code to change any vector registers.
     The splat operations below modify the VRs,i
     so we don't want to execute them yet.  */
  a = 9;  /* start here */
  x = ((vector unsigned int) vec_splat_u8 (-2));
  y = ((vector unsigned int) vec_splat_u8 (1));


And then, in the .exp file, instead of just doing a runto_main,
set a breakpoint on the /* start here */ line, and continue
until that is hit.  Something along the lines of:

    gdb_breakpoint [gdb_get_line_number "start here"]
    gdb_continue_to_breakpoint "start here"

(You can look at many other test cases as examples.)

On non-AIX platforms, this will have no actual effect,
as the /* start here */ line is still the first line
in the main routine.  But on AIX, it will have the expected
effect that we first touch a vector register, and then do
exactly the same test sequence as elsewhere.


Bye,
Ulrich


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2023-03-03 15:50               ` Ulrich Weigand
@ 2023-03-06  7:49                 ` Aditya Kamath1
  2023-03-07  9:56                   ` Ulrich Weigand
  0 siblings, 1 reply; 15+ messages in thread
From: Aditya Kamath1 @ 2023-03-06  7:49 UTC (permalink / raw)
  To: Ulrich Weigand, gdb-patches, simark; +Cc: Sangamesh Mallayya


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

Hi Ulrich and community,

Please find attached the patch. {See: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch}. I have modified the test case as per your guidance.

>#ifdef _AIX
 > /* On AIX, the debugger cannot access vector registers before they
 >    are first used by the inferior.  Perform such an access here.  */
 > x = ((vector unsigned int) vec_splat_u8 (0));
>#endif

This is something new I learnt. Thank you so much. The idea is nice. This way power-pc Linux GDB folks won’t be affected.

Kindly push this patch if there are no further changes.

Have a nice day.

Thanks and regards,
Aditya.

From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Date: Friday, 3 March 2023 at 9:20 PM
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com>, simark@simark.ca <simark@simark.ca>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Modify altivec-regs.exp testcase for AIX
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>>I think it would be preferable to instead extend the
>>test case (when compiled on AIX only) by adding some
>>other instruction early in main, but before that
>>assignment to x, that touches a vector register,
>>and then perform the GDB register tests after that
>>new instruction and before the assignment to x.
>
>So I do not have the knowledge to do that. I had seen the align-c
>test case which uses a tcl script and can do the same. However
>in .exp file how can we do it? Do you have an example which I
>can look into and learn how to does it, anything different also
>is fine. Kindly let me know. It will be of help to me,
>to contribute the same.

The test case source file currently looks like this:

int
main ()
{
  vector unsigned int y;
  vector unsigned int x;
  vector unsigned int z;
  int a;

  /* This line may look unnecessary but we do need it, because we want to
     have a line to do a next over (so that gdb refetches the registers)
     and we don't want the code to change any vector registers.
     The splat operations below modify the VRs,i
     so we don't want to execute them yet.  */
  a = 9;
  x = ((vector unsigned int) vec_splat_u8 (-2));
  y = ((vector unsigned int) vec_splat_u8 (1));


I was thinking of simply modifying it along those lines:

int
main ()
{
  vector unsigned int y;
  vector unsigned int x;
  vector unsigned int z;
  int a;

#ifdef _AIX
  /* On AIX, the debugger cannot access vector registers before they
     are first used by the inferior.  Perform such an access here.  */
  x = ((vector unsigned int) vec_splat_u8 (0));
#endif

  /* This line may look unnecessary but we do need it, because we want to
     have a line to do a next over (so that gdb refetches the registers)
     and we don't want the code to change any vector registers.
     The splat operations below modify the VRs,i
     so we don't want to execute them yet.  */
  a = 9;  /* start here */
  x = ((vector unsigned int) vec_splat_u8 (-2));
  y = ((vector unsigned int) vec_splat_u8 (1));


And then, in the .exp file, instead of just doing a runto_main,
set a breakpoint on the /* start here */ line, and continue
until that is hit.  Something along the lines of:

    gdb_breakpoint [gdb_get_line_number "start here"]
    gdb_continue_to_breakpoint "start here"

(You can look at many other test cases as examples.)

On non-AIX platforms, this will have no actual effect,
as the /* start here */ line is still the first line
in the main routine.  But on AIX, it will have the expected
effect that we first touch a vector register, and then do
exactly the same test sequence as elsewhere.


Bye,
Ulrich

[-- Attachment #2: 0001-Modify-altivec-regs.exp-testcase-for-AIX.patch --]
[-- Type: application/octet-stream, Size: 2080 bytes --]

From 20d571d02a5fd7dce6f97523d0385a308077bc4f Mon Sep 17 00:00:00 2001
From: Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>
Date: Mon, 6 Mar 2023 01:31:34 -0600
Subject: [PATCH] Modify altivec-regs.exp testcase for AIX

On AIX, the debugger cannot access vector registers before they
are first used by the inferior.  Hence we change the test case
such that some vector registers are accessed by the variable 'x' in AIX
and other targets are not affected as a consequence of the same.
---
 gdb/testsuite/gdb.arch/altivec-regs.c   | 8 +++++++-
 gdb/testsuite/gdb.arch/altivec-regs.exp | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/altivec-regs.c b/gdb/testsuite/gdb.arch/altivec-regs.c
index 4d4fe3f5dbb..a87f6a0a054 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.c
+++ b/gdb/testsuite/gdb.arch/altivec-regs.c
@@ -20,12 +20,18 @@ main ()
   vector unsigned int z; 
   int a;
 
+  #ifdef _AIX
+  /* On AIX, the debugger cannot access vector registers before they
+     are first used by the inferior.  Perform such an access here.  */
+  x = ((vector unsigned int) vec_splat_u8 (0));
+  #endif
+
   /* This line may look unnecessary but we do need it, because we want to
      have a line to do a next over (so that gdb refetches the registers)
      and we don't want the code to change any vector registers.
      The splat operations below modify the VRs,i
      so we don't want to execute them yet.  */
-  a = 9;
+  a = 9; /* start here */
   x = ((vector unsigned int) vec_splat_u8 (-2));
   y = ((vector unsigned int) vec_splat_u8 (1));
 	
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 42521a0a9ab..41f77435a38 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -56,6 +56,9 @@ if ![runto_main] then {
     return 0
 }
 
+gdb_breakpoint [gdb_get_line_number "start here"]
+gdb_continue_to_breakpoint "start here"
+
 gdb_test "set print frame-arguments all"
 
 # set all the registers integer portions to 1
-- 
2.38.3


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

* Re: [PATCH] Modify altivec-regs.exp testcase for AIX
  2023-03-06  7:49                 ` Aditya Kamath1
@ 2023-03-07  9:56                   ` Ulrich Weigand
  0 siblings, 0 replies; 15+ messages in thread
From: Ulrich Weigand @ 2023-03-07  9:56 UTC (permalink / raw)
  To: gdb-patches, Aditya Kamath1, simark; +Cc: Sangamesh Mallayya

Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Please find attached the patch.

This is OK.  I've applied the patch.

Thanks,
Ulrich


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

end of thread, other threads:[~2023-03-07  9:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14  7:38 [PATCH] Modify altivec-regs.exp testcase for AIX Aditya Kamath1
2022-10-14  7:38 ` Aditya Kamath1
2022-10-14 12:47 ` Ulrich Weigand
2022-10-17  6:51   ` Aditya Kamath1
2022-10-17  6:51     ` Aditya Kamath1
2022-10-17  9:57     ` Ulrich Weigand
2022-10-17  9:57       ` Ulrich Weigand
2022-10-19  6:00       ` Aditya Kamath1
2022-10-19  6:00         ` Aditya Kamath1
2023-02-23 12:54         ` Aditya Kamath1
2023-02-24 15:37           ` Ulrich Weigand
2023-03-01 13:45             ` Aditya Kamath1
2023-03-03 15:50               ` Ulrich Weigand
2023-03-06  7:49                 ` Aditya Kamath1
2023-03-07  9:56                   ` 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).