ruby-changes:53075
From: naruse <ko1@a...>
Date: Mon, 22 Oct 2018 05:01:27 +0900 (JST)
Subject: [ruby-changes:53075] naruse:r65289 (trunk): check VLIW case
naruse 2018-10-22 05:01:22 +0900 (Mon, 22 Oct 2018) New Revision: 65289 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65289 Log: check VLIW case If maximum_operations_per_instruction != 1, it is VLIW. But there seems no need to support such architecture now. Modified files: trunk/addr2line.c Index: addr2line.c =================================================================== --- addr2line.c (revision 65288) +++ addr2line.c (revision 65289) @@ -337,6 +337,7 @@ parse_debug_line_header(const char **pp, https://github.com/ruby/ruby/blob/trunk/addr2line.c#L337 if (header->version >= 4) { /* maximum_operations_per_instruction = *(uint8_t *)p; */ + if (*p != 1) return -1; /* For non-VLIW architectures, this field is 1 */ p++; } @@ -478,13 +479,11 @@ parse_debug_line_cu(int num_traces, void https://github.com/ruby/ruby/blob/trunk/addr2line.c#L479 } break; default: { - unsigned long addr_incr; - unsigned long line_incr; - a = op - header.opcode_base; - addr_incr = (a / header.line_range) * header.minimum_instruction_length; - line_incr = header.line_base + (a % header.line_range); - addr += (unsigned int)addr_incr; - line += (unsigned int)line_incr; + uint8_t adjusted_opcode = op - header.opcode_base; + uint8_t operation_advance = adjusted_opcode / header.line_range; + /* NOTE: this code doesn't support VLIW */ + addr += operation_advance * header.minimum_instruction_length; + line += header.line_base + (adjusted_opcode % header.line_range); FILL_LINE(); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/