[patch] Use mmap instead of obstack_alloc for dwarf debug sections.

Paul Pluzhnikov ppluzhnikov@google.com
Thu Jun 18 14:06:00 GMT 2009


On Thu, Jun 18, 2009 at 2:19 AM, Ken Werner <ken@linux.vnet.ibm.com> wrote:

> I noticed gdb/dwarf2-frame.c:1922 (and :1950) calls dwarf2_get_section_info
> with unsigned long* (5th argument). The function expects a bfd_size_type *
> (a pointer to an unsigned long long on my machine). Thus the compiler issues
> a warning and the gdb build fails because of -Werror. Is it sufficient to
> just cast to (bfd_size_type *) or am I missing something?

I think the cast would be wrong, as dwarf2_get_section_info would really
write 'unsigned long long' and corrupt your stack.

I've checked in the patch below under the obvious rule.
--
Paul Pluzhnikov

2009-06-18  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* dwarf2-frame.c (struct comp_unit): Use bfd_size_type for
	dwarf_frame_size.


Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.88
diff -u -p -u -r1.88 dwarf2-frame.c
--- dwarf2-frame.c	16 Jun 2009 21:06:40 -0000	1.88
+++ dwarf2-frame.c	18 Jun 2009 13:57:58 -0000
@@ -130,7 +130,7 @@ struct comp_unit
   gdb_byte *dwarf_frame_buffer;

   /* Length of the loaded .debug_frame section.  */
-  unsigned long dwarf_frame_size;
+  bfd_size_type dwarf_frame_size;

   /* Pointer to the .debug_frame section.  */
   asection *dwarf_frame_section;



More information about the Gdb-patches mailing list