SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 610 | Next

Shon Harris, Allen Harper, Chris Eagle, and Jonathan Ness

"Gray Hat Hacking, Second Edition"

valgrind can be used with any compiled x86 binary; no source code is
required. It is essentially an instrumented x86 interpreter that carefully tracks memory
accesses performed by the program being interpreted. Basic valgrind analysis is performed
from the command line by invoking the valgrind wrapper and naming the
binary that it should execute. To use valgrind with the following example:
/*
* valgrind_1.c - uninitialized memory access
*/
int main() {
int p, t;
if (p == 5) { /*Error occurs here*/
t = p + 1;
}
return 0;
}
you simply compile the code and then invoke valgrind as follows:
# gcc ??“o valgrind_1 valgrind_1.c
# valgrind ./valgrind_1
valgrind runs the program and displays memory use information as shown here:
==16541== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==16541== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==16541== Using valgrind-2.0.0, a program supervision framework for x86-linux.
==16541== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==16541== Estimated CPU clock rate is 3079 MHz
==16541== For more details, rerun with: -v
==16541==
==16541== Conditional jump or move depends on uninitialised value(s)
==16541== at 0x8048328: main (in valgrind_1)
==16541== by 0xB3ABBE: __libc_start_main (in /lib/libc-2.


Pages:
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622