From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Jun 17 06:20:16 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A34C16A474 for ; Sat, 17 Jun 2006 06:20:16 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 93B0E43D45 for ; Sat, 17 Jun 2006 06:20:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k5H6KEl2061182 for ; Sat, 17 Jun 2006 06:20:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k5H6KEY0061181; Sat, 17 Jun 2006 06:20:14 GMT (envelope-from gnats) Resent-Date: Sat, 17 Jun 2006 06:20:14 GMT Resent-Message-Id: <200606170620.k5H6KEY0061181@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Matt Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB05E16A47A for ; Sat, 17 Jun 2006 06:18:27 +0000 (UTC) (envelope-from mday@mithril.fjarlq.com) Received: from mithril.fjarlq.com (ip-64-139-9-163.dsl.sca.megapath.net [64.139.9.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6DF8A43D48 for ; Sat, 17 Jun 2006 06:18:27 +0000 (GMT) (envelope-from mday@mithril.fjarlq.com) Received: by mithril.fjarlq.com (Postfix, from userid 1000) id E889DF20036; Fri, 16 Jun 2006 23:18:26 -0700 (PDT) Message-Id: <20060617061826.E889DF20036@mithril.fjarlq.com> Date: Fri, 16 Jun 2006 23:18:26 -0700 (PDT) From: Matt To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: biere@jku.at Subject: ports/99070: ccmalloc: no backtraces on amd64 when compiled with -O X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matt List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jun 2006 06:20:16 -0000 >Number: 99070 >Category: ports >Synopsis: ccmalloc: no backtraces on amd64 when compiled with -O >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jun 17 06:20:14 GMT 2006 >Closed-Date: >Last-Modified: >Originator: >Release: FreeBSD 6.1-RELEASE >Organization: >Environment: Platform: amd64 % gcc -v Using built-in specs. Configured with: FreeBSD/amd64 system compiler Thread model: posix gcc version 3.4.4 [FreeBSD] 20050518 >Description: When compiled with the -O optimization flag on the amd64 platform, devel/ccmalloc version 0.4.0 does not generate backtraces in its memory leak reports. The reports are created, but the helpful backtraces are missing. On i386 I could not reproduce this problem, ccmalloc on that platform works fine when compiled with -O. >How-To-Repeat: 1) Add the -O option to CFLAGS in /etc/make.conf. The exact line I had was: CFLAGS= -O -pipe I've built everything on my system, including hundreds of packages, with this setting without any problem until now. 2) Build and install devel/ccmalloc from ports. 3) Build a test program using ccmalloc: % cat > testmalloc.c char *addr; leak() { addr = malloc(4096); } call() { leak(); } main() { call(); } ^D % ccmalloc cc -g testmalloc.c -o testmalloc 4) Run the testmalloc program you built; a report with a valid summary will be generated, but the backtrace of the malloc caller will be missing: % testmalloc file-name=a.out does not contain valid symbols trying to find executable in current directory ... (to speed up this search specify `file testmalloc' in the startup file `.ccmalloc (but not found)') .--------------------------------------------------------------------------. |================ ccmalloc-0.4.0 (C) 1997-2003 Armin Biere ================| +--------------------------------------------------------------------------+ | executable = testmalloc | | startup file = .ccmalloc (but not found) | | log file = stderr | | start time = Fri Jun 16 23:03:22 2006 | | operating system = FreeBSD 6.1-RELEASE amd64 on example.com | +--------------------------------------------------------------------------+ | only-count = 0 keep-deallocated-data = 0 | | check-interval = 0 check-free-space = 0 | | check-start = 0 file-info = 1 | | chain-length = 0 additional-line = 1 | | check-underwrites = 0 print-addresses = 0 | | check-overwrites = 0 print-on-one-line = 0 | | sort-by-wasted = 1 sort-by-size = 1 | | # only-log-chain = 0 continue = 0 | | # dont-log-chain = 0 statistics = 0 | | debug = 0 library-chains = 0 | | load-dynlibs = 0 align-8-byte = 0 | | only-wasting-alloc= 1 | `--------------------------------------------------------------------------' .---------------. |ccmalloc report| ======================================================= | total # of| allocated | deallocated | garbage | +-----------+-------------+-------------+-------------+ | bytes| 4096 | 0 | 4096 | +-----------+-------------+-------------+-------------+ |allocations| 1 | 0 | 1 | +-----------------------------------------------------+ | number of checks: 1 | | number of counts: 1 | | retrieving function names for addresses ... done. | | reading file info from gdb ... done. | | sorting by number of not reclaimed bytes ... done. | | number of call chains: 0 | | number of ignored call chains: 0 | | number of reported call chains: 0 | | number of internal call chains: 0 | | number of library call chains: 1 | `------------------------------------------------------ >Fix: I added this to my /etc/make.conf to override CFLAGS for devel/ccmalloc: .if ${.CURDIR:M*/devel/ccmalloc} CFLAGS= -pipe .endif Reinstall devel/ccmalloc, rebuild your test program, and it should generate a backtrace in the report now: % testmalloc file-name=a.out does not contain valid symbols trying to find executable in current directory ... (to speed up this search specify `file testmalloc' in the startup file `.ccmalloc (but not found)') .--------------------------------------------------------------------------. |================ ccmalloc-0.4.0 (C) 1997-2003 Armin Biere ================| +--------------------------------------------------------------------------+ | executable = testmalloc | | startup file = .ccmalloc (but not found) | | log file = stderr | | start time = Fri Jun 16 23:09:17 2006 | | operating system = FreeBSD 6.1-RELEASE amd64 on example.com | +--------------------------------------------------------------------------+ | only-count = 0 keep-deallocated-data = 0 | | check-interval = 0 check-free-space = 0 | | check-start = 0 file-info = 1 | | chain-length = 0 additional-line = 1 | | check-underwrites = 0 print-addresses = 0 | | check-overwrites = 0 print-on-one-line = 0 | | sort-by-wasted = 1 sort-by-size = 1 | | # only-log-chain = 0 continue = 0 | | # dont-log-chain = 0 statistics = 0 | | debug = 0 library-chains = 0 | | load-dynlibs = 0 align-8-byte = 0 | | only-wasting-alloc= 1 | `--------------------------------------------------------------------------' .---------------. |ccmalloc report| ======================================================= | total # of| allocated | deallocated | garbage | +-----------+-------------+-------------+-------------+ | bytes| 4096 | 0 | 4096 | +-----------+-------------+-------------+-------------+ |allocations| 1 | 0 | 1 | +-----------------------------------------------------+ | number of checks: 1 | | number of counts: 1 | | retrieving function names for addresses ... done. | | reading file info from gdb ... done. | | sorting by number of not reclaimed bytes ... done. | | number of call chains: 1 | | number of ignored call chains: 0 | | number of reported call chains: 1 | | number of internal call chains: 1 | | number of library call chains: 0 | ======================================================= | *100.0% = 4096 Bytes of garbage allocated in 1 allocation | | | | 0x0040162e in
| | at testmalloc.c:4 | | | | 0x0040161e in | | at testmalloc.c:3 | | | | 0x004015fe in | | at testmalloc.c:2 | | | `-----> 0x0040193e in | `------------------------------------------------------ >Release-Note: >Audit-Trail: >Unformatted: