oeqa/selftest/package: generalise test_gdb_hardlink_debug()

When the trivial test binary, which just calls printf(), is compiled for
aarch64 with -O2 -D_FORTIFY=2 (as is the default configuration), gdb
resolves main() to the inlined printf() wrapper in stdio2.h instead of
main.c, so the test fails.

Presumably, this is due to debugging being unreliable with -O2. Solve
this problem by not caring where the main() breakpoint resolves to, just
check that it was resolved at all.

(From OE-Core rev: c51c12154851d04a81c8fbe190e712b3cd8dc941)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2022-11-09 19:31:29 +00:00
committed by Richard Purdie
parent 92c1e7300f
commit 8e72283f54

View File

@@ -135,8 +135,10 @@ class PackageTests(OESelftestTestCase):
self.logger.error("No debugging symbols found. GDB result:\n%s" % output)
return False
# Check debugging symbols works correctly
elif re.match(r"Breakpoint 1.*hello\.c.*4", l):
# Check debugging symbols works correctly. Don't look for a
# source file as optimisation can put the breakpoint inside
# stdio.h.
elif "Breakpoint 1 at" in l:
return True
self.logger.error("GDB result:\n%d: %s", status, output)