rizin/test/db/cmd/cmd_tcc
Anton Kochkov 3c59df7e98
Refactor RzTypes to use structs instead of SDB + New Tree-Sitter based C Parser (#1047)
- Removed oldshell version of `t` (types) commands
- Removed `tk` command because types storage switched to the hashtable
- Added `tfc` command to show the calling convention of the function or set it
- Added `tsl` (RZ_OUTPUT_MODE_LONG) to show structure members' sizes and offsets
- Added `tul` (RZ_OUTPUT_MODE_LONG) to show union members' sizes
- Switched the types storage to the hashtable instead of SDB
- Added load and export from/to SDB for standard type libraries and serialization for Projects
- Changed all `char *type` occurences to the proper `RzType`
- Added `RzCallable` type for the function/class method types
- Changed all function types API to use the `RzCallable` API
- Switched the function types (`RzCallable`) storage to the hashtable instead of SDB
- Added a connection between `RzAnalysisFunction` and `RzCallable` - `rz_analysis_function_derive_type()` API function to derive new `RzCallable` type from the `RzAnalysisFunction` even if it doesn't exist in the RzTypeDB.
- Moved type links to the RzAnalysis where they belong
- Removed TCC and MPC-based parsers
- Added Tree-Sitter-based parser for C grammar (see `librz/type/parser/*`)
- Reworked type databases in `librz/analysis/d/` to be consistent with C standard, libc, platform-specific definitions
- Switched the type links from `char *` to `RzType`
- Switched the type links from SDB to the hashtable
- Added concept of the "type paths", e.g. `a.b[20].c` where `b` is a member of `a` (`a` is either structure or a union) and `c` is a member of `b`, and `b` is an array where we take 20-th element.
- Added concept of the typeclasses (a bit similar to Haskell) for numerical types: `None` (the most generic one), `Num` (includes `Integral` and `Floating`), `Integral` (includes `Signed Integral` and `Unsigned Integral`), `Floating`.
- Added concept of type equality (`rz_types_equal(a, b)` API function)
- Added Doxygen documentation to every API function in the `librz/type/*`.
- Updated the project format from **V2** to **V3**, added migration.
2021-07-20 01:46:45 +08:00

95 lines
1.6 KiB
Text

NAME=tcc-star
FILE=bins/elf/ls
CMDS=<<EOF
tcc
tcc-*
tcc
EOF
EXPECT=<<EOF
amd64
amd64syscall
ms
reg
swift
EOF
RUN
NAME=tcc
FILE=bins/elf/ls
CMDS=tcc
EXPECT=<<EOF
amd64
amd64syscall
ms
reg
swift
EOF
RUN
NAME=tccj, tccl, tcc* outputs
FILE=bins/elf/ls
CMDS=<<EOF
tccj
tccl
tcc*
EOF
EXPECT=<<EOF
["rax amd64 (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4);","rax amd64syscall (rdi, rsi, rdx, r10, r8, r9);","rax ms (rcx, rdx, r8, r9, stack);","rdi reg (rdi, rsi, rdx, rcx);","rax r13.swift (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4) r12;"]
rax amd64 (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4);
rax amd64syscall (rdi, rsi, rdx, r10, r8, r9);
rax ms (rcx, rdx, r8, r9, stack);
rdi reg (rdi, rsi, rdx, rcx);
rax r13.swift (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4) r12;
tcc "rax amd64 (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4);"
tcc "rax amd64syscall (rdi, rsi, rdx, r10, r8, r9);"
tcc "rax ms (rcx, rdx, r8, r9, stack);"
tcc "rdi reg (rdi, rsi, rdx, rcx);"
tcc "rax r13.swift (rdi, rsi, rdx, rcx, r8, r9, xmm0, xmm1, xmm2, xmm3, xmm4) r12;"
EOF
RUN
NAME=tcc
FILE==
CMDS=<<EOF
e asm.arch=x86
e asm.bits=32
?e 1
tcc "eax jeje(ebx, ecx)"
tcc jeje
tcc- jeje
?e 2
tcc "eax jeje(ebx, ecx)"
tcc jeje
tcc- jeje
?e 3
tcc "eax jeje (ebx, ecx)"
tcc jeje
tcc- jeje
?e 4
tcc "eax jeje (ebx, ecx)"
tcc jeje
tcc- jeje
?e 5
tcc " eax jeje ( ebx, ecx )"
tcc jeje
tcc- jeje
?e 6
tcc " eax jeje ( ebx , ecx )"
tcc jeje
tcc- jeje
EOF
EXPECT=<<EOF
1
eax jeje (ebx, ecx);
2
eax jeje (ebx, ecx);
3
eax jeje (ebx, ecx);
4
eax jeje (ebx, ecx);
5
eax jeje (ebx, ecx);
6
eax jeje (ebx, ecx);
EOF
RUN