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.

Signed-off-by: Ross Burton <[email protected]>
---
 meta/lib/oeqa/selftest/cases/package.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/package.py 
b/meta/lib/oeqa/selftest/cases/package.py
index 2d1b48a15df..482a7c02ad4 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -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)
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173042): 
https://lists.openembedded.org/g/openembedded-core/message/173042
Mute This Topic: https://lists.openembedded.org/mt/94920921/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to