-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Operating System
Windows
What's the issue you encountered?
While trying to debug a pattern(running into eval_depth limit), two errors happened that shouldn't be there. The first one was "Bitfield's fields exceeded the attribute-allotted size."(see snippet 1), and the second "No variable named 'size' found"(see snippet 2).
While researching the snippet 2 issue, I noticed that the name of the pattern placed in not the one given ("leb128" rather than "string"). It seems than the name change is caused be the use of the "ref" keyword in the format function of uLEB128 somehow causing the name of the local variable to be used instead(see snippet 3).
Snippet 1:
import std.core;
import std.sys;
#pragma example 01
using BitfieldOrder = std::core::BitfieldOrder;
enum Type: u8{
String = 0,
uint32 = 1,
sint32 = 2,
unavailable = 127
};
bitfield IdType{
unsigned id: 3;
Type type: 5;
} [[bitfield_order(BitfieldOrder::MostToLeastSignificant, 8)]];
IdType idType @ 0x0;Snippet 2:
import std.core;
import std.sys;
import type.leb128;
#pragma example 0C 48 65 6C 6C 6F 20 57 6F 72 6C 64 21
struct String{
type::uLEB128 size;
char data[size];
};
String string @ 0x0;Snippet 3:
import type.leb128;
fn tfm_zigzag_decode(ref auto zigzag_decode){
return s128(zigzag_decode >> 1) ^ (-s128(zigzag_decode & 1));
};
fn tfm_zigzag_encode(ref auto zigzag){
return (u128(zigzag) << 1) ^ (u128(zigzag) >> (sizeof(zigzag) * 8 - 1));
};
using Zigzag = type::uLEB128 [[format("tfm_zigzag_decode"), transform_read("tfm_zigzag_decode"), transform_write("tfm_zigzag_encode")]];
Zigzag pattern_name @ 0x0;How can the issue be reproduced?
Use the Snippet 1 or 2, put a breakpoint at "Type type: 5;" for snippet 1 or "char data[size];" for snippet 2 and try stepping over them. Enjoy the error.
ImHex Version
Nightly: master@b56c3c5
ImHex Build Type
- Nightly or built from sources
Installation type
Portable
Additional context?
No response