7 #define MICROSOFT_NAME_LEN (256)
8 #define MICROSOFR_CLASS_NAMESPACE_LEN (256)
9 #define IMPOSSIBLE_LEN (MICROSOFT_NAME_LEN + MICROSOFR_CLASS_NAMESPACE_LEN)
107 #define DECL_STATE_ACTION(action) static void tc_state_##action(SStateInfo *state, STypeCodeStr *type_code_str);
136 #undef DECL_STATE_ACTION
138 #define NAME(action) tc_state_##action
197 #define copy_string(type_code_str, str_for_copy) copy_string_n(type_code_str, str_for_copy, str_for_copy ? strlen(str_for_copy) : 0)
205 if (free_space < copy_len) {
207 if (newlen < type_code_str->type_str_len) {
211 if (newlen < type_code_str->type_str_len) {
219 type_str =
malloc(newlen);
240 type_code_str->
curr_pos += copy_len;
250 const char template_param[] =
"template-parameter-";
252 const char *
const start_sym = sym;
253 if (!strncmp(sym,
"?", 1)) {
255 state.amount_of_read_chars += 1;
256 state.buff_for_parsing += 1;
264 if (strncmp(sym,
"$", 1)) {
268 state.amount_of_read_chars += 2;
269 state.buff_for_parsing += 2;
276 int signed_a = atoi(
a);
284 if (!*(++sym) || !(*sym ==
'?')) {
312 *amount_of_read_chars = sym - start_sym;
321 int signed_b = atoi(
b);
341 int signed_a = atoi(
a);
342 int signed_b = atoi(
b);
354 int signed_a = atoi(
a);
355 int signed_b = atoi(
b);
356 int signed_c = atoi(
c);
357 res =
dem_str_newf(
"{%d, %d, %d}", signed_a, signed_b, signed_c);
411 *str_type_code = res;
412 *amount_of_read_chars =
state.amount_of_read_chars;
419 return (((
ut16)
s[0]) << 8) | (((
ut16)
s[1]) << 0);
423 char *
const outstart = utf8;
424 char *
const outend = utf8 + utf8_len;
429 const size_t inlen = utf16be_len / 2;
430 const ut16 *
const inend =
in + inlen;
431 while ((
in < inend) && (utf8 - outstart + 5 < utf8_len)) {
433 if ((
c & 0xFC00) == 0xD800) {
438 if ((
d & 0xFC00) == 0xDC00) {
449 if (utf8 >= outend) {
455 }
else if (
c < 0x800) {
456 *utf8++ = ((
c >> 6) & 0x1F) | 0xC0;
458 }
else if (
c < 0x10000) {
459 *utf8++ = ((
c >> 12) & 0x0F) | 0xE0;
462 *utf8++ = ((
c >> 18) & 0x07) | 0xF0;
467 if (utf8 >= outend) {
470 *utf8++ = ((
c >>
bits) & 0x3F) | 0x80;
473 return utf8 - outstart;
477 const size_t utf8_len_tmp = utf16be_len * 4;
478 *utf8 =
malloc(utf8_len_tmp);
493 #define SET_OPERATOR_CODE(str) \
495 str_info = malloc(sizeof(SStrInfo)); \
498 str_info->len = strlen(str); \
499 str_info->str_ptr = strdup(str); \
500 dem_list_append(names_l, str_info); \
580 is_double_byte =
false;
581 }
else if (*
buf ==
'1') {
582 is_double_byte =
true;
588 const char *
const str_buf_start =
buf;
598 char *checksum =
get_num(&state_info);
613 if (is_double_byte) {
622 const char *encoded =
",/\\:. \v\n'-";
623 while (*
buf && *
buf !=
'@') {
628 if (
buf[0] <
'A' ||
buf[0] >
'P' ||
629 buf[1] <
'A' ||
buf[1] >
'P') {
634 const char nibble_high = (*
buf++ -
'A');
635 const char nibble_low = (*
buf -
'A');
636 c[high] = nibble_high | nibble_low;
638 c[high] = encoded[*
buf -
'0'];
639 }
else if ((*
buf >
'a' && *
buf <
'p') || (*
buf >
'A' && *
buf <
'P')) {
640 c[high] = *
buf + 0x80;
650 if (is_double_byte) {
653 if (!
c[0] && !
c[1]) {
673 if (is_double_byte) {
674 size_t utf16_len = unicode->
len;
676 char *utf8_buf =
NULL;
692 if (*
buf ==
'@' &&
buf[1]) {
695 char *unk =
get_num(&state_info);
708 read_len +=
buf - str_buf_start;
748 if (!
a || !
b || !
c || !
d) {
755 read_len +=
state.amount_of_read_chars;
787 const char *
op =
"dynamic initializer";
792 op =
"dynamic atexit destructor";
799 read_len += name_len + 1;
805 name[name_len] =
'\0';
830 #undef SET_OPERATOR_CODE
839 char *str_type_code =
NULL;
844 memset(str_info, 0,
sizeof(*str_info));
846 goto get_template_err;
852 goto get_template_err;
856 goto get_template_err;
864 char *
tmp = strchr(
buf,
'@');
866 goto get_template_err;
882 while (*
buf !=
'@') {
886 goto get_template_err;
901 goto get_template_err;
915 if (memorize && str_info->
str_ptr) {
937 size_t len = 0, read_len = 0, tmp_len = 0;
952 curr_pos = strchr(
buf,
'@');
956 len = curr_pos - prev_pos;
958 goto get_namespace_and_name_err;
961 while (curr_pos !=
NULL) {
962 len = curr_pos - prev_pos;
965 if ((
len == 0) && (*(curr_pos) ==
'@')) {
972 goto get_namespace_and_name_err;
976 if ((*
tmp ==
'?') && (*(
tmp + 1) ==
'$')) {
985 goto get_namespace_and_name_err;
989 prev_pos =
tmp +
i + 2;
990 curr_pos = strchr(prev_pos,
'@');
995 if ((*
tmp ==
'?') && (*(
tmp + 1) ==
'Q')) {
1002 if (!
i || *(
tmp +
i + 2) !=
'@') {
1006 prev_pos =
tmp +
i + 3;
1007 curr_pos = strchr(prev_pos,
'@');
1025 bool nested_name =
false;
1035 read_len +=
state.amount_of_read_chars;
1036 if (*
tmp ==
'?' &&
tmp[1] ==
'?') {
1046 char *demangled =
NULL;
1057 if (
num && demangled) {
1059 }
else if (demangled) {
1079 curr_pos = strchr(
tmp,
'@');
1083 bool abbreviation =
false;
1085 abbreviation =
true;
1106 str_info->
len = strlen(
tmp);
1114 if (*(prev_pos + 1) ==
'@') {
1115 prev_pos = curr_pos;
1120 prev_pos = curr_pos + 1;
1121 curr_pos = strchr(curr_pos + 1,
'@');
1128 get_namespace_and_name_err:
1130 if (amount_of_names) {
1131 *amount_of_names = tmp_len;
1146 #define SINGLEQUOTED_A 'A'
1147 #define SINGLEQUOTED_B 'B'
1148 #define SINGLEQUOTED_C 'C'
1149 #define SINGLEQUOTED_D 'D'
1150 #define SINGLEQUOTED_E 'E'
1151 #define SINGLEQUOTED_F 'F'
1152 #define SINGLEQUOTED_G 'G'
1153 #define SINGLEQUOTED_H 'H'
1154 #define SINGLEQUOTED_I 'I'
1155 #define SINGLEQUOTED_J 'J'
1156 #define SINGLEQUOTED_K 'K'
1157 #define SINGLEQUOTED_L 'L'
1158 #define SINGLEQUOTED_M 'M'
1159 #define SINGLEQUOTED_N 'N'
1160 #define SINGLEQUOTED_O 'O'
1161 #define SINGLEQUOTED_P 'P'
1162 #define SINGLEQUOTED_Q 'Q'
1163 #define SINGLEQUOTED_R 'R'
1164 #define SINGLEQUOTED_S 'S'
1165 #define SINGLEQUOTED_T 'T'
1166 #define SINGLEQUOTED_U 'U'
1167 #define SINGLEQUOTED_V 'V'
1168 #define SINGLEQUOTED_W 'W'
1169 #define SINGLEQUOTED_X 'X'
1170 #define SINGLEQUOTED_Y 'Y'
1171 #define SINGLEQUOTED_Z 'Z'
1172 #define SINGLEQUOTED__ '_'
1173 #define SINGLEQUOTED_$ '$'
1174 #define CHAR_WITH_QUOTES(letter) (SINGLEQUOTED_##letter)
1176 #define DEF_STATE_ACTION(action) static void tc_state_##action(SStateInfo *state, STypeCodeStr *type_code_str)
1177 #define GO_TO_NEXT_STATE(state, new_state) \
1179 (state)->amount_of_read_chars++; \
1180 (state)->buff_for_parsing++; \
1181 (state)->state = eTCStateEnd; \
1183 #define ONE_LETTER_ACTION(action, type) \
1184 static void tc_state_##action(SStateInfo *state, STypeCodeStr *type_code_str) { \
1185 if (copy_string(type_code_str, type) == 0) { \
1186 state->err = eTCStateMachineErrAlloc; \
1188 state->state = eTCStateEnd; \
1207 #define PROCESS_CASE(letter, type_str) \
1208 case CHAR_WITH_QUOTES(letter): \
1209 copy_string(type_code_str, type_str); \
1212 switch (*(
state->buff_for_parsing)) {
1235 state->amount_of_read_chars++;
1236 state->buff_for_parsing++;
1245 #define GET_USER_DEF_TYPE_NAME(data_struct_str) \
1247 copy_string(type_code_str, data_struct_str); \
1249 check_len = get_namespace_and_name(state->buff_for_parsing, type_code_str, NULL, true); \
1251 state->amount_of_read_chars += check_len; \
1252 state->buff_for_parsing += check_len; \
1253 if (*state->buff_for_parsing) { \
1254 state->buff_for_parsing++; \
1255 state->amount_of_read_chars++; \
1258 state->err = eTCStateMachineErrUncorrectTypeCode; \
1263 #define PROCESS_CASE(case_string, type_str) \
1265 check_len = strlen(case_string); \
1266 if (strncmp(state->buff_for_parsing, case_string, check_len) == 0) { \
1267 copy_string(type_code_str, type_str); \
1268 state->buff_for_parsing += check_len; \
1269 state->amount_of_read_chars += check_len; \
1274 size_t check_len = 0;
1291 #define PROCESS_CASE(case_string, type_str) \
1293 check_len = strlen(case_string); \
1294 if (strncmp(state->buff_for_parsing, case_string, check_len) == 0) { \
1295 copy_string(type_code_str, type_str); \
1296 state->amount_of_read_chars += check_len; \
1297 state->buff_for_parsing += check_len; \
1302 size_t check_len = 0;
1316 size_t check_len = 0;
1319 if (*
state->buff_for_parsing !=
'4') {
1324 state->buff_for_parsing++;
1325 state->amount_of_read_chars++;
1332 size_t check_len = 0;
1338 #undef GET_USER_DEF_TYPE_NAME
1342 bool negative =
false;
1343 if (*
state->buff_for_parsing ==
'?') {
1345 state->buff_for_parsing++;
1346 state->amount_of_read_chars++;
1348 if (*
state->buff_for_parsing ==
'@') {
1349 state->buff_for_parsing++;
1350 state->amount_of_read_chars++;
1353 if (*
state->buff_for_parsing >=
'0' && *
state->buff_for_parsing <=
'8') {
1358 ptr[0] = *
state->buff_for_parsing + 1;
1360 state->buff_for_parsing++;
1361 state->amount_of_read_chars++;
1362 }
else if (*
state->buff_for_parsing ==
'9') {
1364 state->buff_for_parsing++;
1365 state->amount_of_read_chars++;
1366 }
else if (*
state->buff_for_parsing >=
'A' && *
state->buff_for_parsing <=
'P') {
1369 if (
state->buff_for_parsing[1] ==
'0' &&
state->buff_for_parsing[2] ==
'x' &&
isxdigit(
state->buff_for_parsing[3])) {
1371 state->buff_for_parsing += 3;
1372 state->amount_of_read_chars += 3;
1374 state->buff_for_parsing++;
1375 state->amount_of_read_chars++;
1378 ret = strtoul(
state->buff_for_parsing - chars,
NULL, 16);
1380 while (*
state->buff_for_parsing >=
'A' && *
state->buff_for_parsing <=
'P') {
1382 ret += *
state->buff_for_parsing -
'A';
1383 state->buff_for_parsing++;
1384 state->amount_of_read_chars++;
1389 if (*
state->buff_for_parsing && *
state->buff_for_parsing ==
'@') {
1390 state->buff_for_parsing++;
1391 state->amount_of_read_chars++;
1394 if (negative && ptr) {
1408 bool is_pin_ptr =
false;
1409 char clr_type =
'\0';
1437 state->buff_for_parsing +=
i;
1438 state->amount_of_read_chars +=
i;
1440 if (*
state->buff_for_parsing ==
'$') {
1441 state->buff_for_parsing++;
1442 switch (*
state->buff_for_parsing++) {
1459 state->amount_of_read_chars += 2;
1464 state->buff_for_parsing +=
i;
1465 state->amount_of_read_chars +=
i;
1467 const char *storage_class_str;
1469 if (storage_class_str) {
1473 state->buff_for_parsing++;
1474 state->amount_of_read_chars++;
1481 if (*
state->buff_for_parsing ==
'Y') {
1485 state->buff_for_parsing++;
1486 state->amount_of_read_chars++;
1498 if (last_char !=
' ' && last_char !=
'(') {
1524 if (clr_type && *modifier_str !=
'\0') {
1526 const char *rest_of_mod_str = modifier_str + (*(modifier_str + 1) ==
'&' ? 2 : 1);
1529 if (is_pin_ptr && *modifier_str) {
1530 while (*++modifier_str ==
' ') {
1538 if (!strncmp(
state->buff_for_parsing,
"__Z", 3)) {
1540 state->buff_for_parsing += 3;
1541 state->amount_of_read_chars += 3;
1550 state->amount_of_read_chars +=
i;
1551 state->buff_for_parsing +=
i;
1578 switch (calling_convention) {
1579 case 'A':
return "__cdecl";
1580 case 'B':
return "__cdecl __declspec(dllexport)";
1581 case 'C':
return "__pascal";
1582 case 'D':
return "__pascal __declspec(dllexport)";
1583 case 'E':
return "__thiscall";
1584 case 'F':
return "__thiscall __declspec(dllexport)";
1585 case 'G':
return "__stdcall";
1586 case 'H':
return "__stdcall __declspec(dllexport)";
1587 case 'I':
return "__fastcall";
1588 case 'J':
return "__fastcall __declspec(dllexport)";
1589 case 'K':
return "default (none given)";
1590 case 'L':
return "default (none given) __declspec(dllexport)";
1591 case 'M':
return "__clrcall";
1592 case 'N':
return "__clrcall __declspec(dllexport)";
1593 case 'O':
return "__eabi";
1594 case 'P':
return "__eabi __declspec(dllexport)";
1595 case 'Q':
return "__vectorcall";
1596 case 'R':
return "__vectorcall __declspec(dllexport)";
1597 case 'S':
return "__swift_1";
1598 case 'T':
return "__swift_1 __declspec(dllexport)";
1599 case 'U':
return "__swift_2";
1600 case 'V':
return "__swift_2 __declspec(dllexport)";
1601 case 'W':
return "__swift_3";
1602 default:
return NULL;
1608 const char *curr_pos = sym;
1619 while (*curr_pos && *curr_pos !=
'Z') {
1620 if (*curr_pos !=
'@') {
1622 bool is_abbr_type =
false;
1629 if ((*curr_pos >=
'0') && (*curr_pos <=
'9')) {
1638 is_abbr_type =
true;
1653 if (
tmp && strncmp(
tmp,
"void", 4) == 0 && strlen(
tmp) == 4) {
1655 if (!is_abbr_type) {
1660 if (!is_abbr_type) {
1668 while (*curr_pos ==
'@') {
1672 if (*curr_pos !=
'Z') {
1678 if (demangled_args) {
1685 *read_chars = curr_pos - sym + 1;
1693 const char *call_conv =
NULL;
1694 const char *storage =
NULL;
1695 char *ret_type =
NULL;
1709 state->amount_of_read_chars += 2;
1712 if (*
state->buff_for_parsing ==
'?') {
1718 state->buff_for_parsing++;
1719 state->amount_of_read_chars += 2;
1740 state->amount_of_read_chars +=
i;
1741 state->buff_for_parsing +=
i;
1743 char *demangled_args =
NULL;
1745 free(demangled_args);
1749 state->amount_of_read_chars +=
i;
1750 state->buff_for_parsing +=
i;
1752 free(demangled_args);
1758 ut8 digit = *
state->buff_for_parsing++;
1759 if (digit ==
'6' || digit ==
'7') {
1762 }
else if (digit ==
'8' || digit ==
'9') {
1781 state->buff_for_parsing += ptr_mod_cnt;
1782 state->amount_of_read_chars += ptr_mod_cnt;
1783 const char *storage;
1790 state->amount_of_read_chars++;
1807 #define PARSE_POINTER(pointer_str) parse_pointer(state, type_code_str, pointer_str)
1830 if (*(
state->buff_for_parsing++) !=
'$') {
1834 state->amount_of_read_chars += 2;
1835 switch (*
state->buff_for_parsing++) {
1872 #undef ONE_LETTER_ACTION
1873 #undef GO_TO_NEXT_STATE
1874 #undef DEF_STATE_ACTION
1877 #define ONE_LETTER_STATE(letter) \
1878 case CHAR_WITH_QUOTES(letter): \
1879 state->state = eTCState##letter; \
1882 switch (*(
state->buff_for_parsing)) {
1917 state->amount_of_read_chars++;
1918 state->buff_for_parsing++;
1919 #undef ONE_LETTER_STATE
1928 state->buff_for_parsing = buff_for_parsing;
1929 state->amount_of_read_chars = 0;
1956 ret[type_code_str->
curr_pos] =
'\0';
1975 goto get_type_code_string_err;
1983 *str_type_code =
NULL;
1984 *amount_of_read_chars = 0;
1985 switch (
state.err) {
1994 goto get_type_code_string_err;
1999 *amount_of_read_chars =
state.amount_of_read_chars;
2001 get_type_code_string_err:
2007 const char *
tmp = encoded;
2008 if (!ptr_modifier->
left) {
2011 if (!ptr_modifier->
right) {
2014 #define SET_PTR_MODIFIER(letter, modifier_left, modifier_right) \
2016 ptr_modifier->left = dem_str_append(ptr_modifier->left, modifier_left); \
2017 ptr_modifier->right = dem_str_append(ptr_modifier->right, modifier_right); \
2021 bool refref =
false;
2043 return tmp - encoded - 1;
2046 return tmp - encoded;
2047 #undef SET_PTR_MODIFIER
2053 *storage_class =
NULL;
2057 *storage_class =
"const";
2062 *storage_class =
"volatile";
2067 *storage_class =
"const volatile";
2070 *storage_class =
NULL;
2079 const char *curr_pos = sym;
2081 const char *storage_class =
NULL;
2091 switch (*curr_pos) {
2099 switch (*curr_pos) {
2104 modifier.
left =
strdup(
"protected: static ");
2130 if (storage_class) {
2148 if (storage_class) {
2154 if (*curr_pos !=
'@') {
2165 if (*curr_pos && *(curr_pos + 1) !=
'@') {
2187 if (*curr_pos ==
'@') {
2199 *
len = curr_pos - sym;
2205 size_t *
len,
bool *is_static,
bool *is_implicit_this_pointer) {
2206 const char *curr_pos = sym;
2207 *is_static = *is_implicit_this_pointer =
false;
2208 #define SET_THUNK_MODIFIER(letter, modifier_str) \
2211 init_state_struct(&state, curr_pos); \
2212 char *num = get_num(&state); \
2214 return eDemanglerErrUncorrectMangledSymbol; \
2216 data_type->left = strdup(modifier_str); \
2217 data_type->right = dem_str_newf("`adjustor{%s}'", num); \
2219 *is_implicit_this_pointer = true; \
2220 curr_pos += state.amount_of_read_chars; \
2224 #define SET_ACCESS_MODIFIER(letter, flag_set, modifier_str) \
2226 data_type->left = strdup(modifier_str); \
2231 switch (*curr_pos++) {
2262 #undef SET_ACCESS_MODIFIER
2264 *
len = curr_pos - sym;
2266 if (!data_type->
left) {
2269 if (!data_type->
right) {
2277 bool is_implicit_this_pointer;
2279 const char *memb_func_access_code =
NULL;
2280 const char *call_conv =
NULL;
2281 char *demangled_args =
NULL;
2282 char *ret_type =
NULL;
2284 SDataType this_pointer_modifier = { 0 };
2285 const char *curr_pos = sym;
2286 bool __64ptr =
false;
2292 goto parse_function_err;
2295 if (!strncmp(curr_pos,
"$$F", 3)) {
2302 goto parse_function_err;
2307 if (*curr_pos ==
'E') {
2312 if (*curr_pos ==
'$') {
2320 goto print_function;
2324 if (is_implicit_this_pointer) {
2328 goto parse_function_err;
2345 goto parse_function_err;
2350 if (*curr_pos ==
'?') {
2353 goto parse_function_err;
2359 if (*curr_pos ==
'@') {
2360 ret_type =
strdup(
"void");
2366 goto parse_function_err;
2373 goto parse_function_err;
2382 if (!strstr(data_type.
left,
"static")) {
2410 if (memb_func_access_code) {
2423 if (strstr(func_str.
type_str,
"#{return_type}")) {
2426 func_str.
curr_pos -= strlen(
"#{return_type}") - strlen(ret_type);
2437 *chars_read = curr_pos - sym;
2443 free(demangled_args);
2457 const char *curr_pos = sym;
2461 goto parse_microsoft_mangled_name_err;
2467 goto parse_microsoft_mangled_name_err;
2474 goto parse_microsoft_mangled_name_err;
2479 if (!strncmp(curr_pos,
"$$F", 3)) {
2484 if (curr_pos[0] ==
'_') {
2494 goto parse_microsoft_mangled_name_err;
2497 *demangled_name =
NULL;
2498 if (data_type.
left) {
2504 }
else if (
isalpha(*curr_pos)) {
2511 parse_microsoft_mangled_name_err:
2514 *chars_read = curr_pos - sym;
2522 const char *storage =
NULL;
2544 *chars_read =
len + 1;
2560 if (!demangler || !demangled_name) {
2562 goto microsoft_demangle_err;
2565 if (!strncmp(demangler->
symbol,
".?", 2)) {
2571 microsoft_demangle_err:
int bits(struct state *s, int need)
const lzma_allocator const uint8_t * in
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
EDemanglerErr
Enum of possible errors while demangler working.
@ eDemanglerErrUncorrectMangledSymbol
uncorrect mangled symbol
@ eDemanglerErrUnsupportedMangling
unsupported mangling scheme yet
@ eDemanglerErrOK
if all is OK
@ eDemanglerErrMemoryAllocation
some memory allocation problem
@ eDemanglerErrInternal
when something very wrong happens
void dem_list_free(DemList *list)
char * dem_str_ndup(const char *ptr, int len)
DemListIter * dem_list_append(DemList *list, void *data)
char * dem_string_drain(DemString *ds)
char * dem_str_replace(char *str, const char *key, const char *val, int g)
ut32 dem_list_length(const DemList *list)
void * dem_list_get_n(const DemList *list, ut32 n)
void dem_string_free(DemString *ds)
DemString * dem_string_new()
char * dem_str_newf(const char *fmt,...)
char * dem_str_append(char *ptr, const char *string)
bool dem_string_append(DemString *ds, const char *string)
bool dem_string_appendf(DemString *ds, const char *fmt,...)
bool dem_string_append_n(DemString *ds, const char *string, size_t size)
DemList * dem_list_newf(DemListFree f)
#define dem_list_foreach_prev(list, it, pos)
void(* DemListFree)(void *ptr)
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API RZ_OWN char *MACH0_() get_name(struct MACH0_(obj_t) *mo, ut32 stridx, bool filter)
Get a string from the string table referenced by the LC_SYMTAB command.
static size_t get_operator_code(const char *buf, DemList *names_l, bool memorize)
static void sdatatype_fini(SDataType *data_type)
struct STypeCodeStr STypeCodeStr
static size_t get_namespace_and_name(const char *buf, STypeCodeStr *type_code_str, size_t *amount_of_names, bool memorize)
get_namespace_and_name
static EDemanglerErr parse_function(const char *sym, STypeCodeStr *type_code_str, char **demangled_function, size_t *chars_read)
@ eTCStateMachineErrUnsupportedTypeCode
@ eTCStateMachineErrUncorrectTypeCode
@ eTCStateMachineErrAlloc
#define PARSE_POINTER(pointer_str)
static void tc_state_start(SStateInfo *state, STypeCodeStr *type_code_str)
static EDemanglerErr parse_function_args(const char *sym, char **demangled_args, size_t *read_chars)
struct SDataType SDataType
@ eObjectTypeStaticClassMember
static EDemanglerErr parse_microsoft_mangled_name(const char *sym, char **demangled_name, size_t *chars_read)
static bool copy_string_n(STypeCodeStr *type_code_str, const char *str_for_copy, size_t copy_len)
#define DECL_STATE_ACTION(action)
static void sstrinfo_free(SStrInfo *sstrinfo)
static void tc_state_end(SStateInfo *state, STypeCodeStr *type_code_str)
static void parse_type_modifier(SStateInfo *state, STypeCodeStr *type_code_str, const char *modifier_str)
#define SET_OPERATOR_CODE(str)
static DemList * abbr_types
static void parse_pointer(SStateInfo *state, STypeCodeStr *type_code_str, const char *pointer_str)
static void free_type_code_str_struct(STypeCodeStr *type_code_str)
static int get_template_params(const char *sym, size_t *amount_of_read_chars, char **str_type_code)
static char * type_code_str_get(STypeCodeStr *type_code_str)
static char * get_num(SStateInfo *state)
#define PROCESS_CASE(letter, type_str)
#define SET_ACCESS_MODIFIER(letter, flag_set, modifier_str)
#define SET_THUNK_MODIFIER(letter, modifier_str)
static EDemanglerErr get_type_code_string(const char *sym, size_t *amount_of_read_chars, char **str_type_code)
static EDemanglerErr utf16be_to_utf8(const char *utf16be, size_t utf16be_len, char **utf8, size_t *utf8_len)
#define DEF_STATE_ACTION(action)
#define copy_string(type_code_str, str_for_copy)
static EDemanglerErr parse_function_type(const char *sym, SDataType *data_type, size_t *len, bool *is_static, bool *is_implicit_this_pointer)
#define SET_PTR_MODIFIER(letter, modifier_left, modifier_right)
static state_func const state_table[eTCStateMax]
static bool init_type_code_str_struct(STypeCodeStr *type_code_str)
#define ONE_LETTER_STATE(letter)
EDemanglerErr microsoft_demangle(SDemangler *demangler, char **demangled_name)
Do demangle for microsoft mangling scheme. Demangled name need to be free by user.
static EDemanglerErr parse_microsoft_rtti_mangled_name(const char *sym, char **demangled_name, size_t *chars_read)
#define GET_USER_DEF_TYPE_NAME(data_struct_str)
static DemList * abbr_names
static const char * get_calling_convention(char calling_convention)
static void run_state(SStateInfo *state_info, STypeCodeStr *type_code_str)
#define ONE_LETTER_ACTION(action, type)
static size_t get_template(const char *buf, SStrInfo *str_info, bool memorize)
static ssize_t utf16be_to_utf8_impl(const char *utf16be, size_t utf16be_len, char *utf8, size_t utf8_len)
static EDemanglerErr parse_data_type(const char *sym, SDataType *demangled_type, size_t *len)
#define MICROSOFT_NAME_LEN
static size_t get_ptr_modifier(const char *encoded, SDataType *ptr_modifier)
static EDemanglerErr get_storage_class(const char encoded, const char **storage_class)
void(* state_func)(struct SStateInfo *, STypeCodeStr *type_code_str)
static void parse_function_pointer(SStateInfo *state, STypeCodeStr *type_code_str, const char *pointer_str)
static ut16 read_be16(const void *src)
static void init_state_struct(SStateInfo *state, const char *buff_for_parsing)
struct SStateInfo SStateInfo
#define RZ_STR_ISEMPTY(x)
char * symbol
symbol that need to be demangled
const char * buff_for_parsing
size_t amount_of_read_chars
char type_str_buf[MICROSOFT_NAME_LEN]
#define V(handle, symbol)
int read(izstream &zs, T *x, Items items)