This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Avoid shadowing in linux-tdep.c
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 5 Oct 2018 04:58:38 -0000
- Subject: [binutils-gdb] Avoid shadowing in linux-tdep.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3fba72f7612c071f07fc7e65887bd1e8e056e272
commit 3fba72f7612c071f07fc7e65887bd1e8e056e272
Author: Tom Tromey <tom@tromey.com>
Date: Sun Apr 22 10:46:51 2018 -0600
Avoid shadowing in linux-tdep.c
This is one of the uglier changes to avoid local shadowing. Because
obstack.h uses statement expressions, in some cases a nested obstack
call will result in shadowing. Rather than try to fix obstack.h, this
patch simply works around the one instance of this problem.
gdb/ChangeLog
2018-10-04 Tom Tromey <tom@tromey.com>
* linux-tdep.c (linux_make_mappings_corefile_notes): Introduce new
variable "size".
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/linux-tdep.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0b5f35b..c547ee9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2018-10-04 Tom Tromey <tom@tromey.com>
+ * linux-tdep.c (linux_make_mappings_corefile_notes): Introduce new
+ variable "size".
+
+2018-10-04 Tom Tromey <tom@tromey.com>
+
* mdebugread.c (parse_partial_symbols): Use std::string.
2018-10-04 Tom Tromey <tom@tromey.com>
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 8c76ec3..3521149 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1547,8 +1547,9 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
long_type, mapping_data.file_count);
/* Copy the filenames to the data obstack. */
+ int size = obstack_object_size (&filename_obstack);
obstack_grow (&data_obstack, obstack_base (&filename_obstack),
- obstack_object_size (&filename_obstack));
+ size);
note_data = elfcore_write_note (obfd, note_data, note_size,
"CORE", NT_FILE,