aboutsummaryrefslogtreecommitdiffstats
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 20:01:22 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-21 20:01:22 +0000
commit879b42b043806a88c3f61e33ed4b9468b7b156e7 (patch)
tree3cd6bfb54a66b56c8c383e6bb8983a4b7cb1b60d /addr2line.c
parent281d45ab0a03aa4b90a0f3b992a305c278cb008d (diff)
downloadruby-879b42b043806a88c3f61e33ed4b9468b7b156e7.tar.gz
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
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c13
1 files 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();
}
}