From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18249 invoked by alias); 14 Apr 2013 14:16:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18238 invoked by uid 89); 14 Apr 2013 14:16:27 -0000 X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_XS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 14 Apr 2013 14:16:26 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3EEGNNE031336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 14 Apr 2013 10:16:24 -0400 Received: from host2.jankratochvil.net (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3EEGJxx032236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 14 Apr 2013 10:16:22 -0400 Date: Mon, 15 Apr 2013 13:52:00 -0000 From: Jan Kratochvil To: Aleksandar Ristovski Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 5/8] Move linux_find_memory_regions_full & co. Message-ID: <20130414141619.GC23227@host2.jankratochvil.net> References: <1365521265-28870-1-git-send-email-ARistovski@qnx.com> <1365521265-28870-6-git-send-email-ARistovski@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1365521265-28870-6-git-send-email-ARistovski@qnx.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-04/txt/msg00414.txt.bz2 On Tue, 09 Apr 2013 17:27:42 +0200, Aleksandar Ristovski wrote: > > Most notable change: read_alloc and read_stralloc are moved to new > common-target.[ch] files. This is not a move, it removes - and therefore regresses - this change: commit d8c11845465f076c6ae8078d2e8fb7c1d31f1181 Fix compatibility with Linux kernel 3.8.3. commit 01a16f9b83c29db2c63106bbefeb505cbac17bd4 Fix variable name shadowing. When you git merge gdb/master you got a conflict on linux-tdep.c. Therefore you have to apply the non-applicable trunk change of linux-tdep.c to the new file common/linux-maps.c instead. You apparently had to drop the linux-tdep.c conflict without updating common/linux-maps.c. Regards, Jan This is the regression this patch introduced: --- m 2013-04-12 21:26:21.953472657 +0200 +++ p 2013-04-14 08:00:04.284665296 +0200 @@ -56,21 +56,20 @@ typedef int linux_find_memory_region_fty been processed or return the value from FUNC if FUNC returns non-zero. */ -static int +int linux_find_memory_regions_full (pid_t pid, linux_find_memory_region_ftype *func, void *func_data, void **memory_to_free_ptr) { - char mapsfilename[100]; + char filename[100]; char *data; - xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/smaps", (int) pid); - data = target_fileio_read_stralloc (mapsfilename); + xsnprintf (filename, sizeof filename, "/proc/%d/smaps", (int) pid); + data = linux_find_memory_read_stralloc (filename); if (data == NULL) { /* Older Linux kernels did not support /proc/PID/smaps. */ - xsnprintf (mapsfilename, sizeof mapsfilename, "/proc/%d/maps", - (int) pid); - data = target_fileio_read_stralloc (mapsfilename); + xsnprintf (filename, sizeof filename, "/proc/%d/maps", (int) pid); + data = linux_find_memory_read_stralloc (filename); } if (data) { @@ -106,30 +105,20 @@ linux_find_memory_regions_full (pid_t pi line = strtok (NULL, "\n")) { char keyword[64 + 1]; + unsigned long number; - if (sscanf (line, "%64s", keyword) != 1) + if (sscanf (line, "%64s%lu kB\n", keyword, &number) != 2) { - warning (_("Error parsing {s,}maps file '%s'"), mapsfilename); + warning (_("Error parsing {s,}maps file '%s'"), filename); break; } if (strcmp (keyword, "Anonymous:") == 0) has_anonymous = 1; - if (strcmp (keyword, "Shared_Dirty:") == 0 - || strcmp (keyword, "Private_Dirty:") == 0 - || strcmp (keyword, "Swap:") == 0 - || strcmp (keyword, "Anonymous:") == 0) - { - unsigned long number; - - if (sscanf (line, "%*s%lu", &number) != 1) - { - warning (_("Error parsing {s,}maps file '%s' number"), - mapsfilename); - break; - } - if (number != 0) - modified = 1; - } + if (number != 0 && (strcmp (keyword, "Shared_Dirty:") == 0 + || strcmp (keyword, "Private_Dirty:") == 0 + || strcmp (keyword, "Swap:") == 0 + || strcmp (keyword, "Anonymous:") == 0)) + modified = 1; } /* Older Linux kernels did not support the "Anonymous:" counter.