From owner-p4-projects@FreeBSD.ORG Mon Oct 27 23:25:15 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7415F1065699; Mon, 27 Oct 2008 23:25:15 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37520106567C for ; Mon, 27 Oct 2008 23:25:15 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2532F8FC08 for ; Mon, 27 Oct 2008 23:25:15 +0000 (UTC) (envelope-from peter-gmail@wemm.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9RNPFqb089689 for ; Mon, 27 Oct 2008 23:25:15 GMT (envelope-from peter-gmail@wemm.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9RNPFLk089687 for perforce@freebsd.org; Mon, 27 Oct 2008 23:25:15 GMT (envelope-from peter-gmail@wemm.org) Date: Mon, 27 Oct 2008 23:25:15 GMT Message-Id: <200810272325.m9RNPFLk089687@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter-gmail@wemm.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 152067 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2008 23:25:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=152067 Change 152067 by peter@peter_overcee on 2008/10/27 23:25:11 Sigh. That serves me right for trying to be too smart. gcc tries to execute this nested function on the stack and valgrind has done funky things with signal handlers at this point that causes recursion. Affected files ... .. //depot/projects/valgrind/coregrind/m_aspacemgr/aspacemgr-freebsd.c#7 edit Differences ... ==== //depot/projects/valgrind/coregrind/m_aspacemgr/aspacemgr-freebsd.c#7 (text+ko) ==== @@ -352,24 +352,33 @@ /* Given a memory address, attempt to deduce its filename. To do this, we use /proc/curproc/map. If this fails, return false. */ +static Addr search_addr; +static HChar *search_buf; +static Int search_nbuf; + +/* Callback function for parsing map */ +static void get_name_for_addr_callback(Addr addr, SizeT len, UInt prot, + ULong dev, ULong ino, ULong offset, + const UChar* filename ) +{ + if (search_buf[0] == '/') + return; + if (search_addr < addr) + return; + if (search_addr > (addr + len - 1)) + return; + VG_(strncpy)( search_buf, filename, search_nbuf - 1); +} + static -Bool get_name_for_addr ( Addr search_addr, HChar* buf, Int nbuf ) +Bool get_name_for_addr ( Addr addr, HChar* buf, Int nbuf ) { Int i; - /* Callback function for parsing map */ - void get_name_for_addr_callback(Addr addr, SizeT len, UInt prot, - ULong dev, ULong ino, ULong offset, - const UChar* filename ) - { - if (search_addr < addr) - return; - if (search_addr > (addr + len - 1)) - return; - VG_(strncpy)( buf, filename, nbuf - 1); - } - for (i = 0; i < nbuf; i++) buf[i] = 0; + search_addr = addr; + search_buf = buf; + search_nbuf = nbuf; parse_procselfmaps( get_name_for_addr_callback, 0); if (buf[0] == '/') return True;