From 879b42b043806a88c3f61e33ed4b9468b7b156e7 Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 21 Oct 2018 20:01:22 +0000 Subject: check VLIW case If maximum_operations_per_instruction != 1, it is VLIW. But there seems no need to support such architecture now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- addr2line.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/addr2line.c b/addr2line.c index 0e052f238a..e5155d93bd 100644 --- a/addr2line.c +++ b/addr2line.c @@ -337,6 +337,7 @@ parse_debug_line_header(const char **pp, struct LineNumberProgramHeader *header) 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 **traces, char **debug_line, } 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(); } } -- cgit v1.2.3