This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: add DWARF-4 features
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 19 Apr 2010 20:08:09 +0200
- Subject: Re: RFC: add DWARF-4 features
- References: <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