Need help profiling with Valgrind

Björn Döbel doebel at os.inf.tu-dresden.de
Sun Nov 9 22:49:46 CET 2014


Hi,

> i run into an Error in my l4re-App.
> Till now, i did printf()-Debugging, but it is at its limit in this case.
>
> The Error message is the following:
>> L4Re[rm]: unhandled write page fault @7ffff300 pc=15c7a8

This error message tells you that your program is trying to execute an 
instruction at PC value 0x15c7a8. This instruction causes a write page 
fault at address 0x7ffff300 and L4re does not know what to do about it.

This usually happens when you try to access an address with no memory 
mapped. From the address it looks like you are accessing an address 
right below your stack, i.e., you are exceeding L4Re's default stack 
size. Most likely you have a function with a large buffer on the stack 
or you are recursing very deeply?

> However, with printf() i can't make it up to specific code.
> But, there is a function with some if-else stuff, and if i comment some
> lines out, the Error doesnt appear. Funny, printf() tells me, that the
> commented code never executes. i.e. the else-part is never ever
> executed, but the program still fails when it is not commented out.
>
> So, i'm not sure what to try next.
> Does Valgrind work here?

Probably it would. Valgrind tracks allocated memory regions and could at 
least tell you what I told you above: you are accessing memory out of 
any allocated region.

> And what about the Valgrind in the Snapshot?
> It has some strange Makefile. Does this work for a ARM system?
>> SYSTEMS = x86-l4f
>>
>> all::
>>        if [ ! -e $(PKGDIR)/broken ]; then PWD=$(PWD)/build make -C
>> build; fi
>
> Or can i run my bootstrap.raw on an standard ARM Linux?

Nope, we only ported it to x86/32, never tried ARM.

> Anything else to try besides Valgrind?

As suggested above, check for deep recursion or arrays allocated on the 
stack. If that does not help, try increasing L4Re's default stack size 
for your application using the L4RE_ELF_AUX_ELEM_T macro defined in 
l4/re/elf_aux.h. For this, place something like this anywhere in your 
compilation unit:

#include <l4/re/elf_aux.h>
L4RE_ELF_AUX_ELEM_T(l4re_elf_aux_mword_t, stack_size,
                     L4RE_ELF_AUX_T_STACK_SIZE, 65536);

(This example sets the stack size to 64k.)

Hth,
Bjoern



More information about the l4-hackers mailing list