Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFC: add DWARF-4 features
Date: Mon, 19 Apr 2010 18:08:00 -0000	[thread overview]
Message-ID: <20100419180809.GA4722@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <m38w8rayhr.fsf@fleche.redhat.com>

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


  parent reply	other threads:[~2010-04-19 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 20:28 Tom Tromey
2010-04-19 14:45 ` Joel Brobecker
2010-04-19 18:08 ` Jan Kratochvil [this message]
2010-04-20 17:33   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100419180809.GA4722@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox