From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15409 invoked by alias); 21 Mar 2005 00:55:58 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15181 invoked from network); 21 Mar 2005 00:55:46 -0000 Received: from unknown (HELO av.mvista.com) (12.44.186.158) by sourceware.org with SMTP; 21 Mar 2005 00:55:46 -0000 Received: from Nora (av [127.0.0.1]) by av.mvista.com (8.9.3/8.9.3) with ESMTP id QAA17587 for ; Sun, 20 Mar 2005 16:55:45 -0800 From: "Nora Pan" To: Subject: Patch: Fix the segment missing in gcore maps parser. Date: Mon, 21 Mar 2005 00:55:00 -0000 Message-ID: <000201c52db0$b6ef5780$810a000a@Nora> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00264.txt.bz2 A bug in gdb /proc//maps parser causes gcore can't capture the segments following the one with a file name and zero inode entry in the maps file. For example: 30028000-3002f000 rw-s 00000000 00:05 0 /SYSV0000bdad (deleted) Okay for mainline? -- Nora Pan MontaVista Software 2005-03-18 Nora Pan * linux-nat.c (read_mapping): Capturing the segments after the one with file name and zero inode. diff -urNp src/gdb.orig/linux-nat.c src/gdb/linux-nat.c --- src/gdb.orig/linux-nat.c 2005-03-06 08:42:20.000000000 -0800 +++ src/gdb/linux-nat.c 2005-03-18 17:48:05.000000000 -0800 @@ -2453,7 +2453,8 @@ read_mapping (FILE *mapfile, int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx", addr, endaddr, permissions, offset, device, inode); - if (ret > 0 && ret != EOF && *inode != 0) + filename[0] = '\0'; + if (ret > 0 && ret != EOF) { /* Eat everything up to EOL for the filename. This will prevent weird filenames (such as one with embedded whitespace) from @@ -2464,11 +2465,7 @@ read_mapping (FILE *mapfile, only. */ ret += fscanf (mapfile, "%[^\n]\n", filename); } - else - { - filename[0] = '\0'; /* no filename */ - fscanf (mapfile, "\n"); - } + return (ret != 0 && ret != EOF); }