Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch 1/2+7.6] /proc/PID/smaps: filename fix
Date: Sun, 31 Mar 2013 17:43:00 -0000	[thread overview]
Message-ID: <20130329195301.GA3502@host2.jankratochvil.net> (raw)

Hi,

currently GDB complains:
	warning: Error parsing {s,}maps file '[heap]'
	warning: Error parsing {s,}maps file '/usr/lib64/libc-2.17.so'

which is sure incorrect, it should have been:
	warning: Error parsing {s,}maps file '/proc/30100/smaps'
	warning: Error parsing {s,}maps file '/proc/30100/smaps'

(That the error happens at all is off-topic for this mail.)

While it is 'obvious' GDB CVS inaccessible to me now so neither regression
tested nor checked in yet.


Thanks,
Jan


gdb/
2013-03-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix variable name shadowing.
	* linux-tdep.c (linux_find_memory_regions_full): Rename outer variable
	filename to mapsfilename and update its uses.

diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index a132fc6..cc63e9b 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -675,22 +675,22 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
 				linux_find_memory_region_ftype *func,
 				void *obfd)
 {
-  char filename[100];
+  char mapsfilename[100];
   gdb_byte *data;
 
   /* We need to know the real target PID to access /proc.  */
   if (current_inferior ()->fake_pid_p)
     return 1;
 
-  xsnprintf (filename, sizeof filename,
+  xsnprintf (mapsfilename, sizeof mapsfilename,
 	     "/proc/%d/smaps", current_inferior ()->pid);
-  data = target_fileio_read_stralloc (filename);
+  data = target_fileio_read_stralloc (mapsfilename);
   if (data == NULL)
     {
       /* Older Linux kernels did not support /proc/PID/smaps.  */
-      xsnprintf (filename, sizeof filename,
+      xsnprintf (mapsfilename, sizeof mapsfilename,
 		 "/proc/%d/maps", current_inferior ()->pid);
-      data = target_fileio_read_stralloc (filename);
+      data = target_fileio_read_stralloc (mapsfilename);
     }
   if (data)
     {
@@ -724,7 +724,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
 
 	      if (sscanf (line, "%64s%lu kB\n", keyword, &number) != 2)
 		{
-		  warning (_("Error parsing {s,}maps file '%s'"), filename);
+		  warning (_("Error parsing {s,}maps file '%s'"), mapsfilename);
 		  break;
 		}
 	      if (strcmp (keyword, "Anonymous:") == 0)


             reply	other threads:[~2013-03-29 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-31 17:43 Jan Kratochvil [this message]
2013-03-31 17:43 ` Andreas Schwab
     [not found]   ` <20130329202737.GA6075@host2.jankratochvil.net>
2013-04-05 19:51     ` Pedro Alves
2013-04-05 20:20       ` [commit+7.6] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130329195301.GA3502@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox