Re: [PATCH] tests: ptrace-sync: relax breakpoint pattern matching
"Wang, Yuan1" <[email protected]>
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <aaa/[email protected]> |
On 2026-03-02 at 08:10:21 +0100, Jan Kiszka wrote:
> On 02.03.26 15:26, Yuan Wang wrote:
> > In some OS distributions, the gdb output of the break instruction
> > doesn't contain the function name where the breakpoint is set. This
> > is observed on Ubuntu 22.04.5. with GNU gdb
> > (Ubuntu 12.1-0ubuntu1~22.04.2) 12.1., causing pattern matching
> > failures and subsequent test failures.
> >
> > Remove the ": bp\." suffix requirement to make the pattern
> > more robust across different gdb versions and configurations.
> >
> > The original failed log (run with -v) -
> >
> > "
> > -> {{ "b bp" }}
> > EXPECT {{ ^Breakpoint 1 at .*: bp\.}}
> > <- {{ "Breakpoint 1 at 0x28b9: file ../tests/ptrace-sync.c, line 59." }}
>
> I guess the difference comes from this toolchain compiling bp into a
> single function, rather than 3 inline spots like gcc-4 of Debian is
> generating.
>
I'm not sure when gdb can return function names for breakpoints. I
tried 'b main', it returns output in the form of file + line
number.
(gdb) b main
Breakpoint 1 at 0x3a2b: file ../tests/ptrace-sync.c, line 277.
I also tried modifying the bp function to inline, but it still
returns output in the form of file + line number.
code [
57│ static inline void bp(void)
58│ {
59│ __Texpr_assert(!evl_is_inband());
60│ }
]
(gdb) b bp
Breakpoint 2 at 0x28b5: file ../tests/ptrace-sync.c, line 59.
And below it my compile steps for libevl -
$meson setup .. -Dbuildtype=debug -Duapi=<path-to-linux-evl>
$meson compile
> > <- {{ "(gdb)" }}
> >
> > <timeout waiting for gdb>
> > "
> >
> > Signed-off-by: Yuan Wang <[email protected]>
> > Signed-off-by: Junxiao Chang <[email protected]>
> > ---
> > tests/ptrace-sync.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/ptrace-sync.c b/tests/ptrace-sync.c
> > index 4c56e73..556c7a6 100644
> > --- a/tests/ptrace-sync.c
> > +++ b/tests/ptrace-sync.c
> > @@ -147,7 +147,7 @@ static struct dialog {
> > { "^Reading symbols from .*", "set prompt (gdb)\\n" },
> > { ".*(gdb).*", "set env __EVL_DEBUGGEE__=1" },
> > { "(gdb)", "b bp" },
> > - { "^Breakpoint 1 at .*: bp\\.", "r" },
> > + { "^Breakpoint 1 at .*", "r" },
> > { "^Thread 1 .* hit Breakpoint 1.*, bp ().*", "c" },
> > { "^Thread 3 .* hit Breakpoint 1.*, bp ().*", "c" },
> > { "^Thread 2 .* hit Breakpoint 1.*, bp ().*", "c" },
>
> Maybe you could tag the target repo in future submissions, e.g. like this:
>
> [PATCH libevl] ...
>
Sure, will add the target tag in the future.
Thanks
Yuan