1From 9b27fa9bcd5cadd4c841c42710f41a090377e531 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Fri, 24 Mar 2023 16:18:44 +0000
4Subject: [PATCH] src/Gtrace: remove unguarded print() calls
5
6There is a use of printf() without #include stdio.h in src/arm/Gtrace.c,
7which results in a compiler error if clang 16 is used:
8
9src/arm/Gtrace.c:529:7: error: call to undeclared library function
10'printf' with type 'int (const char *, ...)'; ISO C99 and later do not
11support implicit function declarations [-Wimplicit-function-declaration]
12
13Replace the printf("XXX") with a Dprintf, so it doesn't pull stdio in
14unless in a debug build, and reword the message to be clearer.
15
16Also there is another printf("XXX") inside a FreeBSD-specific block in
17the UNW_ARM_FRAME_SIGRETURN case, replace this with a #error as the code
18needs to be implemented.
19
20Fixes #482.
21
22Upstream-Status: Backport [9b27fa9bcd5cadd4c841c42710f41a090377e531]
23Signed-off-by: Ross Burton <ross.burton@arm.com>
24---
25 src/arm/Gtrace.c | 4 ++--
26 1 file changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/src/arm/Gtrace.c b/src/arm/Gtrace.c
29index 51fc281d..9e0f25af 100644
30--- a/src/arm/Gtrace.c
31+++ b/src/arm/Gtrace.c
32@@ -514,7 +514,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
33       if (likely(ret >= 0))
34         ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_LR_OFF, lr);
35 #elif defined(__FreeBSD__)
36-      printf("XXX\n");
37+      #error implement UNW_ARM_FRAME_SIGRETURN on FreeBSD
38 #endif
39
40       /* Resume stack at signal restoration point. The stack is not
41@@ -526,7 +526,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size)
42       break;
43
44     case UNW_ARM_FRAME_SYSCALL:
45-      printf("XXX1\n");
46+      Dprintf ("%s: implement me\n", __FUNCTION__);
47       break;
48
49     default:
50--
512.34.1
52
53