Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2008 23:25:15 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 152067 for review
Message-ID:  <200810272325.m9RNPFLk089687@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810272325.m9RNPFLk089687>