public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Small fixes to run gdb.python with clang
@ 2023-10-25 14:24 Guinevere Larsen
  2023-10-25 14:24 ` [PATCH 1/2] gdb/testsuite: fix running gdb.python/py-explore-cc " Guinevere Larsen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guinevere Larsen @ 2023-10-25 14:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

The gdb.python subdiretory currently has 3 failures on the buildbot. One
is an easy one-liner to fix on GDB's side - inconsistent line
information from clang - and the other is a known issue with clang and
location expressions (see:
https://github.com/llvm/llvm-project/issues/64390). The third issue is
not easy to fix, so I considered it out of scope for this series.

Guinevere Larsen (2):
  gdb/testsuite: fix running gdb.python/py-explore-cc with clang
  gdb/testsuite: add a clang XFAIL to gdb.python/py-watchpoint.exp

 gdb/testsuite/gdb.python/py-explore.cc     |  3 ++-
 gdb/testsuite/gdb.python/py-watchpoint.exp | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.41.0


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

* [PATCH 1/2] gdb/testsuite: fix running gdb.python/py-explore-cc with clang
  2023-10-25 14:24 [PATCH 0/2] Small fixes to run gdb.python with clang Guinevere Larsen
@ 2023-10-25 14:24 ` Guinevere Larsen
  2023-10-25 14:24 ` [PATCH 2/2] gdb/testsuite: add a clang XFAIL to gdb.python/py-watchpoint.exp Guinevere Larsen
  2023-10-25 15:07 ` [PATCH 0/2] Small fixes to run gdb.python with clang Tom Tromey
  2 siblings, 0 replies; 5+ messages in thread
From: Guinevere Larsen @ 2023-10-25 14:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

The test gdb.python/py-explore-cc.exp was showing one unexpected
failure. This was due to how clang mapped instructions to lines,
resulting in the inferior seemingly stopping at a different location.

This patch adds a nop line in the relevant location so we don't need to
add XFAILs for existing clang releases, if this gets solved in future
versions.
---
 gdb/testsuite/gdb.python/py-explore.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-explore.cc b/gdb/testsuite/gdb.python/py-explore.cc
index dfbc08ce5e3..e526c3c4975 100644
--- a/gdb/testsuite/gdb.python/py-explore.cc
+++ b/gdb/testsuite/gdb.python/py-explore.cc
@@ -42,7 +42,8 @@ func (const A &a)
   b.i = 10;
   b.c = 'a';
 
-  return 0; /* Break here.  */
+  val *= 1; /* Break here.  */
+  return 0;
 }
 
 int
-- 
2.41.0


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

