* Re: RFA: dwarf2read.c patch
2003-05-05 22:09 RFA: dwarf2read.c patch J. Johnston
@ 2003-05-06 0:12 ` Daniel Jacobowitz
2003-05-07 21:44 ` Jim Blandy
2003-05-07 21:58 ` Elena Zannoni
2 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2003-05-06 0:12 UTC (permalink / raw)
To: J. Johnston; +Cc: gdb-patches
On Mon, May 05, 2003 at 06:09:14PM -0400, J. Johnston wrote:
> The following patch fixes a problem on ia64. In dwarf2read.c,
> dwarf_decode_lines(), the function check_cu_functions() is called
> to check for a specific scenario caused by gcc.
>
> The function takes an address and returns an address. In some
> cases, it will return the lowpc value of the function rather than
> the address that was input.
>
> On the ia64, this causes problems because the line table info spit
> out by the compiler is often specified with relative addresses.
> As well, ia64 addresses are special as they encode a slot number which goes
> 0, 1, 2, then skips to the next quadword boundary. For example,
>
> 0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x20, 0x21, 0x22, ...
>
> Addresses such as 0x0e or 0x0f are invalid and cause an error to
> occur if, say, a breakpoint was attempted to be inserted there.
>
> Now, in dwarf_decode_lines(), if we update the address counter when we call
> check_cu_functions(), adding relative offsets in subsequent entries often
> results in
> invalid addresses.
>
> This patch makes it so the check_cu_functions() call is only used to
> alter the address passed to record_line(); the calculated address is left
> untouched
> so subsequent relative operations result in valid results.
>
> Tested on ia64 and x86.
>
> Ok to commit?
I can't approve this, but I can say that that's certainly what I meant
to do with the check_cu_functions. I feel really dumb for not noticing
that I was corrupting the line state machine.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: dwarf2read.c patch
2003-05-05 22:09 RFA: dwarf2read.c patch J. Johnston
2003-05-06 0:12 ` Daniel Jacobowitz
@ 2003-05-07 21:44 ` Jim Blandy
2003-05-07 22:57 ` J. Johnston
2003-05-07 21:58 ` Elena Zannoni
2 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2003-05-07 21:44 UTC (permalink / raw)
To: J. Johnston; +Cc: gdb-patches
Looks good to me --- please commit this.
"J. Johnston" <jjohnstn@redhat.com> writes:
> The following patch fixes a problem on ia64. In dwarf2read.c,
> dwarf_decode_lines(), the function check_cu_functions() is called
> to check for a specific scenario caused by gcc.
>
> The function takes an address and returns an address. In some
> cases, it will return the lowpc value of the function rather than
> the address that was input.
>
> On the ia64, this causes problems because the line table info spit
> out by the compiler is often specified with relative addresses.
> As well, ia64 addresses are special as they encode a slot number which goes
> 0, 1, 2, then skips to the next quadword boundary. For example,
>
> 0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x20, 0x21, 0x22, ...
>
> Addresses such as 0x0e or 0x0f are invalid and cause an error to
> occur if, say, a breakpoint was attempted to be inserted there.
>
> Now, in dwarf_decode_lines(), if we update the address counter when we call
> check_cu_functions(), adding relative offsets in subsequent entries often results in
> invalid addresses.
>
> This patch makes it so the check_cu_functions() call is only used to
> alter the address passed to record_line(); the calculated address is left untouched
> so subsequent relative operations result in valid results.
>
> Tested on ia64 and x86.
>
> Ok to commit?
>
> -- Jeff J.
>
> 2003-05-05 Jeff Johnston <jjohnstn@redhat.com>
>
> * dwarf2read.c (dwarf_decode_lines): Only use output of check_cu_functions()
> when calling record_line(). Do not update the current address.
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.90
> diff -u -p -r1.90 dwarf2read.c
> --- dwarf2read.c 15 Apr 2003 23:07:11 -0000 1.90
> +++ dwarf2read.c 5 May 2003 21:55:26 -0000
> @@ -4878,8 +4878,8 @@ dwarf_decode_lines (struct line_header *
> * lh->minimum_instruction_length;
> line += lh->line_base + (adj_opcode % lh->line_range);
> /* append row to matrix using current values */
> - address = check_cu_functions (address);
> - record_line (current_subfile, line, address);
> + record_line (current_subfile, line,
> + check_cu_functions (address));
> basic_block = 1;
> }
> else switch (op_code)
> @@ -4925,8 +4925,8 @@ dwarf_decode_lines (struct line_header *
> }
> break;
> case DW_LNS_copy:
> - address = check_cu_functions (address);
> - record_line (current_subfile, line, address);
> + record_line (current_subfile, line,
> + check_cu_functions (address));
> basic_block = 0;
> break;
> case DW_LNS_advance_pc:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: dwarf2read.c patch
2003-05-07 21:44 ` Jim Blandy
@ 2003-05-07 22:57 ` J. Johnston
0 siblings, 0 replies; 5+ messages in thread
From: J. Johnston @ 2003-05-07 22:57 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
Patch checked in. Thanks.
-- Jeff J.
Jim Blandy wrote:
> Looks good to me --- please commit this.
>
> "J. Johnston" <jjohnstn@redhat.com> writes:
>
>
>>The following patch fixes a problem on ia64. In dwarf2read.c,
>>dwarf_decode_lines(), the function check_cu_functions() is called
>>to check for a specific scenario caused by gcc.
>>
>>The function takes an address and returns an address. In some
>>cases, it will return the lowpc value of the function rather than
>>the address that was input.
>>
>>On the ia64, this causes problems because the line table info spit
>>out by the compiler is often specified with relative addresses.
>>As well, ia64 addresses are special as they encode a slot number which goes
>>0, 1, 2, then skips to the next quadword boundary. For example,
>>
>>0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x20, 0x21, 0x22, ...
>>
>>Addresses such as 0x0e or 0x0f are invalid and cause an error to
>>occur if, say, a breakpoint was attempted to be inserted there.
>>
>>Now, in dwarf_decode_lines(), if we update the address counter when we call
>>check_cu_functions(), adding relative offsets in subsequent entries often results in
>>invalid addresses.
>>
>>This patch makes it so the check_cu_functions() call is only used to
>>alter the address passed to record_line(); the calculated address is left untouched
>>so subsequent relative operations result in valid results.
>>
>>Tested on ia64 and x86.
>>
>>Ok to commit?
>>
>>-- Jeff J.
>>
>>2003-05-05 Jeff Johnston <jjohnstn@redhat.com>
>>
>> * dwarf2read.c (dwarf_decode_lines): Only use output of check_cu_functions()
>> when calling record_line(). Do not update the current address.
>>Index: dwarf2read.c
>>===================================================================
>>RCS file: /cvs/src/src/gdb/dwarf2read.c,v
>>retrieving revision 1.90
>>diff -u -p -r1.90 dwarf2read.c
>>--- dwarf2read.c 15 Apr 2003 23:07:11 -0000 1.90
>>+++ dwarf2read.c 5 May 2003 21:55:26 -0000
>>@@ -4878,8 +4878,8 @@ dwarf_decode_lines (struct line_header *
>> * lh->minimum_instruction_length;
>> line += lh->line_base + (adj_opcode % lh->line_range);
>> /* append row to matrix using current values */
>>- address = check_cu_functions (address);
>>- record_line (current_subfile, line, address);
>>+ record_line (current_subfile, line,
>>+ check_cu_functions (address));
>> basic_block = 1;
>> }
>> else switch (op_code)
>>@@ -4925,8 +4925,8 @@ dwarf_decode_lines (struct line_header *
>> }
>> break;
>> case DW_LNS_copy:
>>- address = check_cu_functions (address);
>>- record_line (current_subfile, line, address);
>>+ record_line (current_subfile, line,
>>+ check_cu_functions (address));
>> basic_block = 0;
>> break;
>> case DW_LNS_advance_pc:
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: dwarf2read.c patch
2003-05-05 22:09 RFA: dwarf2read.c patch J. Johnston
2003-05-06 0:12 ` Daniel Jacobowitz
2003-05-07 21:44 ` Jim Blandy
@ 2003-05-07 21:58 ` Elena Zannoni
2 siblings, 0 replies; 5+ messages in thread
From: Elena Zannoni @ 2003-05-07 21:58 UTC (permalink / raw)
To: J. Johnston; +Cc: gdb-patches
J. Johnston writes:
> The following patch fixes a problem on ia64. In dwarf2read.c,
> dwarf_decode_lines(), the function check_cu_functions() is called
> to check for a specific scenario caused by gcc.
>
> The function takes an address and returns an address. In some
> cases, it will return the lowpc value of the function rather than
> the address that was input.
>
> On the ia64, this causes problems because the line table info spit
> out by the compiler is often specified with relative addresses.
> As well, ia64 addresses are special as they encode a slot number which goes
> 0, 1, 2, then skips to the next quadword boundary. For example,
>
> 0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x20, 0x21, 0x22, ...
>
> Addresses such as 0x0e or 0x0f are invalid and cause an error to
> occur if, say, a breakpoint was attempted to be inserted there.
>
> Now, in dwarf_decode_lines(), if we update the address counter when we call
> check_cu_functions(), adding relative offsets in subsequent entries often results in
> invalid addresses.
>
> This patch makes it so the check_cu_functions() call is only used to
> alter the address passed to record_line(); the calculated address is left untouched
> so subsequent relative operations result in valid results.
>
> Tested on ia64 and x86.
>
> Ok to commit?
>
> -- Jeff J.
>
> 2003-05-05 Jeff Johnston <jjohnstn@redhat.com>
>
> * dwarf2read.c (dwarf_decode_lines): Only use output of check_cu_functions()
> when calling record_line(). Do not update the current address.
yes, ok.
elena
> Index: dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.90
> diff -u -p -r1.90 dwarf2read.c
> --- dwarf2read.c 15 Apr 2003 23:07:11 -0000 1.90
> +++ dwarf2read.c 5 May 2003 21:55:26 -0000
> @@ -4878,8 +4878,8 @@ dwarf_decode_lines (struct line_header *
> * lh->minimum_instruction_length;
> line += lh->line_base + (adj_opcode % lh->line_range);
> /* append row to matrix using current values */
> - address = check_cu_functions (address);
> - record_line (current_subfile, line, address);
> + record_line (current_subfile, line,
> + check_cu_functions (address));
> basic_block = 1;
> }
> else switch (op_code)
> @@ -4925,8 +4925,8 @@ dwarf_decode_lines (struct line_header *
> }
> break;
> case DW_LNS_copy:
> - address = check_cu_functions (address);
> - record_line (current_subfile, line, address);
> + record_line (current_subfile, line,
> + check_cu_functions (address));
> basic_block = 0;
> break;
> case DW_LNS_advance_pc:
^ permalink raw reply [flat|nested] 5+ messages in thread