Check-in [33a93aab41]
Overview
Comment:Updated to make "leakcheck" more tolerant of %p formats
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 33a93aab41e12ffd187bc4be96c04ff9711696b6
User & Date: rkeene on 2013-01-15 14:20:23
Other Links: manifest | tags
Context
2013-01-18
15:11
Added support for compiling in a default debug log file check-in: 0e0490e060 user: rkeene tags: trunk
2013-01-15
14:20
Updated to make "leakcheck" more tolerant of %p formats check-in: 33a93aab41 user: rkeene tags: trunk
14:11
Updated debugging messages to be written in a single fprintf() call in an attempt to avoid having them intermingled when written from multiple threads check-in: 402217513a user: rkeene tags: trunk
Changes

Modified leakcheck/leakcheck from [a80110599b] to [2624af0c94].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/bash

LEAKCHECKFILE="$1"
TMPFILE="${TMPDIR:-/tmp}/malloc-free-check-$$${RANDOM}${RANDOM}${RANDOM}.tmp"
export LEAKCHECKFILE TMPFILE

if [ -z "${LEAKCHECKFILE}" ]; then
	echo "Usage: leakcheck <filename>" >&2
	echo "         filename       Name of file containing debugging output" >&2

	exit 1
fi

egrep '(MALLOC|FREE|REALLOC)' "${LEAKCHECKFILE}" | sed 's@^.*FREE(\(0x[0-9a-f]*\)).*$@free \1@;s@^.*MALLOC() = @malloc @;s@^.*REALLOC(\(0x[0-9a-f]*\)) = @realloc \1 @' > "${TMPFILE}"

cat "${TMPFILE}" | while read op addr newaddr; do
	case "${op}" in
		malloc)
			if [ -z "${alloclist}" ]; then
				alloclist="${addr}"
			else













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/bash

LEAKCHECKFILE="$1"
TMPFILE="${TMPDIR:-/tmp}/malloc-free-check-$$${RANDOM}${RANDOM}${RANDOM}.tmp"
export LEAKCHECKFILE TMPFILE

if [ -z "${LEAKCHECKFILE}" ]; then
	echo "Usage: leakcheck <filename>" >&2
	echo "         filename       Name of file containing debugging output" >&2

	exit 1
fi

egrep '(MALLOC|FREE|REALLOC)' "${LEAKCHECKFILE}" | sed 's@^.*FREE(\([x0-9a-fA-F]*\)).*$@free \1@;s@^.*MALLOC() = @malloc @;s@^.*REALLOC(\([x0-9a-fA-F]*\)) = @realloc \1 @' > "${TMPFILE}"

cat "${TMPFILE}" | while read op addr newaddr; do
	case "${op}" in
		malloc)
			if [ -z "${alloclist}" ]; then
				alloclist="${addr}"
			else