This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [ob/pushed] dwarf2read.c: fix latent buglet
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Mon, 3 Aug 2015 11:06:18 -0700
- Subject: Re: [ob/pushed] dwarf2read.c: fix latent buglet
- Authentication-results: sourceware.org; auth=none
- References: <1438624857-18851-1-git-send-email-palves at redhat dot com>
On Mon, Aug 3, 2015 at 11:00 AM, Pedro Alves <palves@redhat.com> wrote:
> cust->includes is:
>
> struct compunit_symtab
> {
> ...
> struct compunit_symtab **includes;
>
> gdb/ChangeLog:
> 2015-08-03 Pedro Alves <palves@redhat.com>
>
> * dwarf2read.c (compute_compunit_symtab_includes): Use size of struct
> compunit_symtab pointer.
> ---
> gdb/dwarf2read.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index 24a4022..b5ffd04 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -7983,7 +7983,7 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
> len = VEC_length (compunit_symtab_ptr, result_symtabs);
> cust->includes
> = obstack_alloc (&dwarf2_per_objfile->objfile->objfile_obstack,
> - (len + 1) * sizeof (struct symtab *));
> + (len + 1) * sizeof (struct compunit_symtab *));
> for (ix = 0;
> VEC_iterate (compunit_symtab_ptr, result_symtabs, ix,
> compunit_symtab_iter);
Bleah.
Since sizeof (struct symtab) < sizeof (struct compunit_symtab) (64 vs
112 for amd64)
I'd suggest this for the 7.10 branch too.