This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: add DWARF-4 features


On Tue, 13 Apr 2010 22:28:16 +0200, Tom Tromey wrote:
> +    case DW_FORM_sec_offset:
> +      DW_ADDR (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
> +      info_ptr += bytes_read;
> +      break;

should be DW_UNSND, already used such in your:

> +	case DW_FORM_sec_offset:
> +	  fprintf_unfiltered (f, "section offset: %s",
> +			      pulongest (DW_UNSND (&die->attrs[i])));
> +	  break;

and the only consumer of this value in FSF GDB code is:
dwarf2_symbol_mark_computed
      baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr);
      baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr);


> @@ -8041,12 +8070,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
>  	    {		
>  	      /* Special operand.  */
>  	      adj_opcode = op_code - lh->opcode_base;
> -	      address += (adj_opcode / lh->line_range)
> -		* lh->minimum_instruction_length;
> +	      address += ((op_index + (adj_opcode / lh->line_range)
> +			   / lh->maximum_ops_per_instruction)
> +			  * lh->minimum_instruction_length);

While I understand the VLIW support is not there implemented anyway still here
the association is wrong; the division (/) and multiplication (*) should apply
even to OP_INDEX.

The indentation is inappropriate for the expression (the indentation falsely
suggests the calculation is right).


> @@ -8195,11 +8238,19 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
>  	       instruction length since special opcode 255 would have
>  	       scaled the the increment.  */
>  	    case DW_LNS_const_add_pc:
> -	      address += (lh->minimum_instruction_length
> -			  * ((255 - lh->opcode_base) / lh->line_range));
> +	      {
> +		CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range;
> +
> +		address += (lh->minimum_instruction_length
> +			    * ((op_index + adjust)
> +			       / lh->maximum_ops_per_instruction));

I would prefer unified form of the expressions as an aid to the reader.  Here
is MINIMUM_INSTRUCTION_LENGTH preceding the rest of the expression while it is
succeeding the rest of the expression in the patch chunk above.


> +	case DW_FORM_exprloc:
> +	  fprintf_unfiltered (f, "expression: size %d",
> +			      DW_BLOCK (&die->attrs[i])->size);
> +	  break;

It should be %u.


Thanks,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]