I am using IDA Demo (evaluation version >7). I have a binary:
#include <stdbool.h>
int do_decode(){}
int main()
{
bool decode = false;
char opt = getopt();
switch (opt)
{
case 'd':
decode =true;
break;
default:
break;
}
if (decode) do_decode();
}
Is there any way to get variable information using IDA?
- if debug information is available
- stripped and optimized
I couldn't get variable type information in either case. For e.g. what I get from radare2:
[0x004004b9]> afv
var int64_t var_2h @ rbp-0x2
var uint32_t var_1h @ rbp-0x1
This is far from perfect, but at least something.
Here is my IDA textview:
; =============== S U B R O U T I N E =======================================
.text:00000000004004B9
.text:00000000004004B9 ; Attributes: bp-based frame
.text:00000000004004B9
.text:00000000004004B9 ; int __fastcall main(int, char **, char **)
.text:00000000004004B9 main proc near ; DATA XREF: start+1D↑o
.text:00000000004004B9
.text:00000000004004B9 var_2 = byte ptr -2
.text:00000000004004B9 var_1 = byte ptr -1
.text:00000000004004B9
.text:00000000004004B9 push rbp
.text:00000000004004BA mov rbp, rsp
.text:00000000004004BD sub rsp, 10h
.text:00000000004004C1 mov [rbp+var_1], 0
.text:00000000004004C5 mov eax, 0
.text:00000000004004CA call _getopt
.text:00000000004004CF mov [rbp+var_2], al
.text:00000000004004D2 movsx eax, [rbp+var_2]
.text:00000000004004D6 cmp eax, 64h ; 'd'
.text:00000000004004D9 jnz short loc_4004E1
.text:00000000004004DB mov [rbp+var_1], 1
.text:00000000004004DF jmp short loc_4004E2