|
From: Angel T. <fn...@fm...> - 2006-02-27 19:19:11
|
I wrote a simple C++ program like this:
#include <iostream>
int main
(
int //num_args
, char* /*args*/[]
)
{
using namespace std;
cout << "This is OK" << endl;
}
Then I compiled it and executed the binary with Valgrind attached as follows:
valgrind -v a.out
==13751== Memcheck, a memory error detector.
==13751== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==13751== Using LibVEX rev 1471, a library for dynamic binary translation.
==13751== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==13751== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==13751== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==13751==
--13751-- Command line
--13751-- a.out
--13751-- Startup, with flags:
--13751-- -v
--13751-- Contents of /proc/version:
--13751-- Linux version 2.4.19-4asmp (ro...@ka...) (gcc version 2.95.4 20010319 (prerelease/franzo/20011204)) #1 SMP
Wed Jun 5 00:59:38 EDT 2002
--13751-- Arch and subarch: PPC32, ppc32-int-fp-and-AV
--13751-- Valgrind library directory: /home/angel/installed/Valgrind/lib/valgrind
--13751-- Reading syms from /lib/ld-2.2.5.so (0x4000000)
--13751-- Reading syms from /home/angel/projects/test/source/a.out (0x10000000)
--13751-- Reading syms from /home/angel/installed/Valgrind/lib/valgrind/ppc32-linux/memcheck (0x70000000)
--13751-- object doesn't have a dynamic symbol table
--13751-- Reading suppressions file: /home/angel/installed/Valgrind/lib/valgrind/default.supp
==13751==
==13751== Process terminating with default action of signal 11 (SIGSEGV)
==13751== Bad permissions for mapped region at address 0x4025D30
==13751== at 0x4025D30: ???
==13751== by 0x4010F20: _start (in /lib/ld-2.2.5.so)
==13751==
==13751== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13751== malloc/free: in use at exit: 0 bytes in 0 blocks.
==13751== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==13751==
==13751== No malloc'd blocks -- no leaks are possible.
--13751-- memcheck: sanity checks: 0 cheap, 1 expensive
--13751-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
--13751-- memcheck: auxmaps: 0 searches, 0 comparisons
--13751-- memcheck: secondaries: 6 issued (384k, 0M)
--13751-- memcheck: secondaries: 1 accessible and distinguished (64k, 0M)
--13751-- tt/tc: 5 tt lookups requiring 4 probes
--13751-- tt/tc: 4 fast-cache updates, 2 flushes
--13751-- translate: new 2 (100 -> 1,104; ratio 110:10) [0 scs]
--13751-- translate: dumped 0 (0 -> ??)
--13751-- translate: discarded 0 (0 -> ??)
--13751-- scheduler: 2 jumps (bb entries).
--13751-- scheduler: 0/3 major/minor sched events.
--13751-- sanity: 1 cheap, 1 expensive checks.
--13751-- exectx: 30,011 lists, 0 contexts (avg 0 per list)
--13751-- exectx: 0 searches, 0 full compares (0 per 1000)
--13751-- exectx: 0 cmp2, 0 cmp4, 0 cmpAll
Segmentation fault
When I run the program w/o Valgrind it prints out the message and terminates normally.
Why does this not happen when Valgrind is attached?
|