* [PATCH 2/2] gdb/testsuite: add a clang XFAIL to gdb.python/py-watchpoint.exp
  2023-10-25 14:24 [PATCH 0/2] Small fixes to run gdb.python with clang Guinevere Larsen
  2023-10-25 14:24 ` [PATCH 1/2] gdb/testsuite: fix running gdb.python/py-explore-cc " Guinevere Larsen
@ 2023-10-25 14:24 ` Guinevere Larsen
  2023-10-25 15:07 ` [PATCH 0/2] Small fixes to run gdb.python with clang Tom Tromey
  2 siblings, 0 replies; 5+ messages in thread
From: Guinevere Larsen @ 2023-10-25 14:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

Clang doesn't use CFA information for variable locations. This makes it
so software breakpoints get a false hit when rbp gets popped, causing
a FAIL in gdb.python/py-watchpoint.exp. Since this is nothing wrong with
GDB itself, add an xfail to reduce noise.
---
 gdb/testsuite/gdb.python/py-watchpoint.exp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-watchpoint.exp b/gdb/testsuite/gdb.python/py-watchpoint.exp
index 9a6ef447572..5ff61285979 100644
--- a/gdb/testsuite/gdb.python/py-watchpoint.exp
+++ b/gdb/testsuite/gdb.python/py-watchpoint.exp
@@ -42,5 +42,20 @@ gdb_test "source $pyfile" ".*Python script imported.*" \
     "import python scripts"
 gdb_test "python print(len(gdb.breakpoints()))" "2" "check modified BP count"
 gdb_test "continue" ".*" "run until program stops"
-gdb_test "python print(bpt.n)" "5" "check watchpoint hits"
+# Clang doesn't use CFA location information for variables (despite generating
+# them), meaning when the instruction "pop rbp" happens, we get a false hit
+# on the watchpoint. for more details, see:
+# https://github.com/llvm/llvm-project/issues/64390
+gdb_test_multiple "python print(bpt.n)" "check watchpoint hits" {
+    -re -wrap "5" {
+	pass $gdb_test_name
+    }
+    -re -wrap "6" {
+	if {[test_compiler_info "clang-*"]} {
+	    xfail "$gdb_test_name (clang issue 64390)"
+	} else {
+	    fail $gdb_test_name
+	}
+    }
+}
 gdb_test "python print(len(gdb.breakpoints()))" "1" "check BP count"
-- 
2.41.0


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

* Re: [PATCH 0/2] Small fixes to run gdb.python with clang
  2023-10-25 14:24 [PATCH 0/2] Small fixes to run gdb.python with clang Guinevere Larsen
  2023-10-25 14:24 ` [PATCH 1/2] gdb/testsuite: fix running gdb.python/py-explore-cc " Guinevere Larsen
  2023-10-25 14:24 ` [PATCH 2/2] gdb/testsuite: add a clang XFAIL to gdb.python/py-watchpoint.exp Guinevere Larsen
@ 2023-10-25 15:07 ` Tom Tromey
  2023-10-25 16:24   ` Guinevere Larsen
  2 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2023-10-25 15:07 UTC (permalink / raw)
  To: Guinevere Larsen; +Cc: gdb-patches

>>>>> "Guinevere" == Guinevere Larsen <blarsen@redhat.com> writes:

Guinevere> The gdb.python subdiretory currently has 3 failures on the buildbot. One
Guinevere> is an easy one-liner to fix on GDB's side - inconsistent line
Guinevere> information from clang - and the other is a known issue with clang and
Guinevere> location expressions (see:
Guinevere> https://github.com/llvm/llvm-project/issues/64390). The third issue is
Guinevere> not easy to fix, so I considered it out of scope for this series.

These look fine to me.  Thank you.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

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

* Re: [PATCH 0/2] Small fixes to run gdb.python with clang
  2023-10-25 15:07 ` [PATCH 0/2] Small fixes to run gdb.python with clang Tom Tromey
@ 2023-10-25 16:24   ` Guinevere Larsen
  0 siblings, 0 replies; 5+ messages in thread
From: Guinevere Larsen @ 2023-10-25 16:24 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 25/10/2023 17:07, Tom Tromey wrote:
>>>>>> "Guinevere" == Guinevere Larsen <blarsen@redhat.com> writes:
> Guinevere> The gdb.python subdiretory currently has 3 failures on the buildbot. One
> Guinevere> is an easy one-liner to fix on GDB's side - inconsistent line
> Guinevere> information from clang - and the other is a known issue with clang and
> Guinevere> location expressions (see:
> Guinevere> https://github.com/llvm/llvm-project/issues/64390). The third issue is
> Guinevere> not easy to fix, so I considered it out of scope for this series.
>
> These look fine to me.  Thank you.
> Approved-By: Tom Tromey <tom@tromey.com>
>
> Tom
>
Thanks, pushed :3

-- 
Cheers,
Guinevere Larsen
She/Her/Hers


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

end of thread, other threads:[~2023-10-25 16:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25 14:24 [PATCH 0/2] Small fixes to run gdb.python with clang Guinevere Larsen
2023-10-25 14:24 ` [PATCH 1/2] gdb/testsuite: fix running gdb.python/py-explore-cc " Guinevere Larsen
2023-10-25 14:24 ` [PATCH 2/2] gdb/testsuite: add a clang XFAIL to gdb.python/py-watchpoint.exp Guinevere Larsen
2023-10-25 15:07 ` [PATCH 0/2] Small fixes to run gdb.python with clang Tom Tromey
2023-10-25 16:24   ` Guinevere Larsen

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).