rizin/test/db/cmd/cmd_idp
Basstorm 19a6a929f9
Rewrite PDB parser ##bin (#1517)
* Rewrite PDB parser to become endianess-independent
* Use type pretty-printing API
* Use `RzCmdStateOutput` instead of `RzOutputMode` to solve invalid JSON issue
* Move PDB-related print functions to `cpdb.c`
* Use flag API instead of calling commands from the code
* Separate printing from parsing and applying the type information
* Delete useless `main.c`
2021-10-09 16:57:29 +08:00

161 lines
3.1 KiB
Text

NAME=idp flags
FILE=bins/pdb/SimplePDB.exe
CMDS=<<EOF
idp bins/pdb/SimplePDB.pdb
fi 1 @ 0x00401000
fi 1 @ 0x00401010
EOF
EXPECT=<<EOF
0x00401000 4096 section..text
0x00401000 0 pdb.void___cdecl_SomeCoolFunction_void
0x00401010 0 pdb._main
EOF
RUN
NAME=idp bin state bug (#9441)
FILE=bins/pdb/SimplePDB.exe
CMDS=<<EOF
e asm.bits
idpi bins/pdb/SimplePDB.pdb~SomeCoolFunction
e asm.bits
EOF
EXPECT=<<EOF
32
0x00401000 2 .text void __cdecl SomeCoolFunction(void)
32
EOF
RUN
NAME=idpij
FILE==
CMDS=idpij bins/pdb/minimal.pdb~{}
EXPECT=<<EOF
[
{
"types": [
{
"type": "structure",
"name": "struct_typedef",
"size": 7,
"members": [
{
"member_type": "char",
"member_name": "a",
"offset": 0
},
{
"member_type": "int16_t",
"member_name": "b",
"offset": 1
},
{
"member_type": "int32_t",
"member_name": "c",
"offset": 3
}
]
},
{
"type": "union",
"name": "<unnamed-tag>",
"size": 4,
"members": [
{
"member_type": "char [4]",
"member_name": "a",
"offset": 0
},
{
"member_type": "int32_t",
"member_name": "b",
"offset": 0
}
]
},
{
"type": "structure",
"name": "unnamed_member_types_typedef",
"size": 8,
"members": [
{
"member_type": "union <unnamed-tag>",
"member_name": "a",
"offset": 0
},
{
"member_type": "int32_t",
"member_name": "b",
"offset": 4
}
]
},
{
"type": "structure",
"name": "bitfield_typedef",
"size": 1,
"members": [
]
},
{
"type": "union",
"name": "union_typedef",
"size": 4,
"members": [
{
"member_type": "char",
"member_name": "a",
"offset": 0
},
{
"member_type": "int16_t",
"member_name": "b",
"offset": 0
},
{
"member_type": "int32_t",
"member_name": "c",
"offset": 0
}
]
}
]
},
{
"gvars": [
{
"address": 12292,
"symtype": 0,
"section_name": ".data",
"gdata_name": "_uninitialized_global"
},
{
"address": 12288,
"symtype": 0,
"section_name": ".data",
"gdata_name": "_initialized_global"
},
{
"address": 4096,
"symtype": 2,
"section_name": ".text",
"gdata_name": "_function"
},
{
"address": 4182,
"symtype": 2,
"section_name": ".text",
"gdata_name": "_mainCRTStartup"
},
{
"address": 4120,
"symtype": 2,
"section_name": ".text",
"gdata_name": "_main"
}
]
}
]
EOF
RUN