Install
openclaw skills install struct-offset-analyzerStatically analyze C struct member offsets through code reading to calculate memory layouts
openclaw skills install struct-offset-analyzerStatically analyze the memory offsets of C language struct members without needing to run code.
# Search for struct definition
grep -n "struct xxx_st {" **/*.h
grep -n "typedef struct" **/*.h
Find definitions for all member types:
#define EVP_MAX_MD_SIZE 64)| Type | Size (64-bit) | Alignment Requirement |
|---|---|---|
| char/unsigned char | 1 | 1 |
| short | 2 | 2 |
| int/uint32_t | 4 | 4 |
| long/size_t/pointer | 8 | 8 |
| unsigned char[N] | N | 1 (no padding needed) |
| enum | usually 4 | 4 |
| struct | depends on members | aligned to largest member |
Key Rules:
unsigned char arrays are 1-byte aligned, no padding requiredUse hexadecimal representation for offsets, format:
| Offset(0x) | Member | Type | Size |
|------------|--------|------|------|
| 0x00 | field1 | int | 4 |
| 0x04 | *(padding)* | - | 4 |
| 0x08 | field2 | void * | 8 |
# Find struct member definition
grep -n "struct xxx_st" **/*.h
# Find type definition
grep -n "typedef.*XXX" **/*.h
# Find constant definition
grep -n "#define.*SIZE" **/*.h
# Find enum definition
grep -n "typedef enum" **/*.h
Analyzing client_app_traffic_secret member offset:
ssl/ssl_local.h:1068EVP_MAX_MD_SIZE = 64 (include/openssl/evp.h:19)unsigned char arrays need no padding