public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix gdb.dwarf2/dw2-entry-points.exp on ppc64le
@ 2024-01-11 12:42 Tom de Vries
  2024-01-11 12:55 ` Guinevere Larsen
  2024-01-11 15:01 ` Ulrich Weigand
  0 siblings, 2 replies; 5+ messages in thread
From: Tom de Vries @ 2024-01-11 12:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand, Carl Love

On ppc64le-linux, I run into:
...
(gdb) bt^M
 #0  0x00000000100006dc in foobar (J=2)^M
 #1  0x000000001000070c in prog ()^M
(gdb) FAIL: gdb.dwarf2/dw2-entry-points.exp: bt foo
...

The test-case attemps to emulate additional entry points of a function, with
function bar having entry points foo and foobar:
...
(gdb) p bar
$1 = {void (int, int)} 0x1000064c <bar>
(gdb) p foo
$2 = {void (int, int)} 0x10000698 <foo>
(gdb) p foobar
$3 = {void (int)} 0x100006d0 <foobar>
...

However, when setting a breakpoint on the entry point foo:
...
(gdb) b foo
Breakpoint 1 at 0x100006dc
...
it ends up in foobar instead of in foo, due to prologue skipping, and
consequently the backtrace show foobar instead foo.

The problem is that the test-case does not emulate an actual prologue at each
entry point.

Fix this by disabling the prologue skipping when setting a breakpoint, using
"break *foo".

Tested on ppc64le-linux and x86_64-linux.

PR testsuite/31232
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31232
---
 gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
index f361820f72f..035b15ee087 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-entry-points.exp
@@ -180,8 +180,8 @@ if ![runto_main] {
 }
 
 # Try whether we can set and hit breakpoints at the entry_points.
-gdb_breakpoint "foo"
-gdb_breakpoint "foobar"
+gdb_breakpoint "*foo"
+gdb_breakpoint "*foobar"
 
 # Now hit the entry_point break point and check their call-stack.
 gdb_continue_to_breakpoint "foo"
@@ -204,7 +204,7 @@ if ![runto_main] {
     return -1
 }
 
-gdb_breakpoint "fooso"
+gdb_breakpoint "*fooso"
 gdb_continue_to_breakpoint "foo_so"
 
 gdb_test "bt" [multi_line \

base-commit: 4ece39c56cfdd5647d4061f3c084b9de6f9e443c
-- 
2.35.3


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

end of thread, other threads:[~2024-01-11 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11 12:42 [PATCH] [gdb/testsuite] Fix gdb.dwarf2/dw2-entry-points.exp on ppc64le Tom de Vries
2024-01-11 12:55 ` Guinevere Larsen
2024-01-11 13:08   ` Tom de Vries
2024-01-11 13:33     ` Guinevere Larsen
2024-01-11 15:01 ` 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).