]> granicus.if.org Git - strace/commitdiff
unwind: fix build on 32-bit architectures
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 5 Jun 2014 14:37:04 +0000 (14:37 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 5 Jun 2014 15:42:05 +0000 (15:42 +0000)
Fix compilation warnings in unwind.c on 32-bit architectures.
On some architectures getuid is actually getuid32, so change the test
to use getpid instead of getuid.

* unwind.c (STACK_ENTRY_SYMBOL_FMT): Explicitly cast function_off_set
to unsigned long.
(queue_put_error): Change the 3rd argument's type to unsigned long.
* tests/stack-fcall.c (f1): Use getpid instead of getuid.
* tests/strace-k.test: Likewise.

tests/stack-fcall.c
tests/strace-k.test
unwind.c

index 04339b1856bff8e528042178e74ea027bf1aa00e..1c66fefa77b6c1e31abfdcee17de71051e6160e5 100644 (file)
@@ -5,7 +5,7 @@
 
 int f1(int i)
 {
-       static uid_t (* volatile g)(void) = getuid;
+       static pid_t (* volatile g)(void) = getpid;
        return g() + i;
 }
 
index 329f30248f5e2cbdf3436c345c8a7a2f77491e48..3845c8cefdb50c74b3b0a37d4cec976fb239c49f 100755 (executable)
@@ -17,13 +17,13 @@ check_prog tr
 $STRACE -h | grep '^-k' > /dev/null ||
        skip_ 'strace -k is not available'
 
-args="-e getuid -k ./stack-fcall"
+args="-e getpid -k ./stack-fcall"
 $STRACE $args > $LOG 2>&1 || {
        cat $LOG
        fail_ "$STRACE $args failed"
 }
 
-expected='getuid f1 f0 main '
+expected='getpid f1 f0 main '
 result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' $LOG |
        tr '\n' ' ')
 
index 797a287a81935d13bec05b91458db7991ef94464..21f2a481866718af13720875a5cb544a4b7335da 100644 (file)
--- a/unwind.c
+++ b/unwind.c
@@ -403,7 +403,7 @@ ret:
        " > %s(%s+0x%lx) [0x%lx]\n",            \
        binary_filename,                        \
        symbol_name,                            \
-       function_off_set,                       \
+       (unsigned long) function_off_set,       \
        true_offset
 #define STACK_ENTRY_NOSYMBOL_FMT               \
        " > %s() [0x%lx]\n",                    \
@@ -523,7 +523,7 @@ queue_put_call(void *queue,
 static void
 queue_put_error(void *queue,
                const char *error,
-               unw_word_t ip)
+               unsigned long ip)
 {
        queue_put(queue, NULL, NULL, 0, ip, error);
 }