Skip to content
Snippets Groups Projects
  1. Apr 29, 2013
  2. Apr 28, 2013
  3. Apr 25, 2013
    • Nadav Har'El's avatar
      Remove unnecessary for() and switch() from backtrace() code. · 8f7a6517
      Nadav Har'El authored
      This code is ugly enough - it didn't actually need the loor or switch
      to make it even uglier ;-)
      8f7a6517
    • Nadav Har'El's avatar
    • Nadav Har'El's avatar
      Changed backtrace() implementation to allow lead detection in Java · b7295cc4
      Nadav Har'El authored
      My previous implementation of backtrace() didn't work when Java was running
      (see comments in the code in this commit for an explanation why), so I
      wrote a third (!) implementation of backtrace() which does work in Java,
      and now leak detection can be done in both Java and our own tests .so's.
      
      Please note that backtrace() now relies on frame pointers, which are currently
      omitted in the "release" build - so it can only be used now in the "debug"
      build. Seeing we only use backtrace() for leak detection, I guess this is
      acceptable for now.
      
      A reminder on how to use leak detection - the easiest thing is to add
      the "--leak" command line paramter to the loader, to have it start leak
      detection when entering the payload (not during OSv boot):
      
      $ make -j4 mode=debug
      $ scripts/imgedit.py setargs build/release/loader.img --leak java.so Try3
      $ scripts/run -d
      
      (this will run java/Try3.class - use whatever command line you want ;-)).
      
      Let it run till the end, and then
      $ gdb build/debug/loader.elf
      (gdb) connect
      (gdb) osv syms
      (gdb) set logging on
      (gdb) set height 0
      (gdb) osv leak show
      
      Please note that "osv leak show" can take a L-O-N-G time - even a few
      minutes, as Java allocates myriads of objects that GDB will now have to
      inspect. In a simple test I did, more than 18689 allocations from 1300
      different call chains were alive at the end, and printing all of this takes
      time (so does looking at it... eventually I'll add better tools for finding
      the most suspicious blocks).
      b7295cc4
    • Nadav Har'El's avatar
      Added "--leak" command line option · 600f960b
      Nadav Har'El authored
      Added to the loader a command-line option "--leak" to enable the leak
      detector immediately before running the payload's main(). For example, to
      look for leaks in tst-fpu.so (there are none, by the way ;-)), do
      
      	scripts/imgedit.py setargs build/release/loader.img --leak tests/tst-fpu.so
      
      and when it ends, look at the leak detection results:
      	$ gdb build/release/loader.elf
      	(gdb) connect
      	(gdb) osv leak show
      
      Unfortunately, this doesn't work when the payload is Java - I'm still trying
      to figure out why.
      600f960b
    • Guy Zana's avatar
      tests: use a const to indicate buffer size · 41876afd
      Guy Zana authored
      41876afd
Loading