This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PR9735 objdump -S with stabs
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Wed, 14 Jan 2009 10:18:41 +1030
- Subject: PR9735 objdump -S with stabs
Applied. I started looking at uses of bfd_find_nearest_line in /src,
and found sim/m32c/trace.c keeps a previously returned filename too,
just like objdump.
PR 9735
* syms.c (_bfd_stab_section_find_nearest_line): Don't free
saved filename, use bfd_alloc rather than bfd_malloc for it.
Index: bfd/syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.49
diff -u -p -r1.49 syms.c
--- bfd/syms.c 23 Dec 2008 09:01:45 -0000 1.49
+++ bfd/syms.c 13 Jan 2009 23:32:05 -0000
@@ -1,6 +1,6 @@
/* Generic symbol-table support for the BFD library.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -1376,10 +1376,11 @@ _bfd_stab_section_find_nearest_line (bfd
{
size_t len;
- if (info->filename != NULL)
- free (info->filename);
+ /* Don't free info->filename here. objdump and other
+ apps keep a copy of a previously returned file name
+ pointer. */
len = strlen (file_name) + 1;
- info->filename = bfd_malloc (dirlen + len);
+ info->filename = bfd_alloc (abfd, dirlen + len);
if (info->filename == NULL)
return FALSE;
memcpy (info->filename, directory_name, dirlen);
--
Alan Modra
Australia Development Lab, IBM