Archive for August, 2009

How to Debug C++ Programs on Windows and Linux?

August 31st, 2009 by admin | 0

Interested in Debugging C++ or C programs on Windows and Linux. The following tutorials will run you through the debugging process quickly.

Use of the Debugger in Visual C++ – Explains how to use the debugger in Visual C++ Versions 5 and 6. Debugging is the name given to the process of removing bugs from [...]

Xdebug Remote Debugging

August 14th, 2009 by admin | 0

Xdebug is very powerful yet simple. It is missing only one feature, which is multi-user support. This requires the xdebug proxy to be supported. This allows multiple sessions to connect to the proxy with a different ide key (the argument for xdebug_session_start).
Xdebug is an extension for php that provides debugging support. Put them together and [...]

Perl Debugging Tools – Perl Debugger Commands

August 11th, 2009 by admin | 0

A quick summary of the commands provided by Perl Debugger and how to go about with debugging perl scripts.
Related Terms – Perl Debugger Tool, Debugging Perl Cgi Scripts, Perl Ide Debugger, Perl Debug Command Line, Perl Debugger Unix, Perl Debugger Commands, Perl Tk Debugger, Perl Debug Module
warn LIST
Concatenates LIST, and prints result to STDERR. [...]

Perl Debugger Module – CGI Debug – Command Line Debugging

August 11th, 2009 by admin | 0

Here we will take a quick look at Perl Debugger. Familarity with using perl debugger is assumed.
Related Terms – Debugging Tools, Perl Debugger Breakpoint, Perl Debug Command Line, Perl Debug Module, Perl Cgi Debug
Before we even get to the debugger… Have you:

Turned on warnings via use warnings or perl –w?
Do you use strict wherever possible?
Does [...]

Ollydbg Tutorial Reverse Engineering – Olly Dbg Plugins

August 4th, 2009 by admin | 0

OllyDbg is a debugger that emphasizes binary code analysis, which is useful when source code is not available. It traces registers , recognizes procedures , API calls, switches, tables , constants and strings , as well as locates routines from object files and libraries.
Olly Debugger Tutorial

Beginner guide to use olly debugger
Olly Debugger [...]

Valgrind Memory Checker – Tutorials Documentation

August 3rd, 2009 by admin | 0

If you are serious about learning Valgrind, here are some very useful documents (PDF format. You need Adobe Acrobat to read it.
Related Terms: Valgrind Memcheck, Valgrind Cachegrind, Valgrind Callgrind, Valgrind Ld_preload, Valgrind Memory Leaks, Valgrind Tutorial, Valgrind Debugger, Valgrind Stack

Valgrind Documentation
Valgrind HOWTO
The Valgrind Memory Checker. (i.e., Your best friend.)
Microsoft PowerPoint – Valgrind Tutorial.ppt
Valgrind
Optimizing Binary Code [...]

A Primer on Valgrind – Valgrind Tutorial

August 3rd, 2009 by admin | 0

What Does Valgrind Do?

Runs a program on a virtual CPU
Is able to check every memory access
Can check for memory leaks, errors
Detects use of uninitialized memory
Runs 25­50 slower
Can handle optimized binary (with some footnotes)
No need to generate special binary

Running Valgrind in different modes:
valgrind –tool=  program args
Checker types:

memcheck – A through memory analysis

* massif – A Heap profiler
* helgrind – A data­race (multi­threaded access) detector

addrcheck – A lighter weight memory checker (fast)
cachegrind – A processor cache hit/miss analyzer
callgrind – A heavyweight profiler
lackey ­­ simple profiler and memory tracer

Other Experimental Variants:

crocus – A signal call tracing tool
interactive – Valgrind with a gdb like interface
redux – A data flow tracer

Memcheck tool Errors Detected:

Use of uninitialised memory
Reading/writing memory after it has been free’d
Reading/writing off the end of malloc’d blocks
Reading/writing inappropriate areas on the stack
Memory leaks ­ where pointers to malloc’d blocks are lost forever
Mismatched use of malloc/new/new [] vs free/delete/delete []
Overlapping src and dst pointers in memcpy() and related functions

Not Detected:

Bounds exceeded in stack or static arrays

Memcheck tool Common Command Line Args For memcheck:

­­leak­check=yes    # Report on leak statisics
­­show­reachable=yes  # Report pointers still active

Global Command Line Args (all tools)

 ­v            # be verbose
­­log­file=file  # messages separated by pid e.g: file.pid1234
­­log­file­exactly=file  # all messages into ‘file’
­­log­fd=2  # merges output onto program’s stderr

Making Options a Bit Easier: Options can come from 4 sources:

command line
Dot file in home directory .valgrindrc
Environment variable $VALGRIND_OPTS
Dot file in current directory .valgrindrc

The syntax is: ­­toolname: option Example:

­­memcheck: leak­check=yes
­­memcheck: show­reachable=yes

General Limitations:

? PThreads are emulated, possibly causing execution differences
Scheduler is round­robin only, but reschedules more often the default
Threads run one­at a time, regardless of # of CPU’s
Priority based scheduling calls ignored (with message)
Shared memory synchronization can fail (atomic operations not atomic)
Some instructions (like 3Dnow) not supported
Floating point emulated by 64bit, not 80 bit FP

Important Tips for Using Valgrind

Use /usr/bin/valgrind, not /usr/local/bin/valgrind
(V2.2 vs. V2.0; the latter is buggy)
Reference: https://safe.nrao.edu/wiki/pub/GB/Software/LunchTopics/valgrind.pdf
Related Posts:No Related Posts

Powered by Yahoo! Answers