diff mbox

[V2,09/23] vla: changed string length semantic.

Message ID 20140718151945.GA11512@host2.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil July 18, 2014, 3:19 p.m. UTC
Hi Keven,

the regression discussed in
	Re: [V2 00/23] Fortran dynamic array support
	https://sourceware.org/ml/gdb-patches/2014-07/msg00278.html

is IMO here:

On Fri, 11 Jul 2014 11:21:21 +0200, Keven Boell wrote:
> @@ -14590,8 +14680,26 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
>  	  baton = obstack_alloc (obstack, sizeof (*baton));
>  	  baton->referenced_type = die_type (target_die, target_cu);
>  	  baton->locexpr.per_cu = cu->per_cu;
> -	  baton->locexpr.size = DW_BLOCK (target_attr)->size;
> -	  baton->locexpr.data = DW_BLOCK (target_attr)->data;
> +
> +	  if (additional_data != NULL && additional_data_size > 0)
> +	    {
> +	      gdb_byte *data;
> +
> +	      data = obstack_alloc (&cu->objfile->objfile_obstack,
> +	              DW_BLOCK (attr)->size + additional_data_size);
> +	      memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
> +	      memcpy (data + DW_BLOCK (attr)->size,
> +	              additional_data, additional_data_size);
> +
> +	      baton->locexpr.data = data;
> +	      baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
> +	    }
> +	  else
> +	    {
> +	      baton->locexpr.data = DW_BLOCK (attr)->data;
> +	      baton->locexpr.size = DW_BLOCK (attr)->size;
> +	    }
> +
>  	  prop->data.baton = baton;
>  	  prop->kind = PROP_LOCEXPR;
>  	  gdb_assert (prop->data.baton != NULL);

it was correctly using 'target_attr' but now it uses 'attr' instead.

The gdb.ada/ regression gets fixed for me by the attached patch.


Jan

Comments

Keven Boell July 21, 2014, 8:24 a.m. UTC | #1
On 18.07.2014 17:19, Jan Kratochvil wrote:
> Hi Keven,
> 
> the regression discussed in
> 	Re: [V2 00/23] Fortran dynamic array support
> 	https://sourceware.org/ml/gdb-patches/2014-07/msg00278.html
> 
> is IMO here:
> 
> On Fri, 11 Jul 2014 11:21:21 +0200, Keven Boell wrote:
>> @@ -14590,8 +14680,26 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
>>  	  baton = obstack_alloc (obstack, sizeof (*baton));
>>  	  baton->referenced_type = die_type (target_die, target_cu);
>>  	  baton->locexpr.per_cu = cu->per_cu;
>> -	  baton->locexpr.size = DW_BLOCK (target_attr)->size;
>> -	  baton->locexpr.data = DW_BLOCK (target_attr)->data;
>> +
>> +	  if (additional_data != NULL && additional_data_size > 0)
>> +	    {
>> +	      gdb_byte *data;
>> +
>> +	      data = obstack_alloc (&cu->objfile->objfile_obstack,
>> +	              DW_BLOCK (attr)->size + additional_data_size);
>> +	      memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
>> +	      memcpy (data + DW_BLOCK (attr)->size,
>> +	              additional_data, additional_data_size);
>> +
>> +	      baton->locexpr.data = data;
>> +	      baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
>> +	    }
>> +	  else
>> +	    {
>> +	      baton->locexpr.data = DW_BLOCK (attr)->data;
>> +	      baton->locexpr.size = DW_BLOCK (attr)->size;
>> +	    }
>> +
>>  	  prop->data.baton = baton;
>>  	  prop->kind = PROP_LOCEXPR;
>>  	  gdb_assert (prop->data.baton != NULL);
> 
> it was correctly using 'target_attr' but now it uses 'attr' instead.
> 
> The gdb.ada/ regression gets fixed for me by the attached patch.
> 

Thanks for your investigation. Seems like I did a copy and paste error here, you are
right, target_attr is the right variable to use in this case.
I pushed the updated series to Github: https://github.com/intel-gdb/vla/tree/vla-fortran

> 
> Jan
> 

Thanks,
Keven
Jan Kratochvil July 21, 2014, 7:15 p.m. UTC | #2
On Mon, 21 Jul 2014 10:24:49 +0200, Keven Boell wrote:
> I pushed the updated series to Github: https://github.com/intel-gdb/vla/tree/vla-fortran

Could you rebase it on top of current gdb/master?  There are some non-trivial
conflicts with gdbtypes.c.


Thanks,
Jan
Keven Boell July 22, 2014, 1:10 p.m. UTC | #3
On 21.07.2014 21:15, Jan Kratochvil wrote:
> On Mon, 21 Jul 2014 10:24:49 +0200, Keven Boell wrote:
>> I pushed the updated series to Github: https://github.com/intel-gdb/vla/tree/vla-fortran
> 
> Could you rebase it on top of current gdb/master?  There are some non-trivial
> conflicts with gdbtypes.c.

Sure, you can find the rebased patch series now on
https://github.com/intel-gdb/vla/tree/vla-fortran

Keven
diff mbox

Patch

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e4f5240..f3e3f56 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -14684,18 +14684,20 @@  attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
 	      gdb_byte *data;
 
 	      data = obstack_alloc (&cu->objfile->objfile_obstack,
-	              DW_BLOCK (attr)->size + additional_data_size);
-	      memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
-	      memcpy (data + DW_BLOCK (attr)->size,
+		      DW_BLOCK (target_attr)->size + additional_data_size);
+	      memcpy (data, DW_BLOCK (target_attr)->data,
+		      DW_BLOCK (target_attr)->size);
+	      memcpy (data + DW_BLOCK (target_attr)->size,
 	              additional_data, additional_data_size);
 
 	      baton->locexpr.data = data;
-	      baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
+	      baton->locexpr.size = (DW_BLOCK (target_attr)->size
+				     + additional_data_size);
 	    }
 	  else
 	    {
-	      baton->locexpr.data = DW_BLOCK (attr)->data;
-	      baton->locexpr.size = DW_BLOCK (attr)->size;
+	      baton->locexpr.data = DW_BLOCK (target_attr)->data;
+	      baton->locexpr.size = DW_BLOCK (target_attr)->size;
 	    }
 
 	  prop->data.baton = baton;