|
From: Alexander P. <gl...@go...> - 2010-01-22 12:59:55
|
Hi all,
I'm running the following C code under Valgrind on a ARMv7 CPU:
==========broken-stack.c============
#include <stdio.h>
void f4() {
int a;
if (a) {
printf("a==true\n");
} else {
printf("a==false\n");
}
}
void f3() { f4(); }
void f2() { f3(); }
void f1() { f2(); }
int main() {
f1();
return 0;
}
===============================
$ gcc broken-stack.c -o broken-stack
$ valgrind broken-stack
==4615== Memcheck, a memory error detector
==4615== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==4615== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==4615== Command: /home/glider/src/arm-stack/broken-stack
==4615==
==4615== Conditional jump or move depends on uninitialised value(s)
==4615== at 0x83C8: f4 (in /home/glider/src/arm-stack/broken-stack)
==4615==
a==true
==4615==
==4615== HEAP SUMMARY:
...
As you can see, the stack trace contains only the top function,
whereas on x86 Linux the whole stack trace is printed.
Is it the desired behavior of Memcheck on ARM?
Thanks in advance,
Alexander Potapenko
Software Engineer
Google Moscow
|
|
From: Julian S. <js...@ac...> - 2010-01-22 13:22:11
|
On Friday 22 January 2010, Alexander Potapenko wrote: > As you can see, the stack trace contains only the top function, > whereas on x86 Linux the whole stack trace is printed. > Is it the desired behavior of Memcheck on ARM? Unwinding on ARM (or, more correctly, ARM-ELF as provided by Ubuntu 9.04) absolutely requires compiling with -g, since without that, the Dwarf3 unwind info is not present. This is different from the situation on AMD64-Linux, in which unwind info is always present regardless of the presence or absence of -g. Note that -g does not imply that -O0 is required. The guidelines for -O settings remain the same as for other platforms -- which is that -O is OK (and recommended), but -O2 and above are not. In short: "-g -O0" or "-g -O". J |