-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Add missing operations to GetOpcodeDataSize #120163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesThe improved error reporting in #120162 revealed that we were missing opcodes in GetOpcodeDataSize. rdar://139705570 Full diff: https://github.com/llvm/llvm-project/pull/120163.diff 1 Files Affected:
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index a7126b25c1cc38..34d508f97ae012 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -269,6 +269,7 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data,
// All opcodes that have a single ULEB (signed or unsigned) argument
case DW_OP_addrx: // 0xa1 1 ULEB128 index
+ case DW_OP_constx: // 0xa2 1 ULEB128 index
case DW_OP_constu: // 0x10 1 ULEB128 constant
case DW_OP_consts: // 0x11 1 SLEB128 constant
case DW_OP_plus_uconst: // 0x23 1 ULEB128 addend
@@ -307,6 +308,8 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data,
case DW_OP_regx: // 0x90 1 ULEB128 register
case DW_OP_fbreg: // 0x91 1 SLEB128 offset
case DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed
+ case DW_OP_convert: // 0xa8 1 ULEB128 offset
+ case DW_OP_reinterpret: // 0xa9 1 ULEB128 offset
case DW_OP_GNU_addr_index: // 0xfb 1 ULEB128 index
case DW_OP_GNU_const_index: // 0xfc 1 ULEB128 index
data.Skip_LEB128(&offset);
|
@@ -269,6 +269,7 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data, | |||
|
|||
// All opcodes that have a single ULEB (signed or unsigned) argument | |||
case DW_OP_addrx: // 0xa1 1 ULEB128 index | |||
case DW_OP_constx: // 0xa2 1 ULEB128 index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be value in keeping the list sorted by their numeric value.
@@ -307,6 +308,8 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data, | |||
case DW_OP_regx: // 0x90 1 ULEB128 register | |||
case DW_OP_fbreg: // 0x91 1 SLEB128 offset | |||
case DW_OP_piece: // 0x93 1 ULEB128 size of piece addressed | |||
case DW_OP_convert: // 0xa8 1 ULEB128 offset | |||
case DW_OP_reinterpret: // 0xa9 1 ULEB128 offset | |||
case DW_OP_GNU_addr_index: // 0xfb 1 ULEB128 index | |||
case DW_OP_GNU_const_index: // 0xfc 1 ULEB128 index | |||
data.Skip_LEB128(&offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we list all values explicitly and get rid of the default so we get a warning about missing entries in the future?
The improved error reporting in llvm#120162 revealed that we were missing opcodes in GetOpcodeDataSize. I changed the function to remove the default case and switch over the enum type which will cause the compiler to emit a warning if there are unhandled operations in the future. rdar://139705570
5aca34d
to
21c9bbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found one bug, otherwise this looks good!
case DW_OP_implicit_pointer: // 0xa0 4 + LEB128 | ||
{ | ||
data.Skip_LEB128(&offset); | ||
return 4 + offset - data_offset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first operand is a 4-byte unsigned value in the 32-bit DWARF format, or an 8-byte unsigned value in the 64-bit DWARF format
The improved error reporting in llvm#120162 revealed that we were missing opcodes in GetOpcodeDataSize. I changed the function to remove the default case and switch over the enum type which will cause the compiler to emit a warning if there are unhandled operations in the future. rdar://139705570 (cherry picked from commit 4cf1fe2)
…4cf1fe240589 [🍒 swift/release/6.1] [lldb] Add missing operations to GetOpcodeDataSize (llvm#120163)
The improved error reporting in #120162 revealed that we were missing
opcodes in GetOpcodeDataSize. I changed the function to remove the
default case and switch over the enum type which will cause the compiler
to emit a warning if there are unhandled operations in the future.
rdar://139705